• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

how to call EJB2.0 from one apllication into another?

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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...
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you explain this a bit further;

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?

Mark
 
Prashant Bhardwaj
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Prashant Bhardwaj
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sorry. Read "remote server" as remote interface in my statement above.
And also by client jars, I mean the Remote interface(stub) class files.
 
Mark Spritzler
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

Mark
 
Prashant Bhardwaj
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic