About OFBiz and RMI

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

About OFBiz and RMI

Cimballi
Hi,

I'm trying to use OFBiz and RMI. I configured it using the SUN RMI
implementation to not have to deal with certificates stuff.

My connection is working but I have a problem when I retrieve data.
I'm using the performFindList method, and the problem is, when I iterate
over the returned objects and I call a getXxx method, I have this stack
trace :
java.lang.IllegalStateException: [GenericEntity.getDelegator] could not find
delegator with name default
...

The thing that looks strange to me is that, as returned entities are of type
GenericEntity, it needs all the framework environment to use them.
If there something I do wrong in my RMI call, or is there a way to get
simple beans as return entities, to not have to deal with the framework
stuff ?

For the same reason I have to embed ofbiz-base.jar, ofbiz-entity.jar and
ofbiz-service.jar in my client.

Thanks,

Cimballi
Reply | Threaded
Open this post in threaded view
|

Re: About OFBiz and RMI

Brett
This is one of the problems of using RMI.  Complex objects such as
GenericValues are available but entity methods on that object won't
work as they require the entity engine.

A workaround is to define facade services that return simple pojos.
Then rmi works pretty well.


Brett

On 3/28/09, Cimballi <[hidden email]> wrote:

> Hi,
>
> I'm trying to use OFBiz and RMI. I configured it using the SUN RMI
> implementation to not have to deal with certificates stuff.
>
> My connection is working but I have a problem when I retrieve data.
> I'm using the performFindList method, and the problem is, when I iterate
> over the returned objects and I call a getXxx method, I have this stack
> trace :
> java.lang.IllegalStateException: [GenericEntity.getDelegator] could not find
> delegator with name default
> ...
>
> The thing that looks strange to me is that, as returned entities are of type
> GenericEntity, it needs all the framework environment to use them.
> If there something I do wrong in my RMI call, or is there a way to get
> simple beans as return entities, to not have to deal with the framework
> stuff ?
>
> For the same reason I have to embed ofbiz-base.jar, ofbiz-entity.jar and
> ofbiz-service.jar in my client.
>
> Thanks,
>
> Cimballi
>

--
Sent from my mobile device
Reply | Threaded
Open this post in threaded view
|

Re: About OFBiz and RMI

Shi Jinghai
In reply to this post by Cimballi
The error message said you're trying to use default delegator. Obviously
you're trying to use a server side method which needs a delegator to
access OFBiz database.

You should write your own client side methods to request OFBiz through
RMI. And you should also extend the server side services to response the
request.

Please reference our implements:
http://www.langhua.cn/viewvc/svn/ofbiz-components/OFBiz-RMIClient/
http://www.langhua.cn/viewvc/svn/ofbiz-components/OFBiz-RMIService/

Good luck,

Shi Jinghai/Beijing Langhua Ltd.

在 2009-03-28六的 10:58 -0500,Cimballi写道:

> Hi,
>
> I'm trying to use OFBiz and RMI. I configured it using the SUN RMI
> implementation to not have to deal with certificates stuff.
>
> My connection is working but I have a problem when I retrieve data.
> I'm using the performFindList method, and the problem is, when I iterate
> over the returned objects and I call a getXxx method, I have this stack
> trace :
> java.lang.IllegalStateException: [GenericEntity.getDelegator] could not find
> delegator with name default
> ...
>
> The thing that looks strange to me is that, as returned entities are of type
> GenericEntity, it needs all the framework environment to use them.
> If there something I do wrong in my RMI call, or is there a way to get
> simple beans as return entities, to not have to deal with the framework
> stuff ?
>
> For the same reason I have to embed ofbiz-base.jar, ofbiz-entity.jar and
> ofbiz-service.jar in my client.
>
> Thanks,
>
> Cimballi

Reply | Threaded
Open this post in threaded view
|

Re: About OFBiz and RMI

David E Jones-3
In reply to this post by Cimballi

