Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Problem with RMI in eclipse (ClassNotFound)
Problem with RMI in eclipse (ClassNotFound) [message #153486] Thu, 06 November 2003 11:20 Go to next message
Eclipse UserFriend
Originally posted by: lilith.al-jadiri.bmw-carit.de

Hi,
I am writing a certain plug-in where I have to invoke a method of a MBean
running on a JMX server. I added the .jar(where the .class files are in)
of that MBean as external jars to my project. There is no problem with
compiling my code and invoking the method; however, I get an error at
runtime back because the return type of the method invoked can't be found
although the .class is in the jar file included. It would be great if
anyone can help ASAP .Here is my code snippet followed by the error
message:

System.setSecurityManager(new RMISecurityManager());
Properties p = System.getProperties();
p.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.rmi.registry.RegistryContextFactory");
p.put(Context.PROVIDER_URL, "rmi://localhost:1099");
JRMPConnector connector = new JRMPConnector();
String jndiName = "jrmp";
connector.connect(jndiName, p);
// Get the remote MBeanServer from the connector
// And use it as if it is an MBeanServer
RemoteMBeanServer remoteServer = connector.getRemoteMBeanServer();
ObjectName objName = new ObjectName("de.bmw.VCM:type=management");

try{
Object result =
remoteServer.invoke(objName,"getUnits",new Object[]{new Integer(1)},new
String[]{"java.lang.Integer"});

}catch (javax.management.RuntimeMBeanException rme) {
if (rme.getTargetException() != null) {
rme.getTargetException().printStackTrace();
} else {
rme.printStackTrace();
}
}

the "result" return object is from type "de.bmw.ECU" , the .class of that
class happens to be in the external jar included in the project. Here is
the error stack:

ava.rmi.UnmarshalException: Exception while reading result; nested
exception is:
java.lang.ClassNotFoundException: de.bmw.vcm.ECU
at mx4j.adaptor.rmi.RMIAdaptor_Stub.invoke(Unknown Source)
at mx4j.connector.rmi.RMIConnector.invoke(RMIConnector.java:186 )
at
mx4j.connector.rmi.RMIConnector$RemoteMBeanServerImpl$Handle r.invoke(RMIConnector.java:548)
at $Proxy0.invoke(Unknown Source)
at
mx4j.connector.rmi.RMIConnector$RemoteMBeanServerImpl.invoke (RMIConnector.java:411)
at de.bmw.example.views.TestgetMBean.<init>(TestgetMBean.java:77)
at de.bmw.example.views.DeviceView.<init>(DeviceView.java:79)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Nativ e Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(Native ConstructorAccessorImpl.java:39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(De legatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:2 74)
at java.lang.Class.newInstance0(Class.java:306)
at java.lang.Class.newInstance(Class.java:259)

thanks,
Lilith
Anyone out there??? [message #153540 is a reply to message #153486] Thu, 06 November 2003 15:06 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: lilith.al-jadiri.bmw-carit.de

Aljadiri wrote:

> Hi,
> I am writing a certain plug-in where I have to invoke a method of a MBean
> running on a JMX server. I added the .jar(where the .class files are in)
> of that MBean as external jars to my project. There is no problem with
> compiling my code and invoking the method; however, I get an error at
> runtime back because the return type of the method invoked can't be found
> although the .class is in the jar file included. It would be great if
> anyone can help ASAP .Here is my code snippet followed by the error
> message:

> System.setSecurityManager(new RMISecurityManager());
> Properties p = System.getProperties();
> p.put(Context.INITIAL_CONTEXT_FACTORY,
> "com.sun.jndi.rmi.registry.RegistryContextFactory");
> p.put(Context.PROVIDER_URL, "rmi://localhost:1099");
> JRMPConnector connector = new JRMPConnector();
> String jndiName = "jrmp";
> connector.connect(jndiName, p);
> // Get the remote MBeanServer from the connector
> // And use it as if it is an MBeanServer
> RemoteMBeanServer remoteServer = connector.getRemoteMBeanServer();
> ObjectName objName = new ObjectName("de.bmw.VCM:type=management");

> try{
> Object result =
> remoteServer.invoke(objName,"getUnits",new Object[]{new Integer(1)},new
> String[]{"java.lang.Integer"});

> }catch (javax.management.RuntimeMBeanException rme) {
> if (rme.getTargetException() != null) {
> rme.getTargetException().printStackTrace();
> } else {
> rme.printStackTrace();
> }
> }

> the "result" return object is from type "de.bmw.ECU" , the .class of that
> class happens to be in the external jar included in the project. Here is
> the error stack:

> ava.rmi.UnmarshalException: Exception while reading result; nested
> exception is:
> java.lang.ClassNotFoundException: de.bmw.vcm.ECU
> at mx4j.adaptor.rmi.RMIAdaptor_Stub.invoke(Unknown Source)
> at mx4j.connector.rmi.RMIConnector.invoke(RMIConnector.java:186 )
> at
>
mx4j.connector.rmi.RMIConnector$RemoteMBeanServerImpl$Handle r.invoke(RMIConnector.java:548)
> at $Proxy0.invoke(Unknown Source)
> at
>
mx4j.connector.rmi.RMIConnector$RemoteMBeanServerImpl.invoke (RMIConnector.java:411)
> at de.bmw.example.views.TestgetMBean.<init>(TestgetMBean.java:77)
> at de.bmw.example.views.DeviceView.<init>(DeviceView.java:79)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Nativ e Method)
> at
>
sun.reflect.NativeConstructorAccessorImpl.newInstance(Native ConstructorAccessorImpl.java:39)
> at
>
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(De legatingConstructorAccessorImpl.java:27)
> at java.lang.reflect.Constructor.newInstance(Constructor.java:2 74)
> at java.lang.Class.newInstance0(Class.java:306)
> at java.lang.Class.newInstance(Class.java:259)

> thanks,
> Lilith
Re: Anyone out there??? [message #153545 is a reply to message #153540] Thu, 06 November 2003 15:10 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: vgusev.graphlogic.com

Is this jar in your plugin.xml file?
"Aljadiri" <lilith.al-jadiri@bmw-carit.de> wrote in message
news:bodo24$65d$1@eclipse.org...
> Aljadiri wrote:
>
> > Hi,
> > I am writing a certain plug-in where I have to invoke a method of a
MBean
> > running on a JMX server. I added the .jar(where the .class files are in)
> > of that MBean as external jars to my project. There is no problem with
> > compiling my code and invoking the method; however, I get an error at
> > runtime back because the return type of the method invoked can't be
found
> > although the .class is in the jar file included. It would be great if
> > anyone can help ASAP .Here is my code snippet followed by the error
> > message:
>
> > System.setSecurityManager(new RMISecurityManager());
> > Properties p = System.getProperties();
> > p.put(Context.INITIAL_CONTEXT_FACTORY,
> > "com.sun.jndi.rmi.registry.RegistryContextFactory");
> > p.put(Context.PROVIDER_URL, "rmi://localhost:1099");
> > JRMPConnector connector = new JRMPConnector();
> > String jndiName = "jrmp";
> > connector.connect(jndiName, p);
> > // Get the remote MBeanServer from the connector
> > // And use it as if it is an MBeanServer
> > RemoteMBeanServer remoteServer = connector.getRemoteMBeanServer();
> > ObjectName objName = new ObjectName("de.bmw.VCM:type=management");
>
> > try{
> > Object result =
> > remoteServer.invoke(objName,"getUnits",new Object[]{new
Integer(1)},new
> > String[]{"java.lang.Integer"});
>
> > }catch (javax.management.RuntimeMBeanException rme) {
> > if (rme.getTargetException() != null) {
> > rme.getTargetException().printStackTrace();
> > } else {
> > rme.printStackTrace();
> > }
> > }
>
> > the "result" return object is from type "de.bmw.ECU" , the .class of
that
> > class happens to be in the external jar included in the project. Here is
> > the error stack:
>
> > ava.rmi.UnmarshalException: Exception while reading result; nested
> > exception is:
> > java.lang.ClassNotFoundException: de.bmw.vcm.ECU
> > at mx4j.adaptor.rmi.RMIAdaptor_Stub.invoke(Unknown Source)
> > at mx4j.connector.rmi.RMIConnector.invoke(RMIConnector.java:186 )
> > at
> >
>
mx4j.connector.rmi.RMIConnector$RemoteMBeanServerImpl$Handle r.invoke(RMIConn
ector.java:548)
> > at $Proxy0.invoke(Unknown Source)
> > at
> >
>
mx4j.connector.rmi.RMIConnector$RemoteMBeanServerImpl.invoke (RMIConnector.ja
va:411)
> > at de.bmw.example.views.TestgetMBean.<init>(TestgetMBean.java:77)
> > at de.bmw.example.views.DeviceView.<init>(DeviceView.java:79)
> > at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Nativ e Method)
> > at
> >
>
sun.reflect.NativeConstructorAccessorImpl.newInstance(Native ConstructorAcces
sorImpl.java:39)
> > at
> >
>
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(De legatingConstruc
torAccessorImpl.java:27)
> > at java.lang.reflect.Constructor.newInstance(Constructor.java:2 74)
> > at java.lang.Class.newInstance0(Class.java:306)
> > at java.lang.Class.newInstance(Class.java:259)
>
> > thanks,
> > Lilith
>
>
Re: Anyone out there??? [message #153551 is a reply to message #153545] Thu, 06 November 2003 15:24 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: lilith.al-jadiri.bmw-carit.de

Yes I do!!!

Lilith

Vladimir wrote:

> Is this jar in your plugin.xml file?
> "Aljadiri" <lilith.al-jadiri@bmw-carit.de> wrote in message
> news:bodo24$65d$1@eclipse.org...
> > Aljadiri wrote:
> >
> > > Hi,
> > > I am writing a certain plug-in where I have to invoke a method of a
> MBean
> > > running on a JMX server. I added the .jar(where the .class files are in)
> > > of that MBean as external jars to my project. There is no problem with
> > > compiling my code and invoking the method; however, I get an error at
> > > runtime back because the return type of the method invoked can't be
> found
> > > although the .class is in the jar file included. It would be great if
> > > anyone can help ASAP .Here is my code snippet followed by the error
> > > message:
> >
> > > System.setSecurityManager(new RMISecurityManager());
> > > Properties p = System.getProperties();
> > > p.put(Context.INITIAL_CONTEXT_FACTORY,
> > > "com.sun.jndi.rmi.registry.RegistryContextFactory");
> > > p.put(Context.PROVIDER_URL, "rmi://localhost:1099");
> > > JRMPConnector connector = new JRMPConnector();
> > > String jndiName = "jrmp";
> > > connector.connect(jndiName, p);
> > > // Get the remote MBeanServer from the connector
> > > // And use it as if it is an MBeanServer
> > > RemoteMBeanServer remoteServer = connector.getRemoteMBeanServer();
> > > ObjectName objName = new ObjectName("de.bmw.VCM:type=management");
> >
> > > try{
> > > Object result =
> > > remoteServer.invoke(objName,"getUnits",new Object[]{new
> Integer(1)},new
> > > String[]{"java.lang.Integer"});
> >
> > > }catch (javax.management.RuntimeMBeanException rme) {
> > > if (rme.getTargetException() != null) {
> > > rme.getTargetException().printStackTrace();
> > > } else {
> > > rme.printStackTrace();
> > > }
> > > }
> >
> > > the "result" return object is from type "de.bmw.ECU" , the .class of
> that
> > > class happens to be in the external jar included in the project. Here is
> > > the error stack:
> >
> > > ava.rmi.UnmarshalException: Exception while reading result; nested
> > > exception is:
> > > java.lang.ClassNotFoundException: de.bmw.vcm.ECU
> > > at mx4j.adaptor.rmi.RMIAdaptor_Stub.invoke(Unknown Source)
> > > at mx4j.connector.rmi.RMIConnector.invoke(RMIConnector.java:186 )
> > > at
> > >
> >
> mx4j.connector.rmi.RMIConnector$RemoteMBeanServerImpl$Handle r.invoke(RMIConn
> ector.java:548)
> > > at $Proxy0.invoke(Unknown Source)
> > > at
> > >
> >
> mx4j.connector.rmi.RMIConnector$RemoteMBeanServerImpl.invoke (RMIConnector.ja
> va:411)
> > > at de.bmw.example.views.TestgetMBean.<init>(TestgetMBean.java:77)
> > > at de.bmw.example.views.DeviceView.<init>(DeviceView.java:79)
> > > at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Nativ e Method)
> > > at
> > >
> >
> sun.reflect.NativeConstructorAccessorImpl.newInstance(Native ConstructorAcces
> sorImpl.java:39)
> > > at
> > >
> >
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(De legatingConstruc
> torAccessorImpl.java:27)
> > > at java.lang.reflect.Constructor.newInstance(Constructor.java:2 74)
> > > at java.lang.Class.newInstance0(Class.java:306)
> > > at java.lang.Class.newInstance(Class.java:259)
> >
> > > thanks,
> > > Lilith
> >
> >
Re: Anyone out there??? [message #153553 is a reply to message #153551] Thu, 06 November 2003 15:35 Go to previous message
Eclipse UserFriend
Originally posted by: vgusev.graphlogic.com

How about the Eclipse class loader issue then? It is described in FAQ. One
has to set up classloader explicitely in some cases.
"Aljadiri" <lilith.al-jadiri@bmw-carit.de> wrote in message
news:bodp2l$7d2$1@eclipse.org...
> Yes I do!!!
>
> Lilith
>
> Vladimir wrote:
>
> > Is this jar in your plugin.xml file?
> > "Aljadiri" <lilith.al-jadiri@bmw-carit.de> wrote in message
> > news:bodo24$65d$1@eclipse.org...
> > > Aljadiri wrote:
> > >
> > > > Hi,
> > > > I am writing a certain plug-in where I have to invoke a method of a
> > MBean
> > > > running on a JMX server. I added the .jar(where the .class files are
in)
> > > > of that MBean as external jars to my project. There is no problem
with
> > > > compiling my code and invoking the method; however, I get an error
at
> > > > runtime back because the return type of the method invoked can't be
> > found
> > > > although the .class is in the jar file included. It would be great
if
> > > > anyone can help ASAP .Here is my code snippet followed by the error
> > > > message:
> > >
> > > > System.setSecurityManager(new RMISecurityManager());
> > > > Properties p = System.getProperties();
> > > > p.put(Context.INITIAL_CONTEXT_FACTORY,
> > > > "com.sun.jndi.rmi.registry.RegistryContextFactory");
> > > > p.put(Context.PROVIDER_URL, "rmi://localhost:1099");
> > > > JRMPConnector connector = new JRMPConnector();
> > > > String jndiName = "jrmp";
> > > > connector.connect(jndiName, p);
> > > > // Get the remote MBeanServer from the connector
> > > > // And use it as if it is an MBeanServer
> > > > RemoteMBeanServer remoteServer = connector.getRemoteMBeanServer();
> > > > ObjectName objName = new ObjectName("de.bmw.VCM:type=management");
> > >
> > > > try{
> > > > Object result =
> > > > remoteServer.invoke(objName,"getUnits",new Object[]{new
> > Integer(1)},new
> > > > String[]{"java.lang.Integer"});
> > >
> > > > }catch (javax.management.RuntimeMBeanException rme) {
> > > > if (rme.getTargetException() != null) {
> > > > rme.getTargetException().printStackTrace();
> > > > } else {
> > > > rme.printStackTrace();
> > > > }
> > > > }
> > >
> > > > the "result" return object is from type "de.bmw.ECU" , the .class of
> > that
> > > > class happens to be in the external jar included in the project.
Here is
> > > > the error stack:
> > >
> > > > ava.rmi.UnmarshalException: Exception while reading result; nested
> > > > exception is:
> > > > java.lang.ClassNotFoundException: de.bmw.vcm.ECU
> > > > at mx4j.adaptor.rmi.RMIAdaptor_Stub.invoke(Unknown Source)
> > > > at mx4j.connector.rmi.RMIConnector.invoke(RMIConnector.java:186 )
> > > > at
> > > >
> > >
> >
mx4j.connector.rmi.RMIConnector$RemoteMBeanServerImpl$Handle r.invoke(RMIConn
> > ector.java:548)
> > > > at $Proxy0.invoke(Unknown Source)
> > > > at
> > > >
> > >
> >
mx4j.connector.rmi.RMIConnector$RemoteMBeanServerImpl.invoke (RMIConnector.ja
> > va:411)
> > > > at de.bmw.example.views.TestgetMBean.<init>(TestgetMBean.java:77)
> > > > at de.bmw.example.views.DeviceView.<init>(DeviceView.java:79)
> > > > at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Nativ e
Method)
> > > > at
> > > >
> > >
> >
sun.reflect.NativeConstructorAccessorImpl.newInstance(Native ConstructorAcces
> > sorImpl.java:39)
> > > > at
> > > >
> > >
> >
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(De legatingConstruc
> > torAccessorImpl.java:27)
> > > > at java.lang.reflect.Constructor.newInstance(Constructor.java:2 74)
> > > > at java.lang.Class.newInstance0(Class.java:306)
> > > > at java.lang.Class.newInstance(Class.java:259)
> > >
> > > > thanks,
> > > > Lilith
> > >
> > >
>
>
Previous Topic:Eclipse Debug events and halt states
Next Topic:How to remove a version in cvs
Goto Forum:
  


Current Time: Thu Sep 26 22:53:12 GMT 2024

Powered by FUDForum. Page generated in 0.03458 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top