Not Able to inject PojoCacheBean - Error in
Hi,
I am getting a weird issue with Spring 2.5+JDK 1.6..here is scenario....we are using MBeanProxyFactoryBean to inject the PojoCache and TreeCache of Jboss. It is working perfectly with Spring 2.5+JDK 5 without any issues. But the moment i change the compile setting and Java version to JDK 1.6, the Tree cache and Pojo Cache was not injected by Spring and i am getting the below given NPE.
My jmxcontext.xml is given below:-
Code:
<!-- JBOSS Cache -->
<bean id="jbossServer" class="org.springframework.jmx.support.MBeanServerFactoryBean">
<!-- indicate to first look for a server -->
<property name="locateExistingServerIfPossible" value="true"/>
</bean>
<bean id="PojoCacheMBean" class="org.springframework.jmx.access.MBeanProxyFactoryBean" >
<property name="objectName">
<value>jboss.cache:service=PojoCache</value>
</property>
<property name="proxyInterface" >
<value>org.jboss.cache.aop.PojoCacheMBean</value>
</property>
<property name="server" ref="jbossServer"/>
</bean>
<bean id="TreeCacheMBean" class="org.springframework.jmx.access.MBeanProxyFactoryBean">
<property name="objectName">
<value>jboss.cache:service=TreeCache</value>
</property>
<property name="proxyInterface" >
<value>org.jboss.cache.TreeCacheMBean</value>
</property>
</bean>
<bean id="treeCache" class="org.ets.ibis.core.cache.JbossCacheServiceImpl" autowire="byName">
<!-- set reference to appropriate cache proxy -->
<property name="cacheProxy" ref="TreeCacheMBean"/>
<property name="appPrefix" value="/app"/>
</bean>
<bean id="clusterCache" class="org.ets.ibis.core.cache.JbossCacheClusteredServiceImpl" autowire="byName">
<!-- set reference to appropriate cache proxy -->
<property name="cacheProxy" ref="PojoCacheMBean"/>
<property name="appPrefix" value="/app"/>
</bean>
<!-- Cache edit lock manager -->
<bean id="lockManager" class="org.ets.ibis.core.JbossCacheLockManager" lazy-init="true">
<!-- set reference to appropriate cache proxy -->
<property name="clusterCache" ref="clusterCache"/>
<property name="editMapKey" value="allEditObjMap"/>
</bean>
<!-- Ibis cache manager -->
<bean id="ibisCacheManager" class="org.ets.ibis.core.cache.IBISCacheManager" factory-method="getInstance" autowire="byName" >
<!-- set reference to appropriate cache proxy -->
<property name="localCache" ref="treeCache"/>
<property name="clusterCache" ref="clusterCache"/>
</bean>
The error log is given below:-
Code:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'treeCache' defined in class path resource [conf/spring/jmxContext.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByName(AbstractAutowireCapableBeanFactory.java:1029)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:977)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
... 204 more
Caused by: java.lang.NullPointerException
at javax.management.MBeanServerInvocationHandler.isLocal(MBeanServerInvocationHandler.java:455)
at javax.management.MBeanServerInvocationHandler.shouldDoLocally(MBeanServerInvocationHandler.java:405)
at javax.management.MBeanServerInvocationHandler.invoke(MBeanServerInvocationHandler.java:242)
at org.springframework.jmx.access.MBeanClientInterceptor.doInvoke(MBeanClientInterceptor.java:405)
at org.springframework.jmx.access.MBeanClientInterceptor.invoke(MBeanClientInterceptor.java:353)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy61.toString(Unknown Source)
at java.lang.String.valueOf(String.java:2826)
at java.lang.StringBuilder.append(StringBuilder.java:115)
at org.ets.ibis.core.cache.JbossCacheServiceImpl.afterPropertiesSet(JbossCacheServiceImpl.java:40)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1369)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335)
... 216 more
Again when we change the settings into JDK5, the application is deployed and running fine...
No clue why i am getting this issue with JDK6. I am using Spring 2.5+JDK6_16+JBoss EAP 4.3+Windows XP.
thanks in advance
Saikiran