For an easier solution try letting the Service Engine take care of it  
all. For details see the ExampleRemoteService.java file, which has  
comments about which libraries you need from OFBiz, and then you can  
call the OFBiz services remotely and communicate pretty easily that way.

Anyway, that's the way remote communication with other Java programs  
that know about OFBiz is meant to be done.

-David


On Mar 28, 2009, at 9:58 AM, Cimballi wrote:

> Hi,
>
> I'm trying to use OFBiz and RMI. I configured it using the SUN RMI
> implementation to not have to deal with certificates stuff.
>
> My connection is working but I have a problem when I retrieve data.
> I'm using the performFindList method, and the problem is, when I  
> iterate
> over the returned objects and I call a getXxx method, I have this  
> stack
> trace :
> java.lang.IllegalStateException: [GenericEntity.getDelegator] could  
> not find
> delegator with name default
> ...
>
> The thing that looks strange to me is that, as returned entities are  
> of type
> GenericEntity, it needs all the framework environment to use them.
> If there something I do wrong in my RMI call, or is there a way to get
> simple beans as return entities, to not have to deal with the  
> framework
> stuff ?
>
> For the same reason I have to embed ofbiz-base.jar, ofbiz-entity.jar  
> and
> ofbiz-service.jar in my client.
>
> Thanks,
>
> Cimballi

Reply | Threaded
Open this post in threaded view
|

Re: About OFBiz and RMI

Cimballi-2
Hi guys,

Thanks for your answers. I make a "batch" one.

Brett : You confirmed me what I was thinking.

Shi : Thanks for the links, I will have a look to that code.

David : Do you talk about the ExampleRemoteClient.java file ? I used it to
develop my own test and then I met the problem I talked about. The RMI calls
are working well, the problem is when you want to access to the properties
of the returned objects.

If I write some code that can be easily reused, I will send it to the list.

Cimballi


On Sat, Mar 28, 2009 at 4:50 PM, David E Jones
<[hidden email]>wrote:

>
> For an easier solution try letting the Service Engine take care of it all.
> For details see the ExampleRemoteService.java file, which has comments about
> which libraries you need from OFBiz, and then you can call the OFBiz
> services remotely and communicate pretty easily that way.
>
> Anyway, that's the way remote communication with other Java programs that
> know about OFBiz is meant to be done.
>
> -David
>
>
>
> On Mar 28, 2009, at 9:58 AM, Cimballi wrote:
>
>  Hi,
>>
>> I'm trying to use OFBiz and RMI. I configured it using the SUN RMI
>> implementation to not have to deal with certificates stuff.
>>
>> My connection is working but I have a problem when I retrieve data.
>> I'm using the performFindList method, and the problem is, when I iterate
>> over the returned objects and I call a getXxx method, I have this stack
>> trace :
>> java.lang.IllegalStateException: [GenericEntity.getDelegator] could not
>> find
>> delegator with name default
>> ...
>>
>> The thing that looks strange to me is that, as returned entities are of
>> type
>> GenericEntity, it needs all the framework environment to use them.
>> If there something I do wrong in my RMI call, or is there a way to get
>> simple beans as return entities, to not have to deal with the framework
>> stuff ?
>>
>> For the same reason I have to embed ofbiz-base.jar, ofbiz-entity.jar and
>> ofbiz-service.jar in my client.
>>
>> Thanks,
>>
>> Cimballi
>>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: About OFBiz and RMI

Cimballi-2
Hi,

Continuing my tests with RMI, I wrote a simple façade service class that
receives my RMI calls and then calls a standard OFBiz service. For now it
only returns an empty Map.

I am now facing a performance problem : a single call to the my new service
which then calls the performFindList method on Party objects, but returning
an empty Map to the client, took 8 seconds to run.

As I said in my previous email, I am using the
CompressionClientSocketFactory.

If I change the code to the the default JDK implementation (jdk1.5.0_15) :
public RemoteDispatcherImpl(LocalDispatcher dispatcher,
RMIClientSocketFactory csf, RMIServerSocketFactory ssf) throws
RemoteException {
        // super(0, csf, ssf);
        super();
        this.dispatcher = dispatcher;
    }

