ServerSocket alternative in EJB

As written in EJB spec. classes ServerSocket and Socket are prohibited in use in EJB. So what is the alternative?
All samples I have reviewed uses clients (to connect to bean) written specially for EJB and AppServer, but what if bean needs to communicate with normal clients that uses normal socket connections via TCP/IP?
Any help is appriciated.

I think the prober solution would be to encapsulate your socket connection in a RAR and deploy that RAR in the J2EE server. Afterwards you are able to create a connection through the connectionfactory.
You may consulte some examples on the web. It is quite simple (min 5-6 classes for the rar)
Let me know if it worked, otherwise I can send a small example
Georges

Similar Messages

  • Alternative to EJB  Application servers

    Hi
    Can any body tell me the advantages of EJB in these contexts?
    1. WebServers/Application servers are exteremly costly for Indian Small & medium enterprises.So what is the milestones such firm will get on EJB..( I dont want answers like ejb is meant/good for dist. computing, transaction, security..)
    2. Can we achieve Container/application server functionality in c/c++?Any URL...?
    3. Can I get any url/info/docs on how application server works (or) how it provides the middleware services (or) how I get to know about the background activities..
    Any help appreciated,
    Regards
    Sriram

    Have you tried using the free or open source app servers?

  • Web Services - Servlets vs EJBs

    Hi,
    Looking for any suggestions about the benefits of using either servlets or EJBs as web service endpoints. Very early in the design of any application, I wish to expose my business logic components as web services, is there any particular benefit to using a specific approach (i.e. using either EJBs or Servlets as the end points of the web services exposing the business logic)?
    This is a totally new application so I have no considerations towards reusing old EJB code, etc. My initial thoughts favour using servlets, if only because it reduces the complexity / resources required for the application server (i.e only Web-container required, rather than Web & EJB container).
    Any thoughts please?

    Why do Servlets not scale as well? Surely they are
    more "lightweight" than an EJB (which has all theRMI
    overhead), and wouldn't it ultimately be down tothe
    underlying app server anyway?Right, but servlets are just HTTP request listeners.
    They aren't components, they aren't transactional,
    they don't handle persistence, they don't have
    naming services, they don't have queuing services.
    The EJB container offers you a lot.
    With that said, it's not just a choice between
    servlets and EJBs. You can use POJOs and avoid EJBs
    altogether if you do it right.
    Or choose the best of both worlds and mix 'n match as needed.
    Noone forces you to choose one over the other (at least not for any technical reasons, I'm not diving into corporate politics here).
    My thought was that web services were a better wayto
    expose business logic than EJBs, but if there some
    solid reason why this isn't the case I like toknow.
    Web services - lightweight? Maybe that's true of
    REST, but certainly not SOAP. There's an argument
    that says services are more heavyweight than EJBs,
    because all the XML on the wire is an expensive
    protocol.
    SOAP is heavy on the network, but it's essentially a rather thin layer on top of other services (if properly architected).
    For example we have a SOAP layer exposing a Spring application which proxies an EJB architecture.
    Next to that SOAP layer sits a traditional web application (servlets) which itself has a Spring application sitting on top of it for demonstration and testing purposes.
    And then there's an SDK allowing direct access to the Spring layer (and thus almost direct access to the EJB layer).
    That's the beauty of a true open architecture, each component can be built on top of another and the component underneath can function just fine without it.
    Look into Spring:
    http://www.springframework.org
    It's a lighter alternative to EJBs, and good plumbing
    for any Java EE app.While Spring can serve as an alternative for EJB in places where EJB are overkill it's of course not in competition with it.
    Spring is a service layer, making use of other technologies (like EJB, like AOP, like ORM) to provide data and other services (like Struts, like JSF, like JSP) to provide that data to requesters.

  • EJB vs Web Services

    I understand that when components are distributed and when they need to talk to each other, EJB is employed (Considering a web scenario). Do web services act as an alternative to EJB ? Any input on this is appreciated.
    Thanx

    Web services are not an alternative to EJB. More, they are often used together.
    Web Services is a way to access remote objects that is standard, using XML to describe contracts and language-independent. Based on web standards, they can make requests through firewalls as well.
    Web services is a good solution when you have two distant systems that want to "talk" with each other.
    In a pure web scenario, you'd rather use a servlet or EJB (using session-facade) architecture.
    /Stephane

  • Relation between EJB and CORBA

    Hi,
    I'm confused as to the relation between EJB and CORBA. Some books I've read say that CORBA is used to implement the underlying RMI protocol in EJB while others say it is an alternative to EJB.
    Could someone please clarify.
    Thanks

    Could you pleae restate your question.
    I'm assuming you want to bind a Corba object to a
    CosNaming service from within a j2ee component. JNDI
    supports this case fully via their CosNaming service provider
    (see http://java.sun.com/products/jndi/serviceproviders.html) JNDI is part of J2SE, so it's fully available to any J2EE component.
    Amlan on behalf of Kenneth Saks

  • SessionBean Resource Injection

    hi,
    there ist a possibility at EJB 2.1 to get Data from ejb-jar.xml over <env-enty> ...
    ist there any possibility or alternative at EJB 3.0 to get Data from descriptors? EJB 3.0 dosn't provide <env-entry> in ejb-jar.xml.
    thanks
    Hasan

    Hi Hasan,
    I'm not sure I understand your question. EJB 3.0 does allow you to define env-entry.
    You also have the option of injecting the value instead of doing a lookup.
    E.g., you would put the following in your ejb-jar.xml within a particular <session>
    or <message-driven> entry.
    <env-entry>
    <env-entry-name>value1</env-entry-name>
    <env-entry-type>java.lang.String</env-entry-type>
    <env-entry-value>Foo</env-entry-value>
    </env-entry>
    Then, in the bean class, you put the following :
    @Resource(name="value1") String value;
    Notice how the name attribute of @Resource matches the env-entry-name
    in the ejb-jar.xml. That means you could also lookup the value in the
    bean's component environment :
    String value = (String) new InitialContext().lookup("java:comp/env/value1");
    --ken                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Question about DAO pattern

    Greetings.
    If I'm using EJB's in my application when does DAO fits in?? I mean, it is DAO an alternative to EJB's or a complement ??
    Thanks in advance.

    DAO fits in if you are using entity beans using bean managed persistence. In this case, the DAO brokers the database calls during the EJB's lifecycle. The other instance when you would use DAO would be if you forgo entity beans altogether. In this model, stateful or stateless session beans would use DAO's to broker the database calls directly, outside of the normal entity bean lifecycle. The DAO pattern can also be used with POJO's (plain 'ole Java objects).
    The only instance where DAO would not apply is in the case of a container managed entity bean. In this case, there is no need to write a DAO, as the container will persist the bean for you.
    - Saish
    "My karma ran over your dogma." - Anon

  • Correct way to stream audio

    Pardon my ignorance. I have tried to search the forums, but the search box on this site hasn't got the possibility to limit the search to only this forum.
    My question is simple: If I capture audio from the microphone on my computer using a TargetDataLine and want to stream it over the internet to some other computer with some other software somewhere, what is the correct way to do so?
    Alternative 1: I create a ByteArrayOutputStream and a ServerSocket
    Alternative 2: I missed something in the documentation and should actually have constructed some other Line object connecting to an outgoing port on the computer.
    Thanks for any help

    rebol wrote:
    Pardon my ignorance. I have tried to search the forums, but the search box on this site hasn't got the possibility to limit the search to only this forum.You're fine...Ignorance is what forum questions are all about ;-) No point asking a question you already know the answer to...
    My question is simple: If I capture audio from the microphone on my computer using a TargetDataLine and want to stream it over the internet to some other computer with some other software somewhere, what is the correct way to do so?JavaSound doesn't have any way to do this. You do have a bunch of options about how to go about doing it, though...
    Alternative 1: I create a ByteArrayOutputStream and a ServerSocketThat would certainly work, but there are a handful of problems with it.
    (1) ServerSocket = TCP, and TCP = resends dropped packets. If you resend dropped packets, your stream will progressively get further and further behind "real-time" because every resent packet will add some delay that will never be made up.
    (2) This is probably going to take up a fair bit of bandwidth if you're capturing decent quality audio.
    So you'd definately want to use UDP instead to avoid the delay thing. Problem there is...
    (1) UDP packets aren't guarenteed to be delivered in order, so you'll want to drop the out of order packets.
    Actually, there's a method out there that's widely used to send media across a network that's implemented in UDP that's called RTP (Real-time Protocol). RTP is implemented in an add-on package for Java called JMF (Java Media Framework).
    With JMF, you can capture audio, transcode it into a different transmission-friendly RTP format, send it over the network, receive it on the other end, and play it using the built-in JMF player object. And if you're just wanting to do RTP and Sound, you can do it all just by including an extra JAR file.

  • How to use alternative sql statements in ejb 2.0

    hi
    i have written the alternative sql statement in persistence.xml like  "select max(modifieddate) from tmp_dlv_mgmt".
    i am getting the error
    java.rmi.RemoteException: com.sap.engine.services.ejb.exceptions.BaseRemoteException: Exception in method in.kgs.bean.Dlv_EntityHomeImpl0.findMaxModifiedByUserID(java.lang.String).
         at in.kgs.bean.Dlv_EntityHomeImpl0.findMaxModifiedByUserID(Dlv_EntityHomeImpl0.java:1477)
         at in.kgs.bean.Dlv_EntityHomeImpl0p4_Skel.dispatch(Dlv_EntityHomeImpl0p4_Skel.java:387)
         at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:320)
         at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:198)
         at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:129)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
         at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
    Caused by: com.sap.engine.services.ejb.exceptions.BaseEJBException: Exception in method Dlv_EntityBean0.FindMaxModifiedByUserID(java.lang.String).
         at in.kgs.bean.Dlv_EntityBean0PM.ejbFindMaxModifiedByUserID(Dlv_EntityBean0PM.java:900)
         at in.kgs.bean.Dlv_EntityHomeImpl0.findMaxModifiedByUserID(Dlv_EntityHomeImpl0.java:1449)
         ... 10 more
    Caused by: com.sap.sql.log.OpenSQLException: A column with name DLVNO is unknown.
         at com.sap.sql.log.Syslog.createAndLogOpenSQLException(Syslog.java:85)
         at com.sap.sql.log.Syslog.createAndLogOpenSQLException(Syslog.java:124)
         at com.sap.sql.jdbc.common.CommonResultSet.findColumn(CommonResultSet.java:643)
         at com.sap.sql.jdbc.common.CommonResultSet.getLong(CommonResultSet.java:382)
         at in.kgs.bean.Dlv_EntityBean0Persistent.extractPK(Dlv_EntityBean0Persistent.java:213)
         at in.kgs.bean.Dlv_EntityBean0Persistent.extractPrimaryKey(Dlv_EntityBean0Persistent.java:206)
         at com.sap.engine.services.ejb.entity.finder.FindPKCollection.extractSinglePK(FindPKCollection.java:152)
         at com.sap.engine.services.ejb.entity.finder.FindPKCollection.extractAndAddSinglePK(FindPKCollection.java:167)
         at com.sap.engine.services.ejb.entity.finder.FindPKCollection.onlyLoadAllElementsFromRS(FindPKCollection.java:146)
         at com.sap.engine.services.ejb.entity.finder.FindPKCollection.forceLoadingOfAllElementsFromRS(FindPKCollection.java:128)
         at com.sap.engine.services.ejb.entity.finder.FindPKCollection.<init>(FindPKCollection.java:99)
         at in.kgs.bean.Dlv_EntityBean0PM.ejbFindMaxModifiedByUserID(Dlv_EntityBean0PM.java:896)
         ... 11 more
    ; nested exception is:
         javax.ejb.EJBException: com.sap.engine.services.ejb.exceptions.BaseEJBException: Exception in method Dlv_EntityBean0.FindMaxModifiedByUserID(java.lang.String).
         at in.kgs.bean.Dlv_EntityBean0PM.ejbFindMaxModifiedByUserID(Dlv_EntityBean0PM.java:900)
         at in.kgs.bean.Dlv_EntityHomeImpl0.findMaxModifiedByUserID(Dlv_EntityHomeImpl0.java:1449)
         at in.kgs.bean.Dlv_EntityHomeImpl0p4_Skel.dispatch(Dlv_EntityHomeImpl0p4_Skel.java:387)
         at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:320)
         at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:198)
         at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:129)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
         at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
    Caused by: com.sap.sql.log.OpenSQLException: A column with name DLVNO is unknown.
         at com.sap.sql.log.Syslog.createAndLogOpenSQLException(Syslog.java:85)
         at com.sap.sql.log.Syslog.createAndLogOpenSQLException(Syslog.java:124)
         at com.sap.sql.jdbc.common.CommonResultSet.findColumn(CommonResultSet.java:643)
         at com.sap.sql.jdbc.common.CommonResultSet.getLong(CommonResultSet.java:382)
         at in.kgs.bean.Dlv_EntityBean0Persistent.extractPK(Dlv_EntityBean0Persistent.java:213)
         at in.kgs.bean.Dlv_EntityBean0Persistent.extractPrimaryKey(Dlv_EntityBean0Persistent.java:206)
         at com.sap.engine.services.ejb.entity.finder.FindPKCollection.extractSinglePK(FindPKCollection.java:152)
         at com.sap.engine.services.ejb.entity.finder.FindPKCollection.extractAndAddSinglePK(FindPKCollection.java:167)
         at com.sap.engine.services.ejb.entity.finder.FindPKCollection.onlyLoadAllElementsFromRS(FindPKCollection.java:146)
         at com.sap.engine.services.ejb.entity.finder.FindPKCollection.forceLoadingOfAllElementsFromRS(FindPKCollection.java:128)
         at com.sap.engine.services.ejb.entity.finder.FindPKCollection.<init>(FindPKCollection.java:99)
         at in.kgs.bean.Dlv_EntityBean0PM.ejbFindMaxModifiedByUserID(Dlv_EntityBean0PM.java:896)
         ... 11 more
    com.sap.sql.log.OpenSQLException: A column with name DLVNO is unknown.
         at com.sap.sql.log.Syslog.createAndLogOpenSQLException(Syslog.java:85)
         at com.sap.sql.log.Syslog.createAndLogOpenSQLException(Syslog.java:124)
         at com.sap.sql.jdbc.common.CommonResultSet.findColumn(CommonResultSet.java:643)
         at com.sap.sql.jdbc.common.CommonResultSet.getLong(CommonResultSet.java:382)
         at in.kgs.bean.Dlv_EntityBean0Persistent.extractPK(Dlv_EntityBean0Persistent.java:213)
         at in.kgs.bean.Dlv_EntityBean0Persistent.extractPrimaryKey(Dlv_EntityBean0Persistent.java:206)
         at com.sap.engine.services.ejb.entity.finder.FindPKCollection.extractSinglePK(FindPKCollection.java:152)
         at com.sap.engine.services.ejb.entity.finder.FindPKCollection.extractAndAddSinglePK(FindPKCollection.java:167)
         at com.sap.engine.services.ejb.entity.finder.FindPKCollection.onlyLoadAllElementsFromRS(FindPKCollection.java:146)
         at com.sap.engine.services.ejb.entity.finder.FindPKCollection.forceLoadingOfAllElementsFromRS(FindPKCollection.java:128)
         at com.sap.engine.services.ejb.entity.finder.FindPKCollection.<init>(FindPKCollection.java:99)
         at in.kgs.bean.Dlv_EntityBean0PM.ejbFindMaxModifiedByUserID(Dlv_EntityBean0PM.java:896)
         at in.kgs.bean.Dlv_EntityHomeImpl0.findMaxModifiedByUserID(Dlv_EntityHomeImpl0.java:1449)
         at in.kgs.bean.Dlv_EntityHomeImpl0p4_Skel.dispatch(Dlv_EntityHomeImpl0p4_Skel.java:387)
         at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:320)
         at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:198)
         at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:129)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
         at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
         at com.sap.engine.services.ejb.exceptions.BaseRemoteException.writeReplace(BaseRemoteException.java:276)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at java.io.ObjectStreamClass.invokeWriteReplace(ObjectStreamClass.java:896)
         at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1011)
         at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:278)
         at com.sap.engine.services.rmi_p4.DispatchImpl.throwException(DispatchImpl.java:144)
         at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:322)
         at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:198)
         at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:129)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
         at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
    Caused by: javax.ejb.EJBException: com.sap.engine.services.ejb.exceptions.BaseEJBException: Exception in method Dlv_EntityBean0.FindMaxModifiedByUserID(java.lang.String).
         at in.kgs.bean.Dlv_EntityBean0PM.ejbFindMaxModifiedByUserID(Dlv_EntityBean0PM.java:900)
         at in.kgs.bean.Dlv_EntityHomeImpl0.findMaxModifiedByUserID(Dlv_EntityHomeImpl0.java:1449)
         at in.kgs.bean.Dlv_EntityHomeImpl0p4_Skel.dispatch(Dlv_EntityHomeImpl0p4_Skel.java:387)
         at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:320)
         at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:198)
         at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:129)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
         at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
    Caused by: com.sap.sql.log.OpenSQLException: A column with name DLVNO is unknown.
         at com.sap.sql.log.Syslog.createAndLogOpenSQLException(Syslog.java:85)
         at com.sap.sql.log.Syslog.createAndLogOpenSQLException(Syslog.java:124)
         at com.sap.sql.jdbc.common.CommonResultSet.findColumn(CommonResultSet.java:643)
         at com.sap.sql.jdbc.common.CommonResultSet.getLong(CommonResultSet.java:382)
         at in.kgs.bean.Dlv_EntityBean0Persistent.extractPK(Dlv_EntityBean0Persistent.java:213)
         at in.kgs.bean.Dlv_EntityBean0Persistent.extractPrimaryKey(Dlv_EntityBean0Persistent.java:206)
         at com.sap.engine.services.ejb.entity.finder.FindPKCollection.extractSinglePK(FindPKCollection.java:152)
         at com.sap.engine.services.ejb.entity.finder.FindPKCollection.extractAndAddSinglePK(FindPKCollection.java:167)
         at com.sap.engine.services.ejb.entity.finder.FindPKCollection.onlyLoadAllElementsFromRS(FindPKCollection.java:146)
         at com.sap.engine.services.ejb.entity.finder.FindPKCollection.forceLoadingOfAllElementsFromRS(FindPKCollection.java:128)
         at com.sap.engine.services.ejb.entity.finder.FindPKCollection.<init>(FindPKCollection.java:99)
         at in.kgs.bean.Dlv_EntityBean0PM.ejbFindMaxModifiedByUserID(Dlv_EntityBean0PM.java:896)
         ... 11 more
    com.sap.sql.log.OpenSQLException: A column with name DLVNO is unknown.
         at com.sap.sql.log.Syslog.createAndLogOpenSQLException(Syslog.java:85)
         at com.sap.sql.log.Syslog.createAndLogOpenSQLException(Syslog.java:124)
         at com.sap.sql.jdbc.common.CommonResultSet.findColumn(CommonResultSet.java:643)
         at com.sap.sql.jdbc.common.CommonResultSet.getLong(CommonResultSet.java:382)
         at in.kgs.bean.Dlv_EntityBean0Persistent.extractPK(Dlv_EntityBean0Persistent.java:213)
         at in.kgs.bean.Dlv_EntityBean0Persistent.extractPrimaryKey(Dlv_EntityBean0Persistent.java:206)
         at com.sap.engine.services.ejb.entity.finder.FindPKCollection.extractSinglePK(FindPKCollection.java:152)
         at com.sap.engine.services.ejb.entity.finder.FindPKCollection.extractAndAddSinglePK(FindPKCollection.java:167)
         at com.sap.engine.services.ejb.entity.finder.FindPKCollection.onlyLoadAllElementsFromRS(FindPKCollection.java:146)
         at com.sap.engine.services.ejb.entity.finder.FindPKCollection.forceLoadingOfAllElementsFromRS(FindPKCollection.java:128)
         at com.sap.engine.services.ejb.entity.finder.FindPKCollection.<init>(FindPKCollection.java:99)
         at in.kgs.bean.Dlv_EntityBean0PM.ejbFindMaxModifiedByUserID(Dlv_EntityBean0PM.java:896)
         at in.kgs.bean.Dlv_EntityHomeImpl0.findMaxModifiedByUserID(Dlv_EntityHomeImpl0.java:1449)
         at in.kgs.bean.Dlv_EntityHomeImpl0p4_Skel.dispatch(Dlv_EntityHomeImpl0p4_Skel.java:387)
         at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:320)
         at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:198)
         at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:129)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
         at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
         at com.sap.engine.services.ejb.exceptions.BaseEJBException.writeReplace(BaseEJBException.java:274)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at java.io.ObjectStreamClass.invokeWriteReplace(ObjectStreamClass.java:896)
         at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1011)
         at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1332)
         at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1304)
         at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1247)
         at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
         ... 11 more

    Hi Guruvulu,
    >
    Guruvulu Bojja wrote:
    > i have written the alternative sql statement in persistence.xml like  "select max(modifieddate) from tmp_dlv_mgmt".
    Could you please explain in detail - what you have done and what you want to achieve? You can also post the code of your persistence.xml for reference...
    Regards,
    Yordan

  • How to use  alternative SQL  statements  in  EJB

    I have a probelm to use alternative sql statements in EJB,
    could any one sugg on this topic,
    Thanks in advance.

    Please explain your problem better. Really can't figure what you are trying to do.....
    choosing which sql statement to use at runtime
    or creating dynamic sql statement at runtime
    which??
    Regards

  • Alternative usage of proprty file reading in ejb

    Hi ,
    As IO is not advisable in EJB, can anyone tell me that any alternative is there to use properties
    Thanks in advance
    Venkatesh

    The standard way to configure an ejb is to add ejb-resources
    and environment entries to the deployment descriptor of the bean.
    environment entries can be accessed over the java:comp/env context
    in JNDI (from within a bean).
    search this forum for 'env-entry' to get examples how to manage this
    Alexander Sack

  • Using @EJB in main as an alternative to InitialContext Object

    Hallo everyone,
    I have successfully run my main Method which calls an EJB using InitialContext (jndi-lookup).
    If I am not mistaken, it is also possible to call an EJB in main-method using @EJB Annotation?  I have tried this by importing
    Import javax.ejb.EJB;
    public static void main(String args[]) {
    @EJB
    private static TheBeanRemote tbr;
    But unfortunately, it gave me the error in the compile Phase:
    the annotation @EJB is disallowed for this Location
    My questions:
    1. Is it generally allowed to call an EJB in the main method?
    2. If yes, did I miss some configuration XML-file in order to call EJB with annotations?
    Thank you for your help.
    Regars,  Ratna

    No, the @EJB annotation will only work in an actual JEE container (server) and only in a class that is actually managed by said container. And that is properly documented basically anywhere that covers EJB technology, so that can only mean you're doing wild guess work here in stead of proper study. That won't work, this is difficult technology to apply.

  • Ejb QL 3.0 group by / return type issues

    Hello all. I have a question regarding ejb query language 3.0. I have a query that works and looks like the following:
    select e.objectId, count(distinct s1.objectId), count(distinct s2.objectId)
    from Engagement e JOIN e.surveys s1 JOIN e.surveys s2
    where s2.scope is not null
    and s2.schedule is not null
    and s2.quality is not null
    and s2.expertise is not null
    and s2.overallExperience is not null
    group by e.objectId
    While this query "works" I am unhappy with the result. What is returned by this query is an Object array of size 3. The first element is the objectId, the second the count of "sent surveys" and the third the count of "completed surveys". While this is correct for the query i want to execute a query selecting out an actual engagement object, not just the objectId. To accomplish this now, I would have to manually select out every column in engagement growing my Object array to n + 2 where n is the number of columns in Engagement. I find this unreasonable and not object oriented and would like to get an object array back that contains an Engagement object as the first element, and then the counts. However I am unaware of how to write this in ejb QL. If anyone has more experience than me please let me know if this is possible. The following code is incorrect but represents what I want to do:
    select e, count(distinct s1.objectId), count(distinct s2.objectId)
    from Engagement e JOIN e.surveys s1 JOIN e.surveys s2
    where s2.scope is not null
    and s2.schedule is not null
    and s2.quality is not null
    and s2.expertise is not null
    and s2.overallExperience is not null
    group by e /* alternatively 'group by e.objectId' or something of the like */
    For anyone else having trouble with ejb QL the best resource I have found is the BNF grammar on suns site. If you are trying to do anything complex, chances are there isn't an example out for you :(
    http://java.sun.com/javaee/5/docs/tutorial/doc/bnbuf.html#bnbui

    I realized what I wanted to the QL to do wasn't really fair. I was thinking if you wanted to do something like the above it could automatically group by first whatever the pk is on the entity and then who cares what order is next, just pick something so the SQL group by is satisfied. After more thought I realized this wasn't really a fair assumption the query engine could make and went about coding the specific items I wanted back in the select and made a corresponding entity object that acutely defined my result and used a constructor expression to create a list of these new objects. Hopefully someone else finds this useful and I appreciate the above response as well. Marking as answered.

  • SocketTimeout Exception while calling a Web Service from EJB

    Hi All,
    I am consuming a Web Service defined from the WSDL received from a PI system
    in a Stateless EJB.
    The input of the Service can be a range of records 100 - 10,000, with a furture plan to exceed the range as 100 - 15,000.
    The Web Service Call goes perfect with 100 - 3500 number of records.
    As the number of records exceed 3500, we started getting the following exception:
    Service call exception; nested exception is: java.net.SocketTimeoutException: Read timed out
    Along with a call happenning to the PI system after some seconds.
    Referring to various help.sap.com pages, I came across the following code snippet:
    client._setProperty("socketTimeOut","200000");
    This thing works great!!!, and now we have set the the socketTimeout proggramatically to a satisfactory level which supports the current requirement.
    I would like to know, if we can tune some Visual Administrator Parameter for this, instead of maintaining the "Socket TimeOut" in the code.
    Any help will be appreciated.
    Best Regards,
    Alka.
    Edited by: Alka Panday on Apr 23, 2008 9:17 AM

    Hi Alka,
    Please refer to SAP Note 962114. This is specifically for Web Service clients.
    Description-->
    This note can be applied for 6.40 SP 12+. If the customer has a lower SP, an upgrade of the whole engine is recommended. The other alternative to set the timeout is to set it programmatically.
    If running a 7.0 installation, the functionality has been integrated in SP8 onwards
    When you go to the Visual Administrator -> Server -> Services -> Web Services Container on the Settings tab page you should be able to see the socket timeout input field next to the HTTP Proxy settings. You can change the default value there and it will be automatically applied to all WS client proxies and logical ports deployed on the system.
    Hope this helps.
    regards,
    Piyush

  • Creating multiple stateful session beans from a java client. (EJB 3.0)

    I'm having difficulties with the following:
    To access the ShoppingCartBean, I have to put the following annotation in my standalone java client:
    @EJB
    private static ShoppingCartRemote shoppingCartBean;
    The static must be there, thus only one ShoppingCartBean will exist within my java client. But as the ShoppingCartBean is a stateful session bean, I want to be able to get different beans of the same type.
    What is the correct way to do this in EJB 3.0?

    Great question. Because Home interfaces have been removed for the EJB 3.0 simplified
    API, stateful session bean creation happens as a side-effect of injection. However, the
    same is true of EJB 3.0 business interface lookups. The easiest way to create additional
    stateful session beans is to lookup the same dependency that was declared via your
    @EJB annotation.
    E.g.,
    // Assuming the declaring class is pkg1.ShoppingCartClient.java
    InitialContext ic = new InitialContext();
    ShoppingCartRemote scr1 = (ShoppingCartRemote)
    ic.lookup("java:comp/env/pkg1.ShoppingCartClient/shoppingCartBean");
    Note that the name relative to java:comp/env is the default associated with your
    @EJB annotation since the name() attribute wasn't used. Alternatively, you
    could have used :
    @EJB(name="scb") private static ShoppingCartRemote shoppingCartBean;
    InitialContext ic = new InitialContext();
    ShoppingCartRemote scr1 = (ShoppingCartRemote) ic.lookup("java:comp/env/scb");
    Yet another alternative is to declare the @EJB at the class-level. This just defines
    the dependency without any injection, which is fine if you want to create a bunch of
    them via lookup anyway.
    @EJB(name="scb", beanInterface=ShoppingCartRemote.class)
    public class .... {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Maybe you are looking for