Hi
I'm have problem with running two web apps in one app. server. Both use spring for exporting spring beans on mbean server.
When I run only one app. everything is OK.
This is (example) applicationContext.xml for first app:
applicationContext.xml for second app is similar:Code:<?xml version="1.0"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <beans> <!-- Creates the mbeanServer --> <bean id="mbeanServer" class="org.springframework.jmx.support.MBeanServerFactoryBean"> <property name="locateExistingServerIfPossible" value="true" /> </bean> <!-- RMI registry --> <bean id="rmiRegistryFactoryBean" class="org.springframework.remoting.rmi.RmiRegistryFactoryBean"> </bean> <bean id="serviceUrl" class="java.lang.String"> <constructor-arg type="java.lang.String"> <value>service:jmx:rmi://localhost/jndi/rmi://localhost:1099/jmxrmi</value> </constructor-arg> </bean> <bean id="jmxServiceURL" class="javax.management.remote.JMXServiceURL"> <constructor-arg> <ref local="serviceUrl"/> </constructor-arg> </bean> <bean id="jmxConnectorServer" class="org.springframework.jmx.support.ConnectorServerFactoryBean" depends-on="mbeanServer"> <property name="serviceUrl"> <ref local="serviceUrl"/> </property> <property name="server"> <ref local="mbeanServer"/> </property> <property name="environmentMap"> <map> <entry key="JMXConnectorServerFactory.PROTOCOL_PROVIDER_PACKAGES"> <value>MX4JRemoteConstants.PROVIDER_PACKAGES</value> </entry> </map> </property> </bean> <!-- exports the beans with the assembler --> <bean id="jmxAdapter" class="org.springframework.jmx.export.MBeanExporter"> <property name="beans"> <map> <entry key="appOne:name=TestAppOne"> <ref local="TestAppOne" /> </entry> </map> </property> <property name="server"> <ref local="mbeanServer" /> </property> </bean> <bean id="TestAppOne" class="TestAppOne"/> </beans>
When app. server is started (Orion) first app is started OK (with JMX mbeans exported), but second app throws this excpetion:Code:... <!-- exports the beans with the assembler --> <bean id="jmxAdapter" class="org.springframework.jmx.export.MBeanExporter"> <property name="beans"> <map> <entry key="appTwo:name=TestAppTwo"> <ref local="TestAppTwo" /> </entry> </map> </property> <property name="server"> <ref local="mbeanServer" /> </property> </bean> <bean id="TestAppTwo" class="TestAppTwo"/> ...
I don't understand why is MBeanServerFactoryBean referenced instead od MBeanServer.Code:Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean wit h name 'jmxConnectorServer' defined in ServletContext resource [/WEB-INF/applica tionContext.xml]: Error setting property values; nested exception is org.springf ramework.beans.PropertyAccessExceptionsException: PropertyAccessExceptionsExcept ion (1 errors); nested propertyAccessExceptions are: [org.springframework.beans. TypeMismatchException: Failed to convert property value of type [org.springframe work.jmx.support.MBeanServerFactoryBean] to required type [javax.management.MBea nServer] for property 'server'] PropertyAccessExceptionsException (1 errors) org.springframework.beans.TypeMismatchException: Failed to convert property valu e of type [org.springframework.jmx.support.MBeanServerFactoryBean] to required t ype [javax.management.MBeanServer] for property 'server' at org.springframework.beans.BeanWrapperImpl.doTypeConversionIfNecessary (BeanWrapperImpl.java:1103) at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrappe rImpl.java:848) at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrappe rImpl.java:733) at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrappe rImpl.java:890) at org.springframework.beans.BeanWrapperImpl.setPropertyValues(BeanWrapp erImpl.java:917) at org.springframework.beans.BeanWrapperImpl.setPropertyValues(BeanWrapp erImpl.java:906) at org.springframework.beans.factory.support.AbstractAutowireCapableBean Factory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1022) at org.springframework.beans.factory.support.AbstractAutowireCapableBean Factory.populateBean(AbstractAutowireCapableBeanFactory.java:823) at org.springframework.beans.factory.support.AbstractAutowireCapableBean Factory.createBean(AbstractAutowireCapableBeanFactory.java:345) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean (AbstractBeanFactory.java:226) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean (AbstractBeanFactory.java:147) at org.springframework.beans.factory.support.DefaultListableBeanFactory. preInstantiateSingletons(DefaultListableBeanFactory.java:275) at org.springframework.context.support.AbstractApplicationContext.refres h(AbstractApplicationContext.java:318) at org.springframework.web.context.support.AbstractRefreshableWebApplica tionContext.refresh(AbstractRefreshableWebApplicationContext.java:134) at org.springframework.web.context.ContextLoader.createWebApplicationCon text(ContextLoader.java:230) at org.springframework.web.context.ContextLoader.initWebApplicationConte xt(ContextLoader.java:156) at org.springframework.web.context.ContextLoaderListener.contextInitiali zed(ContextLoaderListener.java:48) at com.evermind._ay._lee(.:552) at com.evermind._ay.<init>(.:317) at com.evermind._am._rtb(.:607) at com.evermind._ex._rtb(.:581) at com.evermind._eu._kae(.:482) at com.evermind._eu._bi(.:226) at com.evermind._ex._bn(.:240) at com.evermind._ex._bi(.:146) at com.evermind.server.ApplicationServer._gke(.:1730) at com.evermind.server.ApplicationServer._bi(.:1068) at com.evermind._ctb.run(.:89) at java.lang.Thread.run(Thread.java:595) at com.evermind._bf.run(.:47)
If I deploy only second app. everything runs fine.
Any ideas?
Thanks in advance.
Regards,
Denis


Reply With Quote