Then, the performance are really good, the call is made in 30 ms ! So, I
have several questions :

Do you know about any performance problem with the
CompressionClientSocketFactory implementation ?
Do you know about any performance issue with the SSL implementation provided
in OFBiz ?
And can you make an update to the code so that we can use the default JDK
implementation without having to change the code ?

Thanks,

Cimballi
Reply | Threaded
Open this post in threaded view
|

Re: About OFBiz and RMI

BJ Freeman
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

As far as changing, This is a community project
So you can share your changes by submitting a patch through the Jira system.
http://docs.ofbiz.org/display/OFBADMIN/OFBiz+Contributors+Best+Practices

Cimballi sent the following on 3/30/2009 11:01 AM:

> Hi,
>
> Continuing my tests with RMI, I wrote a simple façade service class that
> receives my RMI calls and then calls a standard OFBiz service. For now it
> only returns an empty Map.
>
> I am now facing a performance problem : a single call to the my new service
> which then calls the performFindList method on Party objects, but returning
> an empty Map to the client, took 8 seconds to run.
>
> As I said in my previous email, I am using the
> CompressionClientSocketFactory.
>
> If I change the code to the the default JDK implementation (jdk1.5.0_15) :
> public RemoteDispatcherImpl(LocalDispatcher dispatcher,
> RMIClientSocketFactory csf, RMIServerSocketFactory ssf) throws
> RemoteException {
>         // super(0, csf, ssf);
>         super();
>         this.dispatcher = dispatcher;
>     }
>
> Then, the performance are really good, the call is made in 30 ms ! So, I
> have several questions :
>
> Do you know about any performance problem with the
> CompressionClientSocketFactory implementation ?
> Do you know about any performance issue with the SSL implementation provided
> in OFBiz ?
> And can you make an update to the code so that we can use the default JDK
> implementation without having to change the code ?
>
> Thanks,
>
> Cimballi
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJ0Q4wrP3NbaWWqE4RAuLeAJ0SnpTGr4J0+1+y5uDcVCTibbMdSwCgr7/F
qpy8c1CkypNWC981SURIo2w=
=Bp+u
-----END PGP SIGNATURE-----
Reply | Threaded
Open this post in threaded view
|

Re: About OFBiz and RMI

Jacques Le Roux
Administrator
In reply to this post by Shi Jinghai
From: "Shi Jinghai" <[hidden email]>

> The error message said you're trying to use default delegator. Obviously
> you're trying to use a server side method which needs a delegator to
> access OFBiz database.
>
> You should write your own client side methods to request OFBiz through
> RMI. And you should also extend the server side services to response the
> request.
>
> Please reference our implements:
> http://www.langhua.cn/viewvc/svn/ofbiz-components/OFBiz-RMIClient/
> http://www.langhua.cn/viewvc/svn/ofbiz-components/OFBiz-RMIService/

I was to look at it, but why is the manual directory closed ?

Jacques

> Good luck,
>
> Shi Jinghai/Beijing Langhua Ltd.
>
> 在 2009-03-28六的 10:58 -0500,Cimballi写道:
>> Hi,
>>
>> I'm trying to use OFBiz and RMI. I configured it using the SUN RMI
>> implementation to not have to deal with certificates stuff.
>>
>> My connection is working but I have a problem when I retrieve data.
>> I'm using the performFindList method, and the problem is, when I iterate
>> over the returned objects and I call a getXxx method, I have this stack
>> trace :
>> java.lang.IllegalStateException: [GenericEntity.getDelegator] could not find
>> delegator with name default
>> ...
>>
>> The thing that looks strange to me is that, as returned entities are of type
>> GenericEntity, it needs all the framework environment to use them.
>> If there something I do wrong in my RMI call, or is there a way to get
>> simple beans as return entities, to not have to deal with the framework
>> stuff ?
>>
>> For the same reason I have to embed ofbiz-base.jar, ofbiz-entity.jar and
>> ofbiz-service.jar in my client.
>>
>> Thanks,
>>
>> Cimballi
>


