hi, I am new to EJB.We have an application made in EJB2.0 that has an architecture as follows: web-->service/business delegate-->control(session beans)-->entity beans. I need to to access data provided by one application from another application.I believe EJBs provide different ways for that by accessing the remote interface, however I need to choose a clean way so that I don't have to put the ejb client jars in the server classpath. Can you please provide help (preferably code excerpts as well)? Someone told me that it might be possible using reflection...
however I need to choose a clean way so that I don't have to put the ejb client jars in the server classpath.
What EJB client jars? Any client can call an EJB2.0, if that other client is also deployed in the same server, then it should be able to do local lookups and keep it in the same JVM, so that the jar that you would give to a remote client does not need to be given to the client in the same app server. Is that what you mean?
ok, my bad for not having described the enviornment completely. Ours is a distributed enviornment and we have 2 application servers administered by a managed server (weblogic 8.2). Take it for granted that the applications are on different JVMs. Now, if I want to use the EJB in application 'A' from another application 'B' by using the remote server, then the only way I know to do that is by putting the client jars of 'A' in server classpath so that 'B' can have access to them at runtime. However, doing that would make hot deployments difficult, besides its not a good practice to keep such jar files in server classpath. Phew!, does that explain the problem in its entirity?
Joined: Jul 25, 2006
sorry. Read "remote server" as remote interface in my statement above. And also by client jars, I mean the Remote interface(stub) class files.
OK, so App A is a remote client of App B, so App A must have the client jars, this is not a bad practice, whether App A is in a different App Server or not.
If you really wanted to, you could front App B with Web Services so App A just calls a web service, if you want, but that will add a little overhead.
Joined: Jul 25, 2006
ok, I had to go through the embarassment of our mutual idea being rejected by my Technical Manager, but found the answer anyway from him. :-|
Putting ejb-client jars from application A into another Application B is bad because then you have to update the client jars in B every time you change application A.It also means that you are making cross-references between application codes.
The best way out of it is (he told me 2 more, but they went over the head, besides, he told me this one is the best ) : "Use EJB reflection". Its more costly than any other solution, but its the cleanest way for the said purpose.