Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > EJBs as active components?

Reply
Thread Tools

EJBs as active components?

 
 
Vjeran Marcinko
Guest
Posts: n/a
 
      10-16-2003
Hi folks.

I'm total newbie in J2EE, so can someone explain me following about ejbs -
I know that usually client application should connect to EJB server to perform business logic by one of well-defined protocols, but let's say I want to create my own server-socket component that will accept client calls through my custom protocol and dispatch requests to appropriate business level EJBs.
Am I supose to make this active server-socket component inside EJB container as some EJB (is this entity bean then?!), or as separate java application that will decode client requests and dispatch them to EJB server by known protocol ?

Regards,
Vjeran

 
Reply With Quote
 
 
 
 
Collin VanDyck
Guest
Posts: n/a
 
      10-16-2003
Your EJB Entity beans represent data, or more commonly, rows in database
tables. Your EJB Session beans are more along the lines of what you are
probably getting at. If I were to approach this, I'd probably attempt to
write a server that listened on your proprietary protocol, and then made
requests on the EJB Session beans that would then communicate with the EJB
Entity beans.

"Vjeran Marcinko" <(E-Mail Removed)> wrote in message
news:bmmam8$uui$(E-Mail Removed)...
Hi folks.

Am I supose to make this active server-socket component inside EJB container
as some EJB (is this entity bean then?!), or as separate java application
that will decode client requests and dispatch them to EJB server by known
protocol ?

Regards,
Vjeran


 
Reply With Quote
 
 
 
 
John C. Bollinger
Guest
Posts: n/a
 
      10-16-2003
Vjeran Marcinko wrote:

> I'm total newbie in J2EE, so can someone explain me following about ejbs -
> I know that usually client application should connect to EJB server to perform business logic by one of well-defined protocols, but let's say I want to create my own server-socket component that will accept client calls through my custom protocol and dispatch requests to appropriate business level EJBs.
> Am I supose to make this active server-socket component inside EJB container as some EJB (is this entity bean then?!), or as separate java application that will decode client requests and dispatch them to EJB server by known protocol ?


Short answer: the latter.

Longer answer:
EJBs are not permitted to open server sockets, or to do any of a number
of other things that might interfere with their management by the EJB
container. A component that needed to perform those sorts of operations
would need to be outside the EJB container, but not necessarilly outside
the whole J2EE server.

One solution would be to use a J2EE server with an integrated servlet
container, and to install your custom component in the servlet
container. This could be by means of making it a ServletContextListener
in some (possibly empty, otherwise) web application. That way your
custom component could talk to the EJBs via their local interfaces.

Alternatively, you could put the custom component into a standalone
application. You would need to communicate with the EJBs via their
remote interfaces in this case. The only advantage I see here is not
needing to know anything about the servlet API. Other than that, doing
it in a webapp associated with the J2EE server that hosts the EJBs has
only advantages.


John Bollinger
http://www.velocityreviews.com/forums/(E-Mail Removed)

 
Reply With Quote
 
Michael Borgwardt
Guest
Posts: n/a
 
      10-17-2003
Vjeran Marcinko wrote:

> Thx. I found some document about ejb restrictions and it is stated there that usage of java.io.*
> should be avoided ? Why is that ?


Wasn't a very good document if it didn't explain the reasons. This one does:
http://www.javaworld.com/javaworld/j...brestrict.html

Actually, the restriction only applies to *file* access, not network IO.
And that's because files are local to a specific machine and EJBs are
supposed to be migrateable between machines.


> I have some components that inside it's business methods perform socket connection to some other
> special-purpose servers (java.net* and java.io.* classes are used) and I want to

convert them
> to EJBs... That means that such components are impossible to convert ?


According to the document above, that's explicitly allowed. You just shouldn't
*liste* for socket connections or use multicast.

 
Reply With Quote
 
Vjeran Marcinko
Guest
Posts: n/a
 
      10-17-2003

"John C. Bollinger" <(E-Mail Removed)> wrote in message news:bmmf4u$qgg$(E-Mail Removed)...

> Short answer: the latter.
>
> Longer answer:
> EJBs are not permitted to open server sockets, or to do any of a number
> of other things that might interfere with their management by the EJB
> container. A component that needed to perform those sorts of operations
> would need to be outside the EJB container, but not necessarilly outside
> the whole J2EE server.
>
> One solution would be to use a J2EE server with an integrated servlet
> container, and to install your custom component in the servlet
> container. This could be by means of making it a ServletContextListener
> in some (possibly empty, otherwise) web application. That way your
> custom component could talk to the EJBs via their local interfaces.
>
> Alternatively, you could put the custom component into a standalone
> application. You would need to communicate with the EJBs via their
> remote interfaces in this case. The only advantage I see here is not
> needing to know anything about the servlet API. Other than that, doing
> it in a webapp associated with the J2EE server that hosts the EJBs has
> only advantages.


Thx. I found some document about ejb restrictions and it is stated there that usage of java.io.* should be avoided ? Why is that ?
I have some components that inside it's business methods perform socket connection to some other special-purpose servers (java.net* and java.io.* classes are used) and I want to convert them to EJBs... That means that such components are impossible to convert ?

Regards,
Vjeran

 
Reply With Quote
 
Emanuel Bulic
Guest
Posts: n/a
 
      10-17-2003
You want a standalone java app.. open a socket, accept connections,
and do the custom protocol thing.

Actually, my first suggestion is, use web-services, since you probably
need this in order to get around some network security issues. But,
anyway, a standalone application, outside the ejb container, is
probably the best approach, for reasons already mentioned. you don't
want to clutter your ejb's with any of these things anyway.


"Vjeran Marcinko" <marcinko remove this @jware.net> wrote in message news:<bmmam8$uui$(E-Mail Removed)>...
> Hi folks.
>
> I'm total newbie in J2EE, so can someone explain me following about ejbs
> -
> I know that usually client application should connect to EJB server to
> perform business logic by one of well-defined protocols, but let's say I
> want to create my own server-socket component that will accept client
> calls through my custom protocol and dispatch requests to appropriate
> business level EJBs.
> Am I supose to make this active server-socket component inside EJB
> container as some EJB (is this entity bean then?!), or as separate java
> application that will decode client requests and dispatch them to EJB
> server by known protocol ?
>
> Regards,
> Vjeran

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How EJBs differ from RMI? Panchal V Java 1 12-22-2003 06:06 PM
applet, ejbs and MVC Taki Java 4 12-14-2003 05:54 AM
inheritance with EJBs (CMP) also for find-methods supported? Frank Ratzlow Java 3 11-11-2003 06:30 PM
Beginners questions: Using EJBs on two Workstations bebonights Java 0 10-13-2003 02:28 PM
How widespread is the use of EJBs in app servers? Patrick May Java 3 08-19-2003 03:03 PM



Advertisments