Reply | Threaded
Open this post in threaded view
|

Re: About OFBiz and RMI

Shi Jinghai
> I was to look at it, but why is the manual directory closed ?
>
> Jacques
It's a simple training component for our new programmers.

Shi Jinghai/Beijing Langhua Ltd.

Reply | Threaded
Open this post in threaded view
|

Re: About OFBiz and RMI

Jacques Le Roux
Administrator
In reply to this post by Brett
Thanks Brett,

I put your advice at
http://docs.ofbiz.org/display/OFBIZ/FAQ+-+Tips+-+Tricks+-+Cookbook+-+HowTo#FAQ-Tips-Tricks-Cookbook-HowTo-SomethingsyoushouldknowaboutRMI

Jacques

From: "Brett Palmer" <[hidden email]>

> This is one of the problems of using RMI.  Complex objects such as
> GenericValues are available but entity methods on that object won't
> work as they require the entity engine.
>
> A workaround is to define facade services that return simple pojos.
> Then rmi works pretty well.
>
>
> Brett
>
> On 3/28/09, Cimballi <[hidden email]> wrote:
>> Hi,
>>
>> I'm trying to use OFBiz and RMI. I configured it using the SUN RMI
>> implementation to not have to deal with certificates stuff.
>>
>> My connection is working but I have a problem when I retrieve data.
>> I'm using the performFindList method, and the problem is, when I iterate
>> over the returned objects and I call a getXxx method, I have this stack
>> trace :
>> java.lang.IllegalStateException: [GenericEntity.getDelegator] could not find
>> delegator with name default
>> ...
>>
>> The thing that looks strange to me is that, as returned entities are of type
>> GenericEntity, it needs all the framework environment to use them.
>> If there something I do wrong in my RMI call, or is there a way to get
>> simple beans as return entities, to not have to deal with the framework
>> stuff ?
>>
>> For the same reason I have to embed ofbiz-base.jar, ofbiz-entity.jar and
>> ofbiz-service.jar in my client.
>>
>> Thanks,
>>
>> Cimballi
>>
>
> --
> Sent from my mobile device
>


Reply | Threaded
Open this post in threaded view
|

Re: About OFBiz and RMI

Cimballi
In reply to this post by Cimballi-2
In fact I was wrong, you can use the default RMISocketFactory from the JDK
without changing the code, you just have to comment the properties in the
"ofbiz-trunk/framework/base/config/ofbiz-containers.xml" file :

    <!-- 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.ssl.SSLClientSocketFactory"/>
        <property name="server-factory"
value="org.ofbiz.service.rmi.socket.ssl.SSLServerSocketFactory"/>
        <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>

Cimballi


2009/3/30 Cimballi <[hidden email]>

> Hi,
>
> Continuing my tests with RMI, I wrote a simple façade service class that
> receives my RMI calls and then calls a standard OFBiz service. For now it
> only returns an empty Map.
>
> I am now facing a performance problem : a single call to the my new service
> which then calls the performFindList method on Party objects, but returning
> an empty Map to the client, took 8 seconds to run.
>
> As I said in my previous email, I am using the
> CompressionClientSocketFactory.
>
> If I change the code to the the default JDK implementation (jdk1.5.0_15) :
> public RemoteDispatcherImpl(LocalDispatcher dispatcher,
> RMIClientSocketFactory csf, RMIServerSocketFactory ssf) throws
> RemoteException {
>         // super(0, csf, ssf);
>         super();
>         this.dispatcher = dispatcher;
>     }
>
> Then, the performance are really good, the call is made in 30 ms ! So, I
> have several questions :
>
> Do you know about any performance problem with the
> CompressionClientSocketFactory implementation ?
> Do you know about any performance issue with the SSL implementation
> provided in OFBiz ?
> And can you make an update to the code so that we can use the default JDK
> implementation without having to change the code ?
>
> Thanks,
>
> Cimballi
>
>