EJB 2.0 Spec Clarification

I quote directly from the EJB2.0 Specification:
" Clients are not allowed to make concurrent calls to a stateful session object. If a client-invoked business
method is in progress on an instance when another client-invoked call, from the same or different client,
arrives at the same instance of a stateful session bean class, the container may throw the
java.rmi.RemoteException to the second client [4] , if the client is a remote client, or the
javax.ejb.EJBException, if the client is a local client. This restriction does not apply to a state-less
session bean because the container routes each request to a different instance of the session bean
class. "
Now the part that im confused is this:
'If a client-invoked business
method is in progress on an instance when another client-invoked call, from the same or different client'
As far as I understand,Stateful Sessions are Client-specific,that is One instance services atmost one client.So that part about "same or different client" confused me.What does it mean? Can anyone help?
Thanks in Advance.
Ameya

You can look at that part of the spec as applying to the app server vendors. A little re-wording:
"If a client-invoked business method is in progress on an instance when another client-invoked call, from the same or different client", your app server must throw a java.rmi.RemoteException or javax.ejb.EJBException, depending upon whether the request is remote or local.

Similar Messages

  • How to use (toplink essentials)JPA with EJB 2.1 spec in oc4j 10.1.3.2

    I have an application that uses EJB 2.1 spec with SLSB (no entity beans) and uses DAO pattern with hibernate2 for persistence. I want to replace hibernate with toplink-essentials (JPA). I cannot upgrade the EJB spec version as we use some thirdparty beans. The application uses DAO pattern so I should be able to hook in a new toplink DAO impl. What I am struggling with is how do I get hold of the EntityManagerFactory in my EJB 2.1 SLSB. Also I need CMT with XA transactions as our application interacts with jms and database using MDBs and SLSBs.
    Prantor

    You should be able to use Persistence.createEntityManagerFactory(<your-persistence-unit-name>, properties), and create your EntityManager from that.
    To have TopLink integrated with JTA, in your persistence.xml (or properties) you need to use a JTA DataSource, and set the ServerPlatform for your JEE server.

  • EJB 1.1 Spec

    Hello,
    will OAS and JServer support the EJB 1.1 spec including entity beans in the near future?
    Thanks, peter

    Dimitri Rakitine <[email protected]> writes:
    Actually, java.lang.Class is Serializable, but it doesn't have any serializable
    fields - only class desc is written to the output. But it doesn't implement equals()
    or hashCode(). Anyway, why don't you simply use String with a class name as a
    primary key?
    We will use a workaround. My question is primarily related to the EJB
    specification and WebLogic compatability.

  • EJB 3.0 PostConstruct and SessionContext -Oracle EJB 3.0 spec violatiation?

    I am writing a stateless session bean using EJB 3.0 and the PostConstruct annotation. Within the PostConstruct annotated method my bean accesses the SessionContext to get the Timer Service. WebLogic 10.3.3 is throwing the following error:
    com.oracle.pitchfork.interfaces.LifecycleCallbackException: Failure to invoke public void org.stola.services.MyJobRunnerBean.setupTimer() on bean class class org.stola.services.JobRunner_oa6dng_Impl with args: []
    at com.bea.core.repackaged.springframework.jee.inject.Jsr250Metadata.invokeLifecycleMethod(Jsr250Metadata.java:335)
    Caused By: java.lang.IllegalStateException: [EJB:010193]Illegal call to EJBContext method. The bean is in "null" state. It cannot perform 'getting the Timer Service' action(s). Refer to the EJB specification for more details.
    at weblogic.ejb.container.internal.BaseEJBContext.checkAllowedMethod(BaseEJBContext.java:141)
    However, reading the EJB 3.0 specification, in section 4.5.2, table 2, it states that you can call SessionContext.getTimeService in the PostConstruct method. Is this a bug in the EJB 3.0 implementation by Oracle WebLogic?
    Edited by: user4805298 on Sep 10, 2010 10:01 AM

    The solution was to NOT have glabal transaction checked in the configuration of the data-source and "Failover Transaction State Upon Managed Release" uncked in the configuration of the Business component configuration.

  • Functional spec clarification

    Hello gurus,
    I need some tips in analyzing a functional spec. I really need to know what all information I definitely need to have in a functional spec so as to start writing a technical spec.
    This is how my func spec looks like:
    It has few KPI's listed.
    Empty business content section.(nothing mentioned)
    Empty Multi provider section.(nothing mentioned)
    Report properties.
    Data fields (nothing mentioned)
    columns and rows of report.
    Drill downing characteristics.
    Now my question with the above mentioned information can we call it to be a complete functional spec????  and can i start writing a technical spec???
    I am confused what all information shud a functional spec have???
    does it need to list all the technical names of the infoobjects, infocubes, ods, data sources etc needed for a data model??????
    correct me if I am wrong:
    functional spec=technical names of IO, ods, IC,etc
    Technical spec=detailed information of io, ods, ic??????? is it right????
    Eagerly waiting for your inputs.
    PLEASE HLEP ME OUT GURUS.
    WILL SURELY AWARD POINTS.
    Regards

    Thank you so much for your reply .
    Need some more inputs from you in writing a technical spec.
    I have actually collected all the fields in the functional spec, and then I have searched the business content for a extract structure with those fields. But i was not able to find all the fields in a single extract structure, the fields are scattered into two to three extract structures, so how should I work it out???
    I have another question too, if I know the Technical name of a character how can i search for that in a extract structure, because in a extract structure i can only field names and the description right??? one way could be double clicking it and knowing the default name ...but is there any other option????may be a dumb question but please do help me out gurus.
    thanks

  • Ideapad A10 Specs clarification

    Hello,
    I want clarification on the specifications of this product which just recently is advertised in my local market of a country called Oman.
    On the website it says to feature a Cortex-A9 CPU but on this ad it says i3 2.5 ghz CPU.
    Please clarify if there are other varieties of this product which feature this CPU.
    Link to image
    Moderator note: images totalling more than 50k converted to links per forum rules:  Lenovo Community Participation Rules

    I have bought this device two weeks ago. It is definitely the first and not the later Intel CPU. Don't take our stores ads seriously.
    Greetings from Saudi :-)

  • Cannot deploy EJB from JDev 3.2

    Dear Sirs,
    When you try to create a deployment profile using JDeveloper 3.2 step #2 of the wizard asks for "select a type of deployment". In Jdeveloper 3.1.1.2 the option "deploy Enterprise Java Bean (EJB) to Oracle8i". But in release 3.2 that option is taken away.
    Does this mean Jdeveloper does not support the EJB 1.1 spec (i.e. the XML deployment descriptor)? Or must I upgrade the database from 8.1.6 to 8.1.7. Or is this a bug?
    regards.

    Hello:
    Can anyone helps us with this EJB problem in Oracle? :
    With JDeveloper 3.1.12 we can deploy with the wizard an EJB component in Oracle (database) 8.1.6 but the client test fails with the following message:
    "oracle.jbo.ApplicationModuleCreateException:
    JBO-25222: Unable to create application module...."
    In an Oracle error log file (in the bdump directory) we find the following information:
    "Attempt to call System.getProperties failed
    ...skipping...
    at oracle.jbo.server.remote.ejb.EJBApplicationModuleImpl.ejbCreate
    (EJBApplicationModuleImpl.java:183)..."
    We think that the problem is related with:
    1- memory parameters of Oracle 8i ?
    2- Java security permissions in the server ?
    Thanks you for your help.
    Maria Consuelo Franky - Victor Toro
    CincoSOFT Ltda.
    Bogota - Colombia
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by slag:
    Oracle (database) 8.1.6 only supports 1.0 spec, 8.1.7 is 1.1 spec compliant, to my knowledge.
    [b]slag<HR></BLOCKQUOTE>
    null

  • How to upgrade web app to J2EE compliant, EJB, etc.

    I support an application that was designed and created before the EJB 2.0 spec
    came out. It was built by a regional consulting company, who used their own application
    framework instead of EJB stuff. Their framework mainly consists of classes to
    handle transactions, JDBCconnections, and what is basically their equivalent of
    an EJB, called a Domain Object. The framework is actually pretty impressive and
    works quite well.
    I'm trying to evaluate whether it would be worth 'upgrading' the entire application,
    to use EJBs and other things to make it J2EE compliant. I've worked with JSPs
    and servlets for a couple years, but I've no experience with EJBs. I've pieced
    together an extremely simply stateless-session bean and have been able to use
    it on a JSP, but now I'm trying to get entity beans working, and can't find any
    examples or tutorials of how to invoke, load, create, etc. an EJB in a JSP/servlet.
    Can anyone recommend a resource for this? I've just ordered the latest Enterprise
    Java Beans book from OReilly, but I didn't know how much that had on actually
    using EJBs within JSPs and servlets.
    Thanks

    Hello Karthik,
    I just tried to solve my problem with your suggestions, unfortunately, my JSP channel still doesn't work :(
    The portal server keeps reporting "Server Error..." when I tried to add query at the end of the href.
    Do you still have any other suggestions?
    Thank you

  • Ejb error while migrating from wl5.1 to wl8.1

    Hello All,
    I am trying to resolve this error that i am getting. Before i jump into the problem i would like to mention that i am in the process of converting our application from weblogic 5.1 to weblogic 8.1. For now i am using the same ejb(1.1 spec) and deploying it on WL8.1, the ejbs do get deployed, however when i try to run the application i get the following error. Am i missing something here (in descriptor files or somewhere else). Appreciate any input on this problem.
    com.xxx.yyy.jsp.data.ScreenData: findByPrimaryKey(com.xxx.yyy.ejb.testUser.TestUserPK(10002))
    com.xxx.yyy.jsp.data.ScreenData: Find AppUser Home for (com.xxx.yyy.ejb.testUser.TestUserPK(10002))
    com.xxx.yyy.jsp.data.ScreenData: Find AppUser Bean for (com.xxx.yyy.ejb.testUser.TestUserPK(10002))
    com.xxx.yyy.jsp.data.ScreenData Application user id com.xxx.yyy.ejb.testUser.TestUserPK(10002) remote server error.
    Error during setXXXContext: ; nested exception is:
    java.lang.IllegalStateException: [EJB:010193]Illegal call to EJBContext method. The bean is in "context setting" state. It cannot perform 'getting EJB object for Entity bean' OR 'getting the primary key' action(s). Refer to the EJB specification for more details.
    java.rmi.RemoteException: Error during setXXXContext: ; nested exception is:
    java.lang.IllegalStateException: [EJB:010193]Illegal call to EJBContext method. The bean is in "context setting" state. It cannot perform 'getting EJB object for Entity bean' OR 'getting the primary key' action(s). Refer to the EJB specification for more details.
    at weblogic.rmi.internal.ServerRequest.sendReceive(ServerRequest.java:186)
    at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:284)
    at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:244)
    at com.xxx.yyy.ejb.testUser.TestUserBean_19p26e_HomeImpl_812_WLStub.findByPrimaryKey(Unknown Source)
    at com.xxx.yyy.jsp.data.ScreenData.findByPrimaryKey(ScreenData.java:104)
    at jsp_servlet._jsp.__router._jspService(__router.java:219)
    at weblogic.servlet.jsp.JspBase.service(JspBase.java:33)
    at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:971)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:402)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:446)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:305)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6350)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
    at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3635)
    at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2585)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
    Thanks
    vivi

    seems like you are calling EntityContext.getEJBObject() or EntityContext.getPrimaryKey() before the context has been set on the bean. an IllegalStateException is thrown in such cases.
    cheers,
    mihir

  • Transfer Objects in EJB 3.0

    Hello,
    I am building Enterprise application with EJB 3.0 and JSF. In many J2EE books there's that Trasfer Object pattern ( sometimes called Value Object or so), I just wonder what are your experiences in using TO in Java EE ( EJB 3.0).
    Because entity beans in EJB 3.0 are POJOs I think that there is no need to
    use TO pattern.
    Im my app I receive entity from session bean and bind that entity to JSF components. This is the easisest solution for me because I don't build boring
    transfer object, and don't have to wory about transformation between TO and Entity beans. Am I doing right or I am maybe missing something??
    By reading EJB 3.0 spec. when session bean returns entity it becomes
    detached so its just plain java object. ??
    I know that using TO you can reduce coupling between client and EJB but
    you must implement additional level with TO objects and transformations, so
    it looks to me that by using TO you just get more complexity and problems ?
    Tell me what are your thoughts and experiences.
    Regards,
    Niksa Jakovljevic
    FOS

    Hi Niksa,
    Your intuition about EJB 3.0 is correct. One of the advantages of Java Persistence API entities
    is that they can be passed directly to clients without having to convert their data to separate transfer
    objects. The reason this was a common pattern in EJB 2.x and earlier is that CMP 2.x beans are 1st
    class EJB components that are limited in their ability to be used outside of the ejb tier.
    --ken                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Error: Unresolved ejb-link :

    I want to call a session bean from a servlet.while deploying i am getting the error
    Error: Unresolved <ejb-link>:
    I am using Netbeans 6.0 IDE. here i am posting my code.
    Calling code in servlet :
    Context ctx = new InitialContext();
    Object objref = ctx.lookup("java:comp/env/ejb/Etrack");
    testBean=(MyHome)PortableRemoteObject.narrow(objref,MyHome.class);
    web.xml :
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
    <servlet>
    <servlet-name>MyClientServlet</servlet-name>
    <servlet-class>MyClientServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>MyClientServlet</servlet-name>
    <url-pattern>/MyClientServlet</url-pattern>
    </servlet-mapping>
    <ejb-local-ref>
    <ejb-ref-name>ejb/Etrack</ejb-ref-name>
    <ejb-ref-type>Session</ejb-ref-type>
    <local-home>MyHome</local-home>
    <local>MyRemote</local>
    <ejb-link>Etrack</ejb-link>
    </ejb-local-ref>
    <session-config>
    <session-timeout>
    30
    </session-timeout>
    </session-config>
    <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
    </web-app>
    My ejb-jar.xml :
    <?xml version="1.0"?>
    <!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN' 'http://java.sun.com/dtd/ejb-jar_2_0.dtd'>
    <ejb-jar>
    <enterprise-beans>
    <session>
    <display-name>Etrack Bean</display-name>
    <ejb-name>Etrack</ejb-name>
    <local-home>MyHome</local-home>
    <local>MyRemote</local>
    <ejb-class>MyEjbClass</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Container</transaction-type>
    <ejb-local-ref>
    <ejb-ref-name>ejb/Etrack</ejb-ref-name>
    <ejb-ref-type>Session</ejb-ref-type>
    <local-home>MyHome</local-home>
    <local>MyRemote</local>
    <ejb-link>Etrack</ejb-link>
    </ejb-local-ref>
    </session>
    </enterprise-beans>
    <assembly-descriptor>
    <container-transaction>
    <method>
    <ejb-name>Etrack</ejb-name>
    <method-intf>Local</method-intf>
    <method-name>*</method-name>
    </method>
    <trans-attribute>NotSupported</trans-attribute>
    </container-transaction>
    </assembly-descriptor>
    </ejb-jar>
    My sun-ejb-jar.xml :
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE sun-ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 8.1 EJB 2.1//EN" "http://www.sun.com/software/appserver/dtds/sun-ejb-jar_2_1-1.dtd">
    <sun-ejb-jar>
    <enterprise-beans>
    <ejb>
    <ejb-name>Etrack</ejb-name>
    <stateless-session-descriptor>
    <bean-pool>
    <steady-pool-size>10</steady-pool-size>
    <resize-quantity>10</resize-quantity>
    <max-pool-size>100</max-pool-size>
    <pool-idle-timeout-in-seconds>600</pool-idle-timeout-in-seconds>
    </bean-pool>
    </stateless-session-descriptor>
    <jndi-name>ejb/Etrack</jndi-name>
    <pass-by-reference>true</pass-by-reference>
    <ejb-ref>
    <ejb-name>Etrack</ejb-name>
    <ejb-ref-name>ejb/Etrack</ejb-ref-name>
    <jndi-name>ejb/Etrack</jndi-name>
    </ejb-ref>
    </ejb>
    </enterprise-beans>
    </sun-ejb-jar>
    Can anyone help me in resolving this issue.It will be a great help for me.Thanks in advance

    You could always try removing the ejb-link, and see if the container can inject a reference in the runtime environment (accessible using jndi java:comp/env/ejb/Etrack).
    If it doesn't, check these:
    1) http://www.redhat.com/docs/manuals/rhaps/jonas-guide/ch-beans-ejbref.html
    2) the ejb 2.0 spec, which the original poster was using (although this is the same in 2.1 and 3.0), states the folowing:
    +20.3.2 Application Assembler&rsquo;s responsibilities+
    The Application Assembler can use the ejb-link element in the deployment descriptor to link an*
    EJB reference to a target enterprise bean.*
    The Application Assembler specifies the link between two enterprise beans as follows:*
    +&bull; The Application Assembler uses the optional ejb-link element of the ejb-ref or+
    ejb-local-ref element of the referencing enterprise bean. The value of the ejb-link*
    element is the name of the target enterprise bean. (It is the name defined in the ejb-name element*
    of the target enterprise bean.) The target enterprise bean can be in any ejb-jar file in the*
    same J2EE application as the referencing application component.*
    +&bull; Alternatively, to avoid the need to rename enterprise beans to have unique names within an+
    entire J2EE application, the Application Assembler may use the following syntax in the*
    ejb-link element of the referencing application component. The Application Assembler*
    specifies the path name of the ejb-jar file containing the referenced enterprise bean and*
    appends the ejb-name of the target bean separated from the path name by # . The path name*
    is relative to the referencing application component jar file. In this manner, multiple beans with*
    the same ejb-name may be uniquely identified when the Application Assembler cannot*
    change ejb-names.*
    +&bull; The Application Assembler must ensure that the target enterprise bean is type-compatible with+
    the declared EJB reference. This means that the target enterprise bean must be of the type indicated*
    in the ejb-ref-type element, and that the home and component interfaces of the target*
    enterprise bean must be Java type-compatible with the interfaces declared in the EJB*
    reference.*
    The following illustrates an ejb-link in the deployment descriptor.*
    +...+
    *+<enterprise-beans>+*
    *+<session>+*
    +...+
    *+<ejb-name>EmployeeService</ejb-name>+*
    *+<ejb-class>com.wombat.empl.EmployeeServiceBean</ejb-class>+*
    +...+
    *+<ejb-ref>+*
    *+<ejb-ref-name>ejb/EmplRecord</ejb-ref-name>+*
    *+<ejb-ref-type>Entity</ejb-ref-type>+*
    *+<home>com.wombat.empl.EmployeeRecordHome</home>+*
    *+<remote>com.wombat.empl.EmployeeRecord</remote>+*
    *+<ejb-link>EmployeeRecord</ejb-link>+*
    *+</ejb-ref>+*
    +...+
    *+</session>+*
    +...+
    *+<entity>+*
    *+<ejb-name>EmployeeRecord</ejb-name>+*
    *+<home>com.wombat.empl.EmployeeRecordHome</home>+*
    *+<remote>com.wombat.empl.EmployeeRecord</remote>+*
    +...+
    *+</entity>+*
    +...+
    *+</enterprise-beans>+*
    +...+
    The Application Assembler uses the ejb-link element to indicate that the EJB reference &ldquo;Empl-*
    Record&rdquo; declared in the EmployeeService enterprise bean has been linked to the EmployeeRecord*
    enterprise bean.</stro
    The following example illustrates using the ejb-link element to indicate an enterprise bean reference*
    to the ProductEJB enterprise bean that is in the same J2EE application unit but in a different ejb-jar*
    file.*
    *+<entity>+*
    +...+
    *+<ejb-name>OrderEJB</ejb-name>+*
    *+<ejb-class>com.wombat.orders.OrderBean</ejb-class>+*
    +...+
    *+<ejb-ref>+*
    *+<ejb-ref-name>ejb/Product</ejb-ref-name>+*
    *+<ejb-ref-type>Entity</ejb-ref-type>+*
    *+<home>com.acme.orders.ProductHome</home>+*
    *+<remote>com.acme.orders.Product</remote>+*
    *+<ejb-link>../products/product.jar#ProductEJB</ejb-link>+*
    *+</ejb-ref>+*
    +...+
    *+</entity>+*                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • EJB Handle return remote ref fails??

    Having a problem getting a remote reference on an EJB using a handle. Create a remote ref to an EJB and store three items and display said items - okay
    Get a handle to the remote ref and serialize and store - okay
    Deserialize - okay
    Cast to remote ref - NOT okay wants a home ref?
    This example is, by and large, similar to the example in section 6.8 of the EJB 2.0 Spec.
    Need to know why I cannot get the remote ref returned? Is there an OC4J issue? Please let me know when you can as would like to use this in a class.
    THANKS - Ken Cooper
    public class CartClient {
    public static void main(String[] args) {
    CartClient cartClient = new CartClient();
    try {
    Context context = getInitialContext();
    CartHome cartHome = (CartHome) PortableRemoteObject.narrow(context.lookup(
    "Cart"), CartHome.class);
    Cart cart;
    // Use one of the create() methods below to create a new instance
    cart = cartHome.create();
    // Call any of the Remote methods below to access the EJB
    // cart.getItems( );
    // cart.addItems( java.lang.String p );
    cart.addItems("Truck");
    cart.addItems("Car");
    cart.addItems("Boat");
    System.out.println(cart.getItems());
    // Serialize and store in C:\cartHandle
    Handle cartHandle = cart.getHandle();
    FileOutputStream out = new FileOutputStream("C:/cartHandle");
    ObjectOutputStream so = new ObjectOutputStream(out);
    so.writeObject(cartHandle);
    so.flush();
    System.out.println("Serialized");
    // Deserialize from C:\cartHandle
    FileInputStream in = new FileInputStream("C:/cartHandle");
    ObjectInputStream si = new ObjectInputStream(in);
    cartHandle = (Handle) si.readObject();
    System.out.println("DeSerialized");
    Cart cart2 = (Cart) PortableRemoteObject.narrow(cartHandle.getEJBObject(),
    Cart.class);
    System.out.println("Second: " + cart2.getItems());
    } catch (Throwable ex) {
    ex.printStackTrace();
    private static Context getInitialContext() throws NamingException {
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY,
    "com.evermind.server.rmi.RMIInitialContextFactory");
    env.put(Context.SECURITY_PRINCIPAL, "admin");
    env.put(Context.SECURITY_CREDENTIALS, "welcome");
    env.put(Context.PROVIDER_URL,
    "ormi://localhost:23891/current-workspace-app");
    return new InitialContext(env);
    OUTPUT AND ERROR FROM EXECUTION
    C:\JDev9031\jdk\bin\javaw.exe -ojvm -classpath C:\JDev9031\jdev\mywork\del15aug\Project4\classes;......
    Start: TruckCarBoat
    Serialized
    DeSerialized
    com.evermind.server.rmi.OrionRemoteException: Error looking up EJBHome at location 'Cart'
    javax.ejb.EJBObject com.evermind.server.ejb.StatefulSessionHandle.getEJBObject()
    StatefulSessionHandle.java:56
    void mypackage4.CartClient.main(java.lang.String[])
    CartClient.java:53 (NOTE: The highlighted line above is line 53)

    Thank you all guys for your suggests, and sorry for my (long) silence: i was at home with hard cough. I think that unfortunally the problem is more in deep. This because:
    1) at the beginnnig, in my (many) attempts I've tried to give the server url in a lot of ways:
    a) only the IP;
    b) http://<IP>;
    c) http://<IP>: <port>;
    d) http://<server-name>;
    e) http://<server-name>:<server-port>;
    b) iiop://<IP>;
    c) iiop://<IP>: <port>;
    d) iiop://<server-name>;
    e) iiop://<server-name>:<server-port>;
    In this cases, using init.put(org.omg.CORBA.ORBInitialHost,<param-value>) (init is Java Properties object), I didn't get what I would: always AppServer running on Win2000 responded me, instead of the one running on Linux.
    Using instead using init.put(Context.PROVIDER_URL,<param-value>) , in case a) I got the error message Root exception is java.net.MalformedURLException: no protocol:<IP-number>. In case b), c), d) and e) I got invalid url - connection refused error message (Invalid URL: http://gandalf.engiweb.com. Root exception is java.net.ConnectException: Connection refused: connect).
    A collegue of mine is using WebSphere and everything seems to work correctly. I'm afraid that there is a problem (of misconfiguration?) in the Borland Application Server. This is a problem, because, if I have (suppose) server gandalf running, with the correct EJB, and the server Saruman running too, but with the scorrect EJB, or the ejb container down, always respond me Saruman, not Gandalf: my tests gave me this result.
    At the moment I don't know what to do, except migrate to WebSphere, or another Application Server.
    Thank you a lot for your interest. Bye!

  • Named Parameters in Queries - the spec vs the Java EE 5 Tutorial

    Hi,
    I've been studying the topic about the named parameters in JPA and found one inconsistency between the spec and the Java EE 5 Tutorial. Could anyone lend me a helping hand understanding it?
    The Java Persistence API spec (ejb-3_0-fr-spec-persistence.pdf) 3.6.3 "Named Parameters" at page 69 reads:
    The use of named parameters applies to the Java Persistence query language, and is not defined for native queries.
    whereas the Java EE 5 Tutorial in the section Named Parameters in Queries (http://java.sun.com/javaee/5/docs/tutorial/doc/PersistenceIntro3.html#wp81563) of The EntityManager reads:
    Named parameters are case-sensitive, and may be used by both dynamic and static queries.
    I think that the reality is that every JPA provider supports named parameters in dynamic and static queries, but it's not fully supported by the spec (yet not forbidden).
    Jacek
    Jacek Laskowski
    http://www.jaceklaskowski.pl

    Hi Jacek,
    These are not conflicting statements. Named parameters apply to the Java Persistence
    Query language only, not to native queries. There are two ways to specifiy
    Java Persistence Query Language queries : dynamically and statically. You can
    either pre-define the query string using @NamedQuery
    static :
    @NamedQuery(name="findPersonByName",
    query="SELECT OBJECT(p) FROM Person p WHERE p.name LIKE :pName")
    OR, pass the query string in at runtime using EntityManger.createQuery
    dynamic :
    em.createQuery("SELECT OBJECT(p) FROM Person p WHERE p.name LIKE :pName")
    The dynamic approach allows you to construct portions of the query string at runtime.
    My example doesn't do that but the point is that use of the createQuery()
    API is considered the dynamic approach.
    The crux of the Java EE 5 Tutorial statement you referenced is that named parameters apply to
    both the static and dynamic use of Java Persistence Query Language queries.
    --ken                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Weblogic 8.1 SP2 does not support 'Order by' clause in EJB-QL

    It seems that Weblogic 8.1 SP2 does not support 'Order by' clause in EJB-QL. EJB 2.1 spec supports 'Order by' clause in EJB-QL. Am I right when I say that it indicates : "Weblogic 8.1 SP2 does not support EJB 2.1" ? In that case, what can be the alternative since I am using Weblogic 8.1 and I require 'Order by' clause in Ejb-QL as well.

    In WL 8.1 SP4 I can use the ORDERBY just fine.
    Try ORDERBY instead of Order by

  • EJB QL Sample errors in deploying

    I get following error when deploying ear file in oc4j10g. =>
    D:\oc4j10g\j2ee\home>java -jar admin.jar ormi://localhost:23791 admin welcome -d
    eploy -file d:\myj2ee\oc4jsamples\accounts\ejbql\build\ejbql.ear -deploymentName
    Ejbql
    Error: Deploy error: deploy failed!: ; nested exception is:
    oracle.oc4j.admin.internal.DeployerException: Error initializing ejb-mod
    ule, Exception: Missing method-params in query-method; see page 478 in ejb 2.0 s
    pec
    com.evermind.client.orion.AdminCommandException: Deploy error: deploy failed!: ;
    nested exception is:
    oracle.oc4j.admin.internal.DeployerException: Error initializing ejb-mod
    ule, Exception: Missing method-params in query-method; see page 478 in ejb 2.0 s
    pec
    at com.evermind.client.orion.DeployCommand.execute(DeployCommand.java:95
    at com.evermind.client.orion.Oc4jAdminConsole.executeCommand(Oc4jAdminCo
    nsole.java:117)
    at com.evermind.client.orion.Oc4jAdminConsole.main(Oc4jAdminConsole.java
    :26)
    java.rmi.RemoteException: deploy failed!: ; nested exception is:
    oracle.oc4j.admin.internal.DeployerException: Error initializing ejb-mod
    ule, Exception: Missing method-params in query-method; see page 478 in ejb 2.0 s
    pec
    at com.evermind.server.rmi.RMIConnection.EXCEPTION_ORIGINATES_FROM_THE_R
    EMOTE_SERVER(RMIConnection.java:1504)
    at com.evermind.server.rmi.RMIConnection.invokeMethod(RMIConnection.java
    :1456)
    at com.evermind.server.rmi.RemoteInvocationHandler.invoke(RemoteInvocati
    onHandler.java:55)
    at com.evermind.server.rmi.RecoverableRemoteInvocationHandler.invoke(Rec
    overableRemoteInvocationHandler.java:22)
    at __Proxy0.deploy(Unknown Source)
    at com.evermind.client.orion.DeployCommand.execute(DeployCommand.java:92
    at com.evermind.client.orion.Oc4jAdminConsole.executeCommand(Oc4jAdminCo
    nsole.java:117)
    at com.evermind.client.orion.Oc4jAdminConsole.main(Oc4jAdminConsole.java
    :26)
    Caused by: oracle.oc4j.admin.internal.DeployerException: Error initializing ejb-
    module, Exception: Missing method-params in query-method; see page 478 in ejb 2.
    0 spec
    at oracle.oc4j.admin.internal.DeployerBase.execute(DeployerBase.java:94)
    at com.evermind.server.administration.DefaultApplicationServerAdministra
    tor.internalDeploy(DefaultApplicationServerAdministrator.java:378)
    at com.evermind.server.administration.DefaultApplicationServerAdministra
    tor.deploy(DefaultApplicationServerAdministrator.java:278)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at com.evermind.server.rmi.RMICallHandler.run(RMICallHandler.java:140)
    at com.evermind.server.rmi.RMICallHandler.run(RMICallHandler.java:54)
    at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(Relea
    sableResourcePooledExecutor.java:199)
    at java.lang.Thread.run(Thread.java:534)
    ---- Embedded exception
    oracle.oc4j.admin.internal.DeployerException: Error initializing ejb-module, Exc
    eption: Missing method-params in query-method; see page 478 in ejb 2.0 spec
    at oracle.oc4j.admin.internal.DeployerBase.execute(DeployerBase.java:94)
    at com.evermind.server.administration.DefaultApplicationServerAdministra
    tor.internalDeploy(DefaultApplicationServerAdministrator.java:378)
    at com.evermind.server.administration.DefaultApplicationServerAdministra
    tor.deploy(DefaultApplicationServerAdministrator.java:278)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at com.evermind.server.rmi.RMICallHandler.run(RMICallHandler.java:140)
    at com.evermind.server.rmi.RMICallHandler.run(RMICallHandler.java:54)
    at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(Relea
    sableResourcePooledExecutor.java:199)
    at java.lang.Thread.run(Thread.java:534)
    ---- Embedded exception
    java.lang.InstantiationException: Error initializing ejb-module, Exception: Miss
    ing method-params in query-method; see page 478 in ejb 2.0 spec
    at com.evermind.server.ejb.EJBContainer.postInit(EJBContainer.java:1792)
    at com.evermind.server.Application.postInit(Application.java:635)
    at com.evermind.server.Application.setConfig(Application.java:206)
    at com.evermind.server.ApplicationServer.addApplication(ApplicationServe
    r.java:1654)
    at oracle.oc4j.admin.internal.ApplicationDeployer.addApplication(Applica
    tionDeployer.java:414)
    at oracle.oc4j.admin.internal.ApplicationDeployer.doDeploy(ApplicationDe
    ployer.java:132)
    at oracle.oc4j.admin.internal.DeployerBase.execute(DeployerBase.java:76)
    at com.evermind.server.administration.DefaultApplicationServerAdministra
    tor.internalDeploy(DefaultApplicationServerAdministrator.java:378)
    at com.evermind.server.administration.DefaultApplicationServerAdministra
    tor.deploy(DefaultApplicationServerAdministrator.java:278)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at com.evermind.server.rmi.RMICallHandler.run(RMICallHandler.java:140)
    at com.evermind.server.rmi.RMICallHandler.run(RMICallHandler.java:54)
    at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(Relea
    sableResourcePooledExecutor.java:199)
    at java.lang.Thread.run(Thread.java:534)
    ---- Embedded exception
    java.lang.InstantiationException: Error initializing ejb-module, Exception: Miss
    ing method-params in query-method; see page 478 in ejb 2.0 spec
    at com.evermind.server.ejb.EJBContainer.postInit(EJBContainer.java:1792)
    at com.evermind.server.Application.postInit(Application.java:635)
    at com.evermind.server.Application.setConfig(Application.java:206)
    at com.evermind.server.ApplicationServer.addApplication(ApplicationServe
    r.java:1654)
    at oracle.oc4j.admin.internal.ApplicationDeployer.addApplication(Applica
    tionDeployer.java:414)
    at oracle.oc4j.admin.internal.ApplicationDeployer.doDeploy(ApplicationDe
    ployer.java:132)
    at oracle.oc4j.admin.internal.DeployerBase.execute(DeployerBase.java:76)
    at com.evermind.server.administration.DefaultApplicationServerAdministra
    tor.internalDeploy(DefaultApplicationServerAdministrator.java:378)
    at com.evermind.server.administration.DefaultApplicationServerAdministra
    tor.deploy(DefaultApplicationServerAdministrator.java:278)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at com.evermind.server.rmi.RMICallHandler.run(RMICallHandler.java:140)
    at com.evermind.server.rmi.RMICallHandler.run(RMICallHandler.java:54)
    at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(Relea
    sableResourcePooledExecutor.java:199)
    at java.lang.Thread.run(Thread.java:534)
    D:\oc4j10g\j2ee\home>

    Hello Ravi,
    The EJB 2.0 specification has made it mandatory to have <method-params> tag within the ejb-jar.xml. Due to the absence of this tag, you are getting the error...
    Please modify ejb-jar.xml and add an empty <method-params></method-params> tag for the findByAllAccounts and ejbSelectByTopAccounts methods. For example,
    <query>
    <description>This query retrieves all the accounts</description>
    <query-method>
    <method-name>findByAllAccounts</method-name>
    <method-params></method-params>
    </query-method>
    <ejb-ql>select distinct object(ua) from UserAccount ua</ejb-ql>
    </query>
    Notice the empty <method-params> tag added. Please do the same for the ejbSelectByTopAccounts method.
    Another thing to be changed is the jsp:usebean tag in index.jsp and DisplayAccounts.jsp. In the mentioned files, replace jsp:usebean with jsp:useBean. Please notice the capital 'B'. JDK 1.4 has made this mandatory.
    Futher more, as you would be aware, 10G onwards, the CMP beans accesses the database tables through the Toplink. Toplink is the default persistence manager now. To use the orion-ejb-jar.xml, please start the OC4J with the following command
    java -Ddefault.cmp.pm=native_cmp -jar oc4j.jar
    I would like to point out that the sample works fine in OC4J 904 developers preview without any of the above mentioned changes. The sample application has been certified in that version.
    Thanks for pointing this problem out. We are making the necessary changes in the sample and the updated jar will be uploaded on OTN shortly.
    Hope this helps,
    Rajat

Maybe you are looking for