Announcement Announcement Module
Collapse
No announcement yet.
Spring JMX RMI, error with:org.apache.naming.java.javaURLContextFactory Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring JMX RMI, error with:org.apache.naming.java.javaURLContextFactory

    Hi,

    When I want to expose remote mbeans and try to initialize the rmi-connector, I have this issue:

    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'serverConnector' defined in URL [bundleentry://208.fwk1259252154/META-INF/spring/context.xml]: Invocation of init method failed; nested exception is java.io.IOException: Cannot bind to URL [rmi://localhost:9753/servername]: javax.naming.NoInitialContextException: Cannot instantiate class: org.apache.naming.java.javaURLContextFactory [Root exception is java.lang.ClassNotFoundException: org.apache.naming.java.javaURLContextFactory not found from bundle [com.mootwin.samples.osgi-consumer]]

    Caused by: java.io.IOException: Cannot bind to URL [rmi://localhost:9753/servername]: javax.naming.NoInitialContextException: Cannot instantiate class: org.apache.naming.java.javaURLContextFactory [Root exception is java.lang.ClassNotFoundException: org.apache.naming.java.javaURLContextFactory not found from bundle [com.mootwin.samples.osgi-consumer]]
    at javax.management.remote.rmi.RMIConnectorServer.new IOException(RMIConnectorServer.java:804)
    at javax.management.remote.rmi.RMIConnectorServer.sta rt(RMIConnectorServer.java:417)
    at org.springframework.jmx.support.ConnectorServerFac toryBean.afterPropertiesSet(ConnectorServerFactory Bean.java:172)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.invokeInitMethods(Abstr actAutowireCapableBeanFactory.java:1477)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.initializeBean(Abstract AutowireCapableBeanFactory.java:1417)
    ... 17 common frames omitted
    Caused by: javax.naming.NoInitialContextException: Cannot instantiate class: org.apache.naming.java.javaURLContextFactory
    at javax.naming.spi.NamingManager.getInitialContext(N amingManager.java:657)
    at javax.naming.InitialContext.getDefaultInitCtx(Init ialContext.java:288)
    at javax.naming.InitialContext.init(InitialContext.ja va:223)
    at javax.naming.InitialContext.<init>(InitialContext. java:197)
    at javax.management.remote.rmi.RMIConnectorServer.bin d(RMIConnectorServer.java:619)
    at javax.management.remote.rmi.RMIConnectorServer.sta rt(RMIConnectorServer.java:412)
    ... 20 common frames omitted
    Caused by: java.lang.ClassNotFoundException: org.apache.naming.java.javaURLContextFactory not found from bundle [com.mootwin.samples.osgi-consumer]
    at org.springframework.osgi.util.BundleDelegatingClas sLoader.findClass(BundleDelegatingClassLoader.java :103)
    at org.springframework.osgi.util.BundleDelegatingClas sLoader.loadClass(BundleDelegatingClassLoader.java :156)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:2 47)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:247)
    at com.sun.naming.internal.VersionHelper12.loadClass( VersionHelper12.java:46)
    at javax.naming.spi.NamingManager.getInitialContext(N amingManager.java:654)
    ... 25 common frames omitted
    Caused by: org.eclipse.virgo.kernel.osgi.framework.ExtendedCl assNotFoundException: org.apache.naming.java.javaURLContextFactory in KernelBundleClassLoader: [bundle=com.mootwin.samples.osgi-consumer_0.0.1.SNAPSHOT]
    at org.eclipse.virgo.kernel.userregion.internal.equin ox.KernelBundleClassLoader.loadClass(KernelBundleC lassLoader.java:138)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:2 47)
    at org.eclipse.osgi.internal.loader.BundleLoader.load Class(BundleLoader.java:345)
    at org.eclipse.osgi.framework.internal.core.BundleHos t.loadClass(BundleHost.java:229)
    at org.eclipse.osgi.framework.internal.core.AbstractB undle.loadClass(AbstractBundle.java:1207)
    at org.springframework.osgi.util.BundleDelegatingClas sLoader.findClass(BundleDelegatingClassLoader.java :99)
    ... 31 common frames omitted
    Caused by: java.lang.ClassNotFoundException: org.apache.naming.java.javaURLContextFactory
    at org.eclipse.osgi.internal.loader.BundleLoader.find ClassInternal(BundleLoader.java:513)
    at org.eclipse.osgi.internal.loader.BundleLoader.find Class(BundleLoader.java:429)
    at org.eclipse.osgi.internal.loader.BundleLoader.find Class(BundleLoader.java:417)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClass Loader.loadClass(DefaultClassLoader.java:107)
    at org.eclipse.virgo.kernel.userregion.internal.equin ox.KernelBundleClassLoader.loadClass(KernelBundleC lassLoader.java:134)



    The configuration looks like:


    <context:mbean-server/>


    <bean id="mbeanExporterUIS" class="org.springframework.jmx.export.MBeanExporte r">
    <property name="beans">
    <map>
    <entry key="uis:name=UISMbean" value-ref="uis" />
    </map>
    </property>
    <property name="server" ref="mbeanServer" />
    <property name="registrationBehaviorName" value="REGISTRATION_IGNORE_EXISTING"/>
    </bean>
    <bean id="mbeanExporterNotif" class="org.springframework.jmx.export.MBeanExporte r">
    <property name="beans">
    <map>
    <entry key="notif:name=NotifMbean" value-ref="notif" />
    </map>
    </property>
    <property name="server" ref="mbeanServer" />
    <property name="registrationBehaviorName" value="REGISTRATION_IGNORE_EXISTING"/>
    </bean>
    <bean id="mbeanExporterRepository" class="org.springframework.jmx.export.MBeanExporte r">
    <property name="beans">
    <map>
    <entry key="repository:name=RepositoryMbean" value-ref="repository" />
    </map>
    </property>
    <property name="server" ref="mbeanServer" />
    <property name="registrationBehaviorName" value="REGISTRATION_IGNORE_EXISTING"/>
    </bean>

    <bean id="registry"
    class="org.springframework.remoting.rmi.RmiRegistr yFactoryBean">
    <property name="port" value="9753" />
    </bean>

    <bean id="serverConnector"
    class="org.springframework.jmx.support.ConnectorSe rverFactoryBean" destroy-method="destroy">
    <property name="objectName" value="connector:name=rmi" />
    <property name="serviceUrl" value="service:jmx:rmi://localhost/jndi/rmi://localhost:9753/servername" />
    <property name="server" ref="mbeanServer"/>
    </bean>


    Any ideas whats going wrong?

    Thanks

  • #2
    Hi There,

    I know this is a bit of a long shot, but I've wrestling with this exam same error, did you ever get this to work?

    Many Thanks,
    Adrian.

    Originally posted by moon View Post
    Hi,

    When I want to expose remote mbeans and try to initialize the rmi-connector, I have this issue:

    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'serverConnector' defined in URL [bundleentry://208.fwk1259252154/META-INF/spring/context.xml]: Invocation of init method failed; nested exception is java.io.IOException: Cannot bind to URL [rmi://localhost:9753/servername]: javax.naming.NoInitialContextException: Cannot instantiate class: org.apache.naming.java.javaURLContextFactory [Root exception is java.lang.ClassNotFoundException: org.apache.naming.java.javaURLContextFactory not found from bundle [com.mootwin.samples.osgi-consumer]]

    <snip>

    Any ideas whats going wrong?

    Thanks

    Comment

    Working...
    X