Weblogic 12.1.3.0.0 - Ehcache JMS Replication - InvalidExpressionException: Expression : "cacheManagerUniqueId
Asked Answered
G

1

8

I have Spring based application with Ehcache JMS Replication. I need to deploy this application to Weblogic 12, however there is following error that fails deployment:

javax.jms.InvalidSelectorException: weblogic.messaging.kernel.InvalidExpressionException:
Expression : "cacheManagerUniqueId <> 600767500

What is wrong?

weblogic-application.xml

<?xml version="1.0" encoding="UTF-8"?>
<wls:weblogic-application xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-application"
                          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                          xsi:schemaLocation="http://xmlns.oracle.com/weblogic/weblogic-application http://xmlns.oracle.com/weblogic/weblogic-application/1.3/weblogic-application.xsd">

    <!--Configure the FilteringClassLoader to specify a certain package is loaded from an application-->

    <wls:prefer-application-packages>
        <!--<wls:package-name>javax.validation.*</wls:package-name>
        <wls:package-name>javax.validation.spi.*</wls:package-name>-->
        <wls:package-name>javax.persistence.spi.*</wls:package-name>
        <wls:package-name>javax.persistence.criteria.*</wls:package-name>
        <wls:package-name>javax.persistence.metamodel.*</wls:package-name>
        <wls:package-name>javax.persistence.*</wls:package-name>
        <wls:package-name>org.springframework.*</wls:package-name>
        <wls:package-name>org.hibernate.validator.*</wls:package-name>
        <wls:package-name>org.hibernate.*</wls:package-name>
        <wls:package-name>net.sf.ehcache.*</wls:package-name>
        <!--<wls:package-name>antlr.*</wls:package-name>-->
        <wls:package-name>org.codehaus.jackson.*</wls:package-name>
        <wls:package-name>com.fasterxml.jackson.*</wls:package-name>
        <wls:package-name>org.apache.log4j.*</wls:package-name>
        <wls:package-name>org.slf4j</wls:package-name>
        <!--ftp-->
        <wls:package-name>org.apache.commons.net.*</wls:package-name>
        <wls:package-name>org.apache.commons.lang.*</wls:package-name>

        <wls:package-name>com.thoughtworks.xstream.*</wls:package-name>
        <wls:package-name>com.google.*</wls:package-name>

    </wls:prefer-application-packages>

</wls:weblogic-application>

Maven dependencies:

<dependency>
    <groupId>net.sf.ehcache</groupId>
    <artifactId>ehcache-jmsreplication</artifactId>
    <version>0.5</version>
</dependency>
<dependency>
    <groupId>com.googlecode.ehcache-spring-annotations</groupId>
    <artifactId>ehcache-spring-annotations</artifactId>
    <version>1.2.0</version>
    <exclusions>
        <exclusion>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
        </exclusion>
    </exclusions>
</dependency>
<dependency>
    <groupId>net.sf.ehcache</groupId>
    <artifactId>ehcache-core</artifactId>
    <version>2.6.11</version>
</dependency>
<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-ehcache</artifactId>
    <version>4.3.11.Final</version>
    <exclusions>
        <exclusion>
            <groupId>net.sf.ehcache</groupId>
            <artifactId>ehcache-core</artifactId>
        </exclusion>
    </exclusions>
</dependency>
<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-core</artifactId>
    <version>${hibernate.version}</version>
    <exclusions>
        <exclusion>
            <groupId>org.hibernate.javax.persistence</groupId>
            <artifactId>hibernate-jpa-2.1-api</artifactId>
        </exclusion>
        <exclusion>
            <groupId>xml-apis</groupId>
            <artifactId>xml-apis</artifactId>
        </exclusion>
        <exclusion>
            <groupId>antlr</groupId>
            <artifactId>antlr</artifactId>
        </exclusion>
        <exclusion>
            <groupId>org.javassist</groupId>
            <artifactId>javassist</artifactId>
        </exclusion>
    </exclusions>
</dependency>
<dependency>
    <groupId>antlr</groupId>
    <artifactId>antlr</artifactId>
    <version>2.7.7</version>
    <scope>test</scope>
</dependency>

Full Stack Trace:

Caused By: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.googlecode.ehcache.annotations.config.internalEhCacheCachingAdvisor': Cannot resolve reference to bean 'com.googlecode.ehcache.annotations.impl.CacheStaticMethodMatcherPointcut#0' while setting bean property 'pointcut'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.googlecode.ehcache.annotations.impl.CacheStaticMethodMatcherPointcut#0': Cannot resolve reference to bean 'com.googlecode.ehcache.annotations.impl.CacheAttributeSourceImpl#0' while setting bean property 'cacheAttributeSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.googlecode.ehcache.annotations.impl.CacheAttributeSourceImpl#0': Cannot resolve reference to bean 'serviceCacheManager' while setting bean property 'cacheManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'serviceCacheManager' defined in class path resource [service-context.xml]: Invocation of init method failed; nested exception is net.sf.ehcache.CacheException: Exception while creating JMS connections: weblogic.messaging.kernel.InvalidExpressionException: Expression : "cacheManagerUniqueId <> 600767500"
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:359)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1481)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1226)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)
    Truncated. see log file for complete stacktrace
Caused By: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.googlecode.ehcache.annotations.impl.CacheStaticMethodMatcherPointcut#0': Cannot resolve reference to bean 'com.googlecode.ehcache.annotations.impl.CacheAttributeSourceImpl#0' while setting bean property 'cacheAttributeSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.googlecode.ehcache.annotations.impl.CacheAttributeSourceImpl#0': Cannot resolve reference to bean 'serviceCacheManager' while setting bean property 'cacheManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'serviceCacheManager' defined in class path resource [service-context.xml]: Invocation of init method failed; nested exception is net.sf.ehcache.CacheException: Exception while creating JMS connections: weblogic.messaging.kernel.InvalidExpressionException: Expression : "cacheManagerUniqueId <> 600767500"
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:359)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1481)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1226)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)
    Truncated. see log file for complete stacktrace
Caused By: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.googlecode.ehcache.annotations.impl.CacheAttributeSourceImpl#0': Cannot resolve reference to bean 'serviceCacheManager' while setting bean property 'cacheManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'serviceCacheManager' defined in class path resource [service-context.xml]: Invocation of init method failed; nested exception is net.sf.ehcache.CacheException: Exception while creating JMS connections: weblogic.messaging.kernel.InvalidExpressionException: Expression : "cacheManagerUniqueId <> 600767500"
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:359)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1481)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1226)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)
    Truncated. see log file for complete stacktrace
Caused By: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'serviceCacheManager' defined in class path resource [service-context.xml]: Invocation of init method failed; nested exception is net.sf.ehcache.CacheException: Exception while creating JMS connections: weblogic.messaging.kernel.InvalidExpressionException: Expression : "cacheManagerUniqueId <> 600767500"
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    Truncated. see log file for complete stacktrace
Caused By: net.sf.ehcache.CacheException: Exception while creating JMS connections: weblogic.messaging.kernel.InvalidExpressionException: Expression : "cacheManagerUniqueId <> 600767500"
    at net.sf.ehcache.distribution.jms.JMSCacheManagerPeerProvider.init(JMSCacheManagerPeerProvider.java:193)
    at net.sf.ehcache.CacheManager.doInit(CacheManager.java:447)
    at net.sf.ehcache.CacheManager.init(CacheManager.java:377)
    at net.sf.ehcache.CacheManager.<init>(CacheManager.java:259)
    at net.sf.ehcache.CacheManager.newInstance(CacheManager.java:1037)
    Truncated. see log file for complete stacktrace
Caused By: javax.jms.InvalidSelectorException: weblogic.messaging.kernel.InvalidExpressionException: Expression : "cacheManagerUniqueId <> 600767500"
    at weblogic.jms.dispatcher.DispatcherAdapter.convertToJMSExceptionAndThrow(DispatcherAdapter.java:110)
    at weblogic.jms.dispatcher.DispatcherAdapter.dispatchSync(DispatcherAdapter.java:45)
    at weblogic.jms.client.JMSSession.consumerCreate(JMSSession.java:3048)
    at weblogic.jms.client.JMSSession.setupConsumer(JMSSession.java:2806)
    at weblogic.jms.client.JMSSession.createConsumer(JMSSession.java:2748)
    Truncated. see log file for complete stacktrace
