Login  Register

Re: binding RMIDispatcher to client

Posted by Brett on Aug 05, 2006; 1:10am
URL: http://ofbiz.116.s1.nabble.com/binnding-RMIDispatcher-to-client-tp140489p140502.html

That would be nice to include an eclipse project to do this.  One
problem with item 2 is if you depend on the build/lib/*.jar files
these will be continually deleted by Ant.  This will give you errors
in eclipse.  And in some cases you want be able to run an Ant clean
while eclipse is loaded since it will have a handle on those libraries
and the ant clean target will ffail.

To do it right, you probably need to copy the build libraries into an
independent directory specfically for RMI client stuff (and then be
aware of dependencies when the code changes).


Brett

On 8/4/06, Daniel Kunkel <[hidden email]> wrote:

> Hi
>
> I wonder if we can, and if we should do step 2 at a project level to
> avoid this problem in the future...
>
>
>
>
> On Fri, 2006-08-04 at 17:24 -0600, Brett Palmer wrote:
> > John,
> >
> > Yes this is a problem with trying to run the RMI client in the Eclipse
> > debugger.  I believe the problem occurs because ofbiz is compiled
> > using Ant and is not being compiled by Eclipse.  Then when you run the
> > RMI client within eclipse you get an incompatibility because the RMI
> > client is using all  the ofibz code that is in eclipse.  Does this
> > make any sense?  Running Ant within eclipse won't help either because
> > I believe the is still compiling outside of eclipse.
> >
> > There are a couple ways to work around this problem.  The first one is
> > the easiest and the second is more tedious.
> >
> >
> > 1. Create a simple script that executes the RMI client application.  I
> > am assuming that you are really trying to debug an ofbiz service and
> > not the RMI client itself.  Then with Eclipse create a remote debug
> > session with the server and set your break points in the server code
> > you want to debug.  When the RMI client request hits the server the
> > debugger will stop at your break point.
> >
> > Your script will need to include all the necessary Jar files to work.
> > I will include a sample at the bottom of this E-mail.  You usually
> > have to tweak the classpaths a little but once everything is working
> > you can easily debug server side code using RMI.
> >
> > 2. Another approach would be to create an eclipse project that
> > contained all the ofbiz built Jar files that were necessary for RMI
> > communication.  Then server libraries would match with the client
> > libraries.
> >
> > Does anyone else have an easier solution?
> >
> >
> > Brett
> >
> > /******************** Sample batch file for executing an RMI Client
> > ***********************/
> >
> >
> > set OFBIZ_HOME=../../../../ofbiz
> >
> > set OFBIZ_BASE=%OFBIZ_HOME%/framework/base
> > set OFBIZ_FRAMEWORK=%OFBIZ_HOME%/framework
> > set OFBIZ_APPLICATIONS=%OFBIZ_HOME%/applications
> > set LOCAL_LIB=../../build/lib
> >
> >
> > set OFBIZ_CP=%OFBIZ_BASE%/lib/junit.jar
> >
> > set OFBIZ_CP=%OFBIZ_CP%;%OFBIZ_BASE%/build/lib/ofbiz-base.jar
> > set OFBIZ_CP=%OFBIZ_CP%;%OFBIZ_BASE%/build/lib/ofbiz.jar
> > set OFBIZ_CP=%OFBIZ_CP%;%OFBIZ_BASE%/lib/freemarker.jar
> > set OFBIZ_CP=%OFBIZ_CP%;%OFBIZ_BASE%/lib/xml-apis.jar
> > set OFBIZ_CP=%OFBIZ_CP%;%OFBIZ_BASE%/lib/xerces.jar
> > set OFBIZ_CP=%OFBIZ_CP%;%OFBIZ_BASE%/lib/xercesImpl.jar
> > set OFBIZ_CP=%OFBIZ_CP%;%OFBIZ_BASE%/lib/servlet.jar
> > set OFBIZ_CP=%OFBIZ_CP%;%OFBIZ_BASE%/lib/activate.jar
> > set OFBIZ_CP=%OFBIZ_CP%;%OFBIZ_BASE%/lib/log4j.jar
> > set OFBIZ_CP=%OFBIZ_CP%;%OFBIZ_BASE%/lib/jdbm.jar
> > set OFBIZ_CP=%OFBIZ_CP%;%OFBIZ_BASE%/lib/javolution.jar
> >
> > set OFBIZ_CP=%OFBIZ_CP%;%OFBIZ_BASE%/lib/avalon-util-exception-1.0.0.jar
> > set OFBIZ_CP=%OFBIZ_CP%;%OFBIZ_BASE%/lib/commons/commons-logging.jar
> > set OFBIZ_CP=%OFBIZ_CP%;%OFBIZ_BASE%/lib/commons/commons-collections.jar
> > set OFBIZ_CP=%OFBIZ_CP%;%OFBIZ_BASE%/lib/scripting/bsh.jar
> > set OFBIZ_CP=%OFBIZ_CP%;%OFBIZ_BASE%/lib/scripting/bsf.jar
> > set OFBIZ_CP=%OFBIZ_CP%;%OFBIZ_BASE%/lib/scripting/js.jar
> > set OFBIZ_CP=%OFBIZ_CP%;%OFBIZ_BASE%/lib/scripting/oro.jar
> >
> > set OFBIZ_CP=%OFBIZ_CP%;%OFBIZ_BASE%/config
> >
> > set OFBIZ_CP=%OFBIZ_CP%;%OFBIZ_FRAMEWORK%/entity/dtd
> > set OFBIZ_CP=%OFBIZ_CP%;%OFBIZ_FRAMEWORK%/entity/config
> > set OFBIZ_CP=%OFBIZ_CP%;%OFBIZ_FRAMEWORK%/entity/build/lib/ofbiz-entity.jar
> > set OFBIZ_CP=%OFBIZ_CP%;%OFBIZ_FRAMEWORK%/entityext/build/lib/ofbiz-entityext.jar
> > set OFBIZ_CP=%OFBIZ_CP%;%OFBIZ_FRAMEWORK%/entityext/dtd
> > set OFBIZ_CP=%OFBIZ_CP%;%OFBIZ_FRAMEWORK%/entity/lib/jdbc/mm.mysql-2.0.14-bin.jar
> > set OFBIZ_CP=%OFBIZ_CP%;%OFBIZ_FRAMEWORK%/entity/lib/jdbc/postgresql.jar
> > set OFBIZ_CP=%OFBIZ_CP%;%OFBIZ_FRAMEWORK%/entity/lib/jotm/jotm.jar
> > set OFBIZ_CP=%OFBIZ_CP%;%OFBIZ_FRAMEWORK%/entity/lib/jotm/jotm_iiop_stubs.jar
> > set OFBIZ_CP=%OFBIZ_CP%;%OFBIZ_FRAMEWORK%/entity/lib/jotm/jotm_jrmp_stubs.jar
> > set OFBIZ_CP=%OFBIZ_CP%;%OFBIZ_FRAMEWORK%/entity/lib/dbcp/commons-pool.jar
> > set OFBIZ_CP=%OFBIZ_CP%;%OFBIZ_FRAMEWORK%/entity/lib/dbcp/commons-dbcp.jar
> > set OFBIZ_CP=%OFBIZ_CP%;%OFBIZ_FRAMEWORK%/content/build/lib/ofbiz-content.jar
> > set OFBIZ_CP=%OFBIZ_CP%;%OFBIZ_FRAMEWORK%/lib/common/classes12.zip
> > set OFBIZ_CP=%OFBIZ_CP%;%OFBIZ_FRAMEWORK%/minerva/lib/jta_1.0.1.jar
> > set OFBIZ_CP=%OFBIZ_CP%;%OFBIZ_FRAMEWORK%/minerva/lib/oswego-concurrent.jar
> > set OFBIZ_CP=%OFBIZ_CP%;%OFBIZ_FRAMEWORK%/minerva/build/lib/ofbiz-minerva.jar
> > set OFBIZ_CP=%OFBIZ_CP%;%OFBIZ_FRAMEWORK%/service/build/lib/ofbiz-service.jar
> > set OFBIZ_CP=%OFBIZ_CP%;%OFBIZ_FRAMEWORK%/service/build/lib/ofbiz-service-rmi.raj
> > set OFBIZ_CP=%OFBIZ_CP%;%OFBIZ_FRAMEWORK%/service/lib/wsdl4j.jar
> > set OFBIZ_CP=%OFBIZ_CP%;%OFBIZ_FRAMEWORK%/service/config
> >
> > set OFBIZ_CP=%OFBIZ_CP%;%OFBIZ_FRAMEWORK%/security/build/lib/ofbiz-security.jar
> > set OFBIZ_CP=%OFBIZ_CP%;%OFBIZ_FRAMEWORK%/security/config
> > set OFBIZ_CP=%OFBIZ_CP%;%OFBIZ_FRAMEWORK%/securityext/build/lib/ofbiz-securityext.jar
> >
> > set OFBIZ_CP=%OFBIZ_CP%;%OFBIZ_APPLICATIONS%/order/build/lib/ofbiz-order.jar
> >
> > set OFBIZ_CP=%OFBIZ_CP%;%LOCAL_LIB%/ofbiz-erp.jar
> > set OFBIZ_CP=%OFBIZ_CP%;%LOCAL_LIB%/ofbiz-erp.jar
> >
> >
> > set CP=%OFBIZ_CP%
> > rem echo CLASSPATH=%CP%
> > rem echo OFBIZ_HOME=%OFBIZ_HOME%
> >
> >
> > java -Dofbiz.home=%OFBIZ_HOME% -cp %CP% <Your RMI Client Program>
> >
> >
> >
> >
> > On 8/4/06, John Martin <[hidden email]> wrote:
> > > HELP!
> > >
> > > I've been running into the same problem as what was reported in this thread
> > > before.  When attempting to run a RMI client I get the exception:
> > >
> > > org.ofbiz.service.rmi.socket.ssl.SSLClientSocketFactory; local class
> > > incompatible: stream classdesc serialVersionUID = -6771263703492769955, local
> > > class serialVersionUID = 2417260480409974286
> > >         at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
> > >
> > > Hopefully this has been resolved by someone?
> > >
> > > Thanks!
> > >
> > > John
> > >
> > > Here's my steps:
> > >
> > > 1. clean build of the application server: ant build (command line)
> > >
> > >    codebase: ofbiz_opentaps_424208
> > >    WindowsXP
> > >    java 1.4.2
> > >    Eclipse 3.1
> > >
> > >
> > > 2. Copied the following jars into my classpath:
> > >    ofbiz-base.jar
> > >    ofbiz-entity.jar   <--- There were some dependencies found in this jar
> > >    ofbiz-service-rmi.jar
> > >    commons-collections.jar
> > >    javolution.jar
> > >    jdbm.jar
> > >    log4j.jar
> > >
> > >    NOTE:  I had to add a line to the ofbiz-service-rmi.jar (rmi-jar) build.xml
> > > script because there were a bunch of references into the org.ofbiz.service
> > > directories not getting pulled in.
> > >
> > >     <fileset dir="${build.dir}/classes" includes="org/ofbiz/service/**"/>
> > >
> > > 3. start application startofbiz.bat
> > >
> > > 4. In Eclipse, run the RMI Client Example.
> > >
> > > When I attempt to execute this line:
> > >
> > >     rd = (RemoteDispatcher) Naming.lookup(RMI_URL);
> > >
> > > I get the following exception:
> > >
> > > java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
> > >         java.io.InvalidClassException:
> > > org.ofbiz.service.rmi.socket.ssl.SSLClientSocketFactory; local class
> > > incompatible: stream classdesc serialVersionUID = -6771263703492769955, local
> > > class serialVersionUID = 2417260480409974286
> > >         at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
> > >         at java.rmi.Naming.lookup(Unknown Source)
> > >         at org.ofbiz.service.rmi.ExampleRemoteClient.<init>(ExampleRemoteClient.java:55)
> > >         at org.ofbiz.service.rmi.ExampleRemoteClient.main(ExampleRemoteClient.java:76)
> > > Caused by: java.io.InvalidClassException:
> > > org.ofbiz.service.rmi.socket.ssl.SSLClientSocketFactory; local class
> > > incompatible: stream classdesc serialVersionUID = -6771263703492769955, local
> > > class serialVersionUID = 2417260480409974286
> > >         at java.io.ObjectStreamClass.initNonProxy(Unknown Source)
> > >         at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
> > >         at java.io.ObjectInputStream.readClassDesc(Unknown Source)
> > >         at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
> > >         at java.io.ObjectInputStream.readObject0(Unknown Source)
> > >         at java.io.ObjectInputStream.readObject(Unknown Source)
> > >         at sun.rmi.transport.tcp.TCPEndpoint.read(Unknown Source)
> > >         at sun.rmi.transport.LiveRef.read(Unknown Source)
> > >         at sun.rmi.server.UnicastRef2.readExternal(Unknown Source)
> > >         at java.rmi.server.RemoteObject.readObject(Unknown Source)
> > >         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > >         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> > >         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> > >         at java.lang.reflect.Method.invoke(Unknown Source)
> > >         at java.io.ObjectStreamClass.invokeReadObject(Unknown Source)
> > >         at java.io.ObjectInputStream.readSerialData(Unknown Source)
> > >         at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
> > >         at java.io.ObjectInputStream.readObject0(Unknown Source)
> > >         at java.io.ObjectInputStream.readObject(Unknown Source)
> > >         ... 4 more
> > >
> > >
>
>