Issue with Service Invoked though RMIDispatcher

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Issue with Service Invoked though RMIDispatcher

Deepa Priolkar
Hi,

 

I am trying to call a service through RMI, but I am getting some weird
exception.. it says ClassNtFound, for the class which is there in the
classpath.. Please help.. need some inputs asap L

 

2010-10-25 17:24:57,652 (RMI TCP Connection(4)-10.5.73.90) [
ServiceDispatcher.java:506:ERROR]

---- exception report
----------------------------------------------------------

Service [updateScanResultTest] threw an unexpected exception/error

Exception: org.ofbiz.service.GenericServiceException

Message: Cannot find service [updateScanResultTest] location class
(com.pci.services.ASVEngineService )

---- cause
---------------------------------------------------------------------

Exception: java.lang.ClassNotFoundException

Message: com.pci.services.ASVEngineService

---- stack trace
---------------------------------------------------------------

java.lang.ClassNotFoundException: com.pci.services.ASVEngineService

java.net.URLClassLoader$1.run(URLClassLoader.java:200)

java.security.AccessController.doPrivileged(Native Method)

java.net.URLClassLoader.findClass(URLClassLoader.java:188)

 

Following are the configurations

 

Services.xml

<service name="updateScanResultTest" export="true" auth="false"
engine="java"

            location="com.pci.services.ASVEngineService "
invoke="updateScanResult">

        <description>add the scan details to the database</description>

        <attribute name="scanResult" type="String" mode="IN"
optional="false"/>

       <attribute name=" response" type="String" mode="OUT"
optional="true"/>

</service>

 

Ofbiz-container.xml

    <!-- RMI Service Dispatcher -->

    <container name="rmi-dispatcher"
class="org.ofbiz.service.rmi.RmiServiceContainer">

        <property name="bound-name" value="RMIDispatcher"/>

        <property name="bound-host" value="127.0.0.1"/>

        <property name="bound-port" value="1099"/>

        <property name="delegator-name" value="default"/>

        <property name="client-factory"
value="org.ofbiz.service.rmi.socket.zip.CompressionClientSocketFactory"/
>

        <property name="server-factory"
value="org.ofbiz.service.rmi.socket.zip.CompressionServerSocketFactory"/
>

        <!-- property name="ssl-keystore"
value="framework/base/config/ofbizrmi.jks"/>

        <property name="ssl-keystore-type" value="JKS"/>

        <property name="ssl-keystore-pass" value="changeit"/>

        <property name="ssl-keystore-alias" value="rmissl"/-->

        <property name="ssl-client-auth" value="false"/>

    </container>

 

 

Calling Client

 

package com.pci.test;

 

import java.net.MalformedURLException;

import java.rmi.Naming;

import java.rmi.NotBoundException;

import java.rmi.RemoteException;

import java.util.Map;

 

import org.ofbiz.base.util.UtilMisc;

import org.ofbiz.service.GenericServiceException;

import org.ofbiz.service.rmi.RemoteDispatcher;

 

public class CallingOfbizService

{

      public static void main(String str[])

      {

            String endpoint;

            try{

                  endpoint = "rmi://127.0.0.1:1099/RMIDispatcher";

                  RemoteDispatcher remoteDisp = (RemoteDispatcher)
Naming.lookup(endpoint);

                  Map result =
remoteDisp.runSync("updateScanResultTest", UtilMisc.toMap("scanResult",
"Hello"));

            }catch (MalformedURLException e2) {

                  e2.printStackTrace();

            } catch (RemoteException e3) {

                  e3.printStackTrace();

            } catch (NotBoundException e) {

                  e.printStackTrace();

            } catch (GenericServiceException e) {

                  e.printStackTrace();

            }

      }

}

 

 


============================================================================================================================Disclaimer:  This message and the information contained herein is proprietary and confidential and subject to the Tech Mahindra policy statement, you may review the policy at <a href="http://www.techmahindra.com/Disclaimer.html">http://www.techmahindra.com/Disclaimer.html</a> externally and <a href="http://tim.techmahindra.com/Disclaimer.html">http://tim.techmahindra.com/Disclaimer.html</a> internally within Tech Mahindra.============================================================================================================================
Reply | Threaded
Open this post in threaded view
|

RE: Issue with Service Invoked though RMIDispatcher

Deepa Priolkar
Resolved the issue related to the ClassNotFoundException...

 

From: Deepa Priolkar
Sent: Monday, October 25, 2010 5:46 PM
To: [hidden email]
Subject: Issue with Service Invoked though RMIDispatcher

 

Hi,

 