Caused By: javax.jms.InvalidSelectorException: weblogic.messaging.kernel.InvalidExpressionException: Expression : "cacheManagerUniqueId <> 600767500"
    at weblogic.jms.dispatcher.Request.handleThrowable(Request.java:87)
    at weblogic.jms.dispatcher.Request.getResult(Request.java:52)
    at weblogic.messaging.dispatcher.Request.wrappedFiniteStateMachine(Request.java:1135)
    at weblogic.messaging.dispatcher.DispatcherImpl.syncRequest(DispatcherImpl.java:201)
    at weblogic.messaging.dispatcher.DispatcherImpl.dispatchSync(DispatcherImpl.java:236)
    Truncated. see log file for complete stacktrace
Caused By: javax.jms.InvalidSelectorException: weblogic.messaging.kernel.InvalidExpressionException: Expression : "cacheManagerUniqueId <> 600767500"
    at weblogic.jms.dispatcher.DispatcherAdapter.convertToJMSExceptionAndThrow(DispatcherAdapter.java:110)
    at weblogic.jms.dispatcher.DispatcherAdapter.dispatchSync(DispatcherAdapter.java:45)
    at weblogic.jms.frontend.FEConsumer.<init>(FEConsumer.java:296)
    at weblogic.jms.frontend.FESession$2.run(FESession.java:1078)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
    Truncated. see log file for complete stacktrace
Caused By: javax.jms.InvalidSelectorException: weblogic.messaging.kernel.InvalidExpressionException: Expression : "cacheManagerUniqueId <> 600767500"
    at weblogic.jms.dispatcher.Request.handleThrowable(Request.java:87)
    at weblogic.jms.dispatcher.Request.getResult(Request.java:52)
    at weblogic.messaging.dispatcher.Request.wrappedFiniteStateMachine(Request.java:1135)
    at weblogic.messaging.dispatcher.DispatcherImpl.syncRequest(DispatcherImpl.java:201)
    at weblogic.messaging.dispatcher.DispatcherImpl.dispatchSync(DispatcherImpl.java:236)
    Truncated. see log file for complete stacktrace
Caused By: javax.jms.InvalidSelectorException: weblogic.messaging.kernel.InvalidExpressionException: Expression : "cacheManagerUniqueId <> 600767500"
    at weblogic.jms.backend.BEQueueImpl.createFilterExpression(BEQueueImpl.java:161)
    at weblogic.jms.backend.BEQueueImpl.createConsumer(BEQueueImpl.java:188)
    at weblogic.jms.backend.BESessionImpl.createBEConsumer(BESessionImpl.java:469)
    at weblogic.jms.backend.BESessionImpl.createConsumer(BESessionImpl.java:479)
    at weblogic.jms.backend.BESessionImpl.invoke(BESessionImpl.java:297)
    Truncated. see log file for complete stacktrace
Gefen answered 3/9, 2017 at 19:43 Comment(3)
do you have any progress on this?Lust
This works on the lower version of weblogic? Like 10? With the Java6?Superelevation
It doesn't work with weblogic 10 due to other dependencies I have in the projectGefen
L
0

There is similar question without solve:

The problem with expressions, which are used to route messages in JMS of ehcache. Ehcache is open source, you can see example code (I got from github, but of course you can get ehcache source from their site, if you'd like):

String messageSelector = CACHE_MANAGER_UID + " <> " + localCacheManagerUid(cacheManager);

Despite of Weblogic, which are not open source. So I suppose you to debug code and see what happens inside

weblogic.jms.backend.BEQueueImpl.createFilterExpression

because it obviously that it doesn't support this grammar.

Possible reason could be conflict with antlr.jar library between your application and weblogic. In that case you should try to configure preferred packages in your configuration.

Lust answered 9/9, 2017 at 9:41 Comment(1)
I also think it is somehow related to the antlr library conflicts but I already tried to include antlr in <wls:prefer-application-packages> as well as exclude it from there (rely on weblogic dependency). In both cases it doesn't work properly, however this is the main suspect...Gefen

© 2022 - 2024 — McMap. All rights reserved.