The first One -------------- You are right. By specification, you are not allowed to use IO in EJB. If you do, there will be a runtime error, because IO classes are not serializable.
To solve this problem, there are two options: 1) use JMS, as suggested by your friend. This allows decoupling between your EJB and the TCP/IP class. Less efficient. 2) Use a singleton class that keeps a TCP/IP connection. Your EJB references this singleton as a local variable in a method, but should not keep it as a member variable. This will avoid runtime error. It is a simple and efficient method. worth another try is -------------------- Assuming that the app server is initiating the interaction with the inventory devices I recommend looking at the JCA for abstracting the interaction. (requires a J2EE 1.3 compliant server otherwise there is a bit of hacking required for 1.2.) As for session bean vs entity bean it would depend on what level the app is interacting with the devices and how smart they are. If you communicate with the devices at a fairly low level (e.g. close to primitive data manipulation) then use entity beans with bean managed persistence. If the devices are smart/functional then use session beans as a facade to the high level functions provided by the devices. In either case incorporate the JCA if you can. It is particularly useful for proprietary connections. Regards Ramesh Kesavanarayanan EDS [EMAIL PROTECTED] >hi all > > 2.A shipping company is building an enterprise system to track the location >of packages.One part of the tracking sys- >tem is a network of wireless inventory devices.The devices can only be >accessed using a custom,synchronous TCP/IP >protocol.How should you encapsulate interaction with the wireless inventory >system? > >A.with a Java class that uses a JMS to interact with the inventory system >B.with a distributed CORBA object that uses IIOP to interact directly with >the inventory system >C.with an EJB Tstateful session bean that uses Java sockets to interact with >the inventory system >D.with an EJB entity bean that uses container-managed persistence to >encapsulate the inventory system > >My doubt > Can I open a socket connection from a session bean? After all Iam using >few I/O operations >which is not allowed according to the specification and most of the >appservers do not allow >I/O operations. Am I missing some thing?? > >thanks in avance >ramesh > =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff EJB-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".