I am trying to call a service through RMI, but I am getting some weird
exception.. it says ClassNtFound, for the class which is there in the
classpath.. Please help.. need some inputs asap L

 

2010-10-25 17:24:57,652 (RMI TCP Connection(4)-10.5.73.90) [
ServiceDispatcher.java:506:ERROR]

---- exception report
----------------------------------------------------------

Service [updateScanResultTest] threw an unexpected exception/error

Exception: org.ofbiz.service.GenericServiceException

Message: Cannot find service [updateScanResultTest] location class
(com.pci.services.ASVEngineService )

---- cause
---------------------------------------------------------------------

Exception: java.lang.ClassNotFoundException

Message: com.pci.services.ASVEngineService

---- stack trace
---------------------------------------------------------------

java.lang.ClassNotFoundException: com.pci.services.ASVEngineService

java.net.URLClassLoader$1.run(URLClassLoader.java:200)

java.security.AccessController.doPrivileged(Native Method)

java.net.URLClassLoader.findClass(URLClassLoader.java:188)

 

Following are the configurations

 

Services.xml

<service name="updateScanResultTest" export="true" auth="false"
engine="java"

            location="com.pci.services.ASVEngineService "
invoke="updateScanResult">

        <description>add the scan details to the database</description>

        <attribute name="scanResult" type="String" mode="IN"
optional="false"/>

       <attribute name=" response" type="String" mode="OUT"
optional="true"/>

</service>

 

Ofbiz-container.xml

    <!-- RMI Service Dispatcher -->

    <container name="rmi-dispatcher"
class="org.ofbiz.service.rmi.RmiServiceContainer">

        <property name="bound-name" value="RMIDispatcher"/>

        <property name="bound-host" value="127.0.0.1"/>

        <property name="bound-port" value="1099"/>

        <property name="delegator-name" value="default"/>

        <property name="client-factory"
value="org.ofbiz.service.rmi.socket.zip.CompressionClientSocketFactory"/
>

        <property name="server-factory"
value="org.ofbiz.service.rmi.socket.zip.CompressionServerSocketFactory"/
>

        <!-- property name="ssl-keystore"
value="framework/base/config/ofbizrmi.jks"/>

        <property name="ssl-keystore-type" value="JKS"/>

        <property name="ssl-keystore-pass" value="changeit"/>

        <property name="ssl-keystore-alias" value="rmissl"/-->

        <property name="ssl-client-auth" value="false"/>

    </container>

 

 

Calling Client

 

package com.pci.test;

 

import java.net.MalformedURLException;

import java.rmi.Naming;

import java.rmi.NotBoundException;

import java.rmi.RemoteException;

import java.util.Map;

 

import org.ofbiz.base.util.UtilMisc;

import org.ofbiz.service.GenericServiceException;

import org.ofbiz.service.rmi.RemoteDispatcher;

 

public class CallingOfbizService

{

      public static void main(String str[])

      {

            String endpoint;

            try{

                  endpoint = "rmi://127.0.0.1:1099/RMIDispatcher";

                  RemoteDispatcher remoteDisp = (RemoteDispatcher)
Naming.lookup(endpoint);

                  Map result =
remoteDisp.runSync("updateScanResultTest", UtilMisc.toMap("scanResult",
"Hello"));

            }catch (MalformedURLException e2) {

                  e2.printStackTrace();

            } catch (RemoteException e3) {

                  e3.printStackTrace();

            } catch (NotBoundException e) {

                  e.printStackTrace();

            } catch (GenericServiceException e) {

                  e.printStackTrace();

            }

      }

}

 

 


============================================================================================================================Disclaimer:  This message and the information contained herein is proprietary and confidential and subject to the Tech Mahindra policy statement, you may review the policy at <a href="http://www.techmahindra.com/Disclaimer.html">http://www.techmahindra.com/Disclaimer.html</a> externally and <a href="http://tim.techmahindra.com/Disclaimer.html">http://tim.techmahindra.com/Disclaimer.html</a> internally within Tech Mahindra.============================================================================================================================
Reply | Threaded
Open this post in threaded view
|

Issue with Service Invoked though RMIDispatcher

Deepa Priolkar
Hi,

 

I am trying to call a service through RMI,  I am getting exception
related to marshaling,

 

java.rmi.UnmarshalException: Error unmarshaling return; nested exception
is:

      java.io.WriteAbortedException: writing aborted;
java.io.NotSerializableException: org.ofbiz.service.ModelNotification

      at
sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:217
)

      at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:126)

      at
java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteO
bjectInvocationHandler.java:179)

      at
java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocat
ionHandler.java:132)

      at $Proxy0.runSync(Unknown Source)

      at
com.pci.test.CallingOfbizService.main(CallingOfbizService.java:21)

Caused by: java.io.WriteAbortedException: writing aborted;
java.io.NotSerializableException: org.ofbiz.service.ModelNotification

      at
java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1303)

      at
java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)

      at javolution.util.FastList.readObject(Unknown Source)

      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)

      at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)

      at java.lang.reflect.Method.invoke(Method.java:585)

      at
java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:919)

      at
java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1813)

      at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1713
)

      at
java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)

      at
java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1912)

      at
java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1836)

      at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1713
)

      at
java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)

      at
java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1912)

      at
java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1836)

      at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1713
)

      at
java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)

      at
java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)

      at
sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:215
)

      ... 5 more

Caused by: java.io.NotSerializableException:
org.ofbiz.service.ModelNotification

      at
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1075)

      at
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:291)

      at javolution.util.FastList.writeObject(Unknown Source)

      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)

      at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)

      at java.lang.reflect.Method.invoke(Method.java:585)

      at
java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:890)

      at
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1333)

      at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1
284)

      at
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1073)

      at
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:13
69)

      at
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1341)

      at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1
284)

      at
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1073)

      at
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:13
69)

      at
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1341)

      at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1
284)

      at
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1073)

      at
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:291)

      at
sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:332)

      at sun.rmi.transport.Transport$1.run(Transport.java:153)

      at java.security.AccessController.doPrivileged(Native Method)

      at sun.rmi.transport.Transport.serviceCall(Transport.java:149)

      at
sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)

      at
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.ja
va:701)

      at java.lang.Thread.run(Thread.java:595)

 

 

Following are the configurations

Services.xml

<service name="updateScanResultTest" export="true" auth="false"
engine="java"

            location="com.pci.services.ASVEngineService "
invoke="updateScanResult">

        <description>add the scan details to the database</description>

        <attribute name="scanResult" type="String" mode="IN"
optional="false"/>

       <attribute name=" response" type="String" mode="OUT"
optional="true"/>

</service>

 

Ofbiz-container.xml

    <!-- RMI Service Dispatcher -->

    <container name="rmi-dispatcher"
class="org.ofbiz.service.rmi.RmiServiceContainer">

        <property name="bound-name" value="RMIDispatcher"/>

        <property name="bound-host" value="127.0.0.1"/>

        <property name="bound-port" value="1099"/>

        <property name="delegator-name" value="default"/>

        <property name="client-factory"
value="org.ofbiz.service.rmi.socket.zip.CompressionClientSocketFactory"/
>

        <property name="server-factory"
value="org.ofbiz.service.rmi.socket.zip.CompressionServerSocketFactory"/
>

        <!-- property name="ssl-keystore"
value="framework/base/config/ofbizrmi.jks"/>

        <property name="ssl-keystore-type" value="JKS"/>

        <property name="ssl-keystore-pass" value="changeit"/>

        <property name="ssl-keystore-alias" value="rmissl"/-->

        <property name="ssl-client-auth" value="false"/>

    </container>

 

 

Calling Client

 

package com.pci.test;

 

import java.net.MalformedURLException;

import java.rmi.Naming;

import java.rmi.NotBoundException;

import java.rmi.RemoteException;

import java.util.Map;

 

import org.ofbiz.base.util.UtilMisc;

import org.ofbiz.service.GenericServiceException;

import org.ofbiz.service.rmi.RemoteDispatcher;

 

public class CallingOfbizService

{

      public static void main(String str[])

      {

            String endpoint;

            try{

                  endpoint = "rmi://127.0.0.1:1099/RMIDispatcher";

                  RemoteDispatcher remoteDisp = (RemoteDispatcher)
Naming.lookup(endpoint);

                  Map result =
remoteDisp.runSync("updateScanResultTest", UtilMisc.toMap("scanResult",
"Hello"));

            }catch (MalformedURLException e2) {

                  e2.printStackTrace();

            } catch (RemoteException e3) {

                  e3.printStackTrace();

            } catch (NotBoundException e) {

                  e.printStackTrace();

            } catch (GenericServiceException e) {

                  e.printStackTrace();

            }

      }

}

 

 


============================================================================================================================Disclaimer:  This message and the information contained herein is proprietary and confidential and subject to the Tech Mahindra policy statement, you may review the policy at <a href="http://www.techmahindra.com/Disclaimer.html">http://www.techmahindra.com/Disclaimer.html</a> externally and <a href="http://tim.techmahindra.com/Disclaimer.html">http://tim.techmahindra.com/Disclaimer.html</a> internally within Tech Mahindra.============================================================================================================================