EJB 30 begginner question

I am trying to write a simple program to populate a table through entity beans using ejb30 with annotations. Being a begginner my question could be completely idiotic, please bear with me :)
I am using toplink as my persistence provider and i get this stracktrace
INFO: Hibernate EntityManager 3.3.1.GA
javax.persistence.PersistenceException: No Persistence provider for EntityManager named FormStorePersistenceService: Provider named oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider threw unexpected exception at create EntityManagerFactory:
oracle.toplink.essentials.exceptions.PersistenceUnitLoadingException
Local Exception Stack:
Exception [TOPLINK-30005] (Oracle TopLink Essentials - 2.0 (Build b58g-fcs (09/07/2007))): oracle.toplink.essentials.exceptions.PersistenceUnitLoadingException
Exception Description: An exception was thrown while searching for persistence archives with ClassLoader: sun.misc.Launcher$AppClassLoader@a39137
Internal Exception: java.lang.NullPointerException
     at oracle.toplink.essentials.exceptions.PersistenceUnitLoadingException.exceptionSearchingForPersistenceResources(PersistenceUnitLoadingException.java:143)
     at oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.createEntityManagerFactory(EntityManagerFactoryProvider.java:169)
     at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:110)
     at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:83)
     at com.spireline.fs.appserver.kernel.businessprocess.formsservice.FormStoreImplTest.testFormPersistenceService(FormStoreImplTest.java:39)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
     at java.lang.reflect.Method.invoke(Unknown Source)
     at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59)
     at org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98)
     at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79)
     at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:87)
     at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77)
     at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42)
     at org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88)
     at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
     at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
     at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
     at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
     at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
     at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
     at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: java.lang.NullPointerException
     at java.util.Hashtable.put(Unknown Source)
     at java.util.Properties.setProperty(Unknown Source)
     at oracle.toplink.essentials.internal.ejb.cmp3.xml.parser.PersistenceContentHandler.startElement(PersistenceContentHandler.java:111)
     at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(Unknown Source)
     at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(Unknown Source)
     at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
     at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
     at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
     at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
     at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
     at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
     at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
     at oracle.toplink.essentials.ejb.cmp3.persistence.PersistenceUnitProcessor.processPersistenceXML(PersistenceUnitProcessor.java:151)
     at oracle.toplink.essentials.ejb.cmp3.persistence.PersistenceUnitProcessor.processPersistenceArchive(PersistenceUnitProcessor.java:99)
     at oracle.toplink.essentials.ejb.cmp3.persistence.PersistenceUnitProcessor.getPersistenceUnits(PersistenceUnitProcessor.java:89)
     at oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.initPersistenceUnits(JavaSECMPInitializer.java:236)
     at oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.initialize(JavaSECMPInitializer.java:255)
     at oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.createEntityManagerFactory(EntityManagerFactoryProvider.java:155)
     ... 25 more
Provider named oracle.toplink.essentials.PersistenceProvider threw unexpected exception at create EntityManagerFactory:
oracle.toplink.essentials.exceptions.PersistenceUnitLoadingException
Local Exception Stack:
Exception [TOPLINK-30005] (Oracle TopLink Essentials - 2.0 (Build b58g-fcs (09/07/2007))): oracle.toplink.essentials.exceptions.PersistenceUnitLoadingException
Exception Description: An exception was thrown while searching for persistence archives with ClassLoader: sun.misc.Launcher$AppClassLoader@a39137
Internal Exception: java.lang.NullPointerException
     at oracle.toplink.essentials.exceptions.PersistenceUnitLoadingException.exceptionSearchingForPersistenceResources(PersistenceUnitLoadingException.java:143)
     at oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.createEntityManagerFactory(EntityManagerFactoryProvider.java:169)
     at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:110)
     at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:83)
     at com.spireline.fs.appserver.kernel.businessprocess.formsservice.FormStoreImplTest.testFormPersistenceService(FormStoreImplTest.java:39)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
     at java.lang.reflect.Method.invoke(Unknown Source)
     at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59)
     at org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98)
     at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79)
     at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:87)
     at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77)
     at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42)
     at org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88)
     at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
     at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
     at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
     at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
     at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
     at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
     at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: java.lang.NullPointerException
     at java.util.Hashtable.put(Unknown Source)
     at java.util.Properties.setProperty(Unknown Source)
     at oracle.toplink.essentials.internal.ejb.cmp3.xml.parser.PersistenceContentHandler.startElement(PersistenceContentHandler.java:111)
     at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(Unknown Source)
     at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(Unknown Source)
     at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
     at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
     at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
     at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
     at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
     at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
     at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
     at oracle.toplink.essentials.ejb.cmp3.persistence.PersistenceUnitProcessor.processPersistenceXML(PersistenceUnitProcessor.java:151)
     at oracle.toplink.essentials.ejb.cmp3.persistence.PersistenceUnitProcessor.processPersistenceArchive(PersistenceUnitProcessor.java:99)
     at oracle.toplink.essentials.ejb.cmp3.persistence.PersistenceUnitProcessor.getPersistenceUnits(PersistenceUnitProcessor.java:89)
     at oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.initPersistenceUnits(JavaSECMPInitializer.java:236)
     at oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.initialize(JavaSECMPInitializer.java:255)
     at oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.createEntityManagerFactory(EntityManagerFactoryProvider.java:155)
     ... 25 more
The following providers:
org.hibernate.ejb.HibernatePersistence
Returned null to createEntityManagerFactory.
     at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:154)
     at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:83)
     at com.spireline.fs.appserver.kernel.businessprocess.formsservice.FormStoreImplTest.testFormPersistenceService(FormStoreImplTest.java:39)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
     at java.lang.reflect.Method.invoke(Unknown Source)
     at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59)
     at org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98)
     at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79)
     at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:87)
     at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77)
     at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42)
     at org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88)
     at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
     at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
     at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
     at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
     at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
     at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
     at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
my persistence.xml is in the classes/META-INF directory("classes" directory is in the classpath).My persistence.xml is shown below.
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
     <persistence-unit name ="FormStorePersistenceService" transaction-type="RESOURCE_LOCAL">
          <class>com.spireline.fs.appserver.kernel.dao.publication.Publication</class>
          <provider>oracle.toplink.essentials.PersistenceProvider</provider>
          <properties>
     <property name="toplink.jdbc.driver">com.microsoft.sqlserver.jdbc.SQLServerDriver</property>
     <property name="toplink.jdbc.password">narsi40</property>
     <property name="toplink.jdbc.username">narsi40</property>
     <property name="toplink.jdbc.url">jdbc:sqlserver://testdb:1433;databaseName=narsi40</property>
     </properties>
     </persistence-unit>
</persistence>
It looks like the processes throws a nullpointerexception when it is parsing the above persistence.xml file and for the life of me i can't understand why !!!?
Also i am bit baffled that it is trying to look for hibernate classes as it does specifiy
*"org.hibernate.ejb.HibernatePersistence" as its provider, even though i have specified toplink as the provider in the persistence.xml. Can somebody explain what is happening here.*
Thanks in advance
Narsi

I have already tried to google smack it..with no luck of course. Will post this in the hibernate forum.
Thanks
Narsi

Similar Messages

  • EJB interview question

    dear friends
    if any body is having a real time ejb interview question , pl. send me a link for that.
    Thanks
    Gopal

    http://forum.java.sun.com/thread.jsp?thread=333894&forum=13&message=1363968

  • EJB Doubts/Questions - HELP

    Hi All,
    I am new to EJB technology and i am learning EJB without training canter. I am just going through Java EE tutorials available on www.oracle.com .
    My knowledge of EJB Session bean say:
    1.     Stateful Session Bean     : Maintains the client state.
    2.     Stateless Session Bean     : Does not maintain the client state.
    Now I am developing Shopping Cart Example using EJB, Servlet, JSP and HTML pages.
    My Project contains following pages:
    1.     login.html
    2.     AuthenticateServlet.java
    3.     User.jsp
    4.     PurchaseServlet
    5.     PurchaseSuccessful.jsp
    6.     AuthenticateBean – Stateful Session Bean
    7.     AutheticateBeanRemote – Remote Interface of Authenticate Bean
    8.     PurchaseBean – StatefulSession Bean
    9.     PurchaseBeanRemote -- Remote Interface of PurchaseBean
    Session Bean with its remote interface is maintained in the ejb package.
    Login.html contains;
    1.     textbox named “txtUser”
    2.     Password textbox named “txtPass”
    3.     Submit Button
    On submitting the credentials, it will check for the authentication in the AuthenticateServlet.
    AuthenticateBean contains
    public boolean authenticate(String user, String pwd)
         if(anylogic)
    return true;
         else
              return false;
    The above method is exposed in AuthenticateBeanRemote Interface.
    2. AuthenticateServlet contains
    I have done lookup of AuthenticateBeanRemote and have created abr. Below some important code of AuthenticateServlet;
    String user = request.getParamter("txtUser") ;
    String pwd = request.getParamter("txtPassr") ;
    boolean flag = abr.authenticate(user,pwd);
    if(flag)
         // then it will direct the control to User Page
    else
    out.println("Failure");
    User.jsp page will show me the UserID and some task that the authenticated user can do.
    My question: is while redirecting the page to User.jsp from AuthenticateServlet, do I need to do URLRewritting to maintain the session or do I need to create separate HTTPSession Object or does the Stateful session bean will take care of session management on its own. i.e. no need to do anything, just transfer or redirect to User.jsp page .
    User.jsp has purchase catalog of which the user will select products and click on purchase. On clicking purchase, it will take us to PurchaseServlet.
    My question Now in the PurchaseServlet if I have written the code to access the methods in PurchaseBean, Whether it will be a guarantee that the authernticated and currently logged in user is accessing the methods so that only that person’s purchased items are visible and no mishap will occur regarding the user integrity.
    PurchaseBean only contains the method to add the amount.
    My Question: if at the same time 2-3 users are logging in the application, then whether by using the statefulsession bean, user integrity is maintained. OR do I need to use some other approach.
    Please help me... I know these questions are silly but that’s the way the technology can be learned.

    user8687589 wrote:
    Please help me... I know these questions are silly but that’s the way the technology can be learned.You are SO wrong. You learn it by:
    a) reading and studying
    b) really understanding not only the technology but also the theory behind the technology
    c) learning how it works, why it works, when it works and when you should or shouldn't use it
    A common denominator here is that you apply thought, reason and intelligence to get not only the basics but the big picture. Don't learn how to use it: UNDERSTAND it. That does not include just demanding all the answers in a forum and expect to have the answers spoon-fed to you. First read and study, then we'll talk.

  • Read-mostly pattern & EJB-QL question when using Weblogic 8.1

    I want to use the same implementation of an CMP entity bean for the
    read-mostly pattern in BEA Weblogic 8.1 (means for the reader and the
    writer class).
    Therefore my ejb-jar.xml contains the following statements:
    <ejb-name>MyBeanReadOnly</ejb-name>
    <local-home>mypackage.MyBeanLocalHome</local-home>
    <ejb-name>MyBean</ejb-name>
    <local-home>mypackage.MyBeanLocalHome</local-home>
    The weblogic-ejb-jar.xml and weblogic-cmp-rdbms-jar.xml have the proper
    changes.
    I can deploy this bean & for the corresponding session bean binding
    and calling methods works for the (virtual) read-only and read-write
    entity beans.
    When we are using Xdoclet and ejb.finder methods e.g.
    @ejb.finder
    signature="java.util.Collection findAllValid(java.util.Date date)"
    result-type-mapping="Local"
    query="SELECT DISTINCT OBJECT(u) FROM MYTABLE AS u
    WHERE (?1 >= u.validFrom) AND ((u.validUntil IS NULL)
    OR (?1 <= u.validUntil))"
    the compilation and packaging runs well (as usual).
    During the deploy to Weblogic 8.1 we get errors, because the
    implementation of MyBeanReadOnly's findAllValid(...) should return
    objects of type MyBeanReadOnly instead of MyBean.
    Is there a way to solve this problem
    - and not write seperate reader and writer classes like
    the Weblogic 5.1 sample implementation?
    - and not use the CMP optimistic locking?
    Thanks for any further information.
    Wolfgang

    surya jeedigunta wrote:
    We are using Weblogic 8.1 SP2 and our Oracle Database is of version 9.2.0.5.
    I created user ID 'testa' in the database which owns all the objects.
    I created another userID 'testb' which has privileges to read, modify and delete data from tables owned by testa.
    I created public synonyms for all the objects owned by testa.
    I set the userid 'testb' and password in weblogic administrator window and set the same in reg.xml file also.
    Now when I tried to install the application, I got the following errors:
    BEGINNING INSTALLATION
    START INSTALLING FORMS SECTION
    Installing Form ./dataform/EventHistory.xml...<ErrorStack>
    <Error>
    <Code>FORM_045</Code>
    <Msg><![CDATA[ Form "Form" schema lacks some required columns:
    Field=ID column=ID does not exist in table=QSTForm
    Field=Name column=Name does not exist in table=QSTForm
    Field=Version column=Version does not exist in table=QSTForm
    Field=Content column=Content does not exist in table=QSTForm
    Field=LastModified column=LastModified does not exist in table=QSTForm ]]></Msg>
    </Error>
    <Error>
    <Code>FORM_7</Code>
    <Msg><![CDATA[ Failed to bind FDT columns, exception com.quovadx
    .bpms.core.CWException: (FORM_045) Form "Form" schema lacks some required column
    s:
    Field=ID column=ID does not exist in table=QSTForm
    Field=Name column=Name does not exist in table=QSTForm
    Field=Version column=Version does not exist in table=QSTForm
    Field=Content column=Content does not exist in table=QSTForm
    Field=LastModified column=LastModified does not exist in table=QSTForm ]]></Msg>
    </Error>
    My question is :
    does weblogic 8.1 works when I use public synonyms and user id other than the schema owner ID?
    I would appreciate if somebody could help me with this.
    Thank YouHi. I wish I could help you more, but so far, from what symptoms you've shown us,
    this is a purely internal Oracle issue to do with what your second user sees or
    can access. The fact that the user is logging in via JDBC or through WebLogic is
    irrelevant.
    Joe

  • EJB Classpath Question

    Hi,
    I have a burning question regarding EJBs and classpaths.
    Here is my situation:
    - My application uses EJBs, Servlets and JSP pages
    - My EJB remote interfaces and implementation classes extend common,
    abstract base classes
    - My EJB implementation classes use several utility classes, which are
    also used by my servlets.
    - Each EJB is deployed in a separate JAR file
    The question I have is which classes should be included in the EJB JAR
    files.
    I'd like to put just the EJB implementation class in the EJB JAR, and
    put everything else in a common JAR that is placed in my WEB-INF/lib
    folder and shared by the rest of the application. However, if I do
    that, Weblogic won't load the EJBs because it tries to do so before it
    deploys my web app, and hence before it adds the JARs in the
    WEB-INF/lib folder to its classpath.
    I can explicitly add my jar to the Weblogic classpath on the
    commandline (weblogic.class.path property). Now my EJBs load. However,
    my servlets become unable to load any classes from any jar in
    WEB-INF/lib. I read something about it being a bad idea to include a
    jar from WEB-INF/lib in the classpath, so I'm probably seeing that
    problem.
    The third option is to include all the dependent classes in my EJB
    jars themselves, in addition to deploying them in WEB-INF/lib. This
    works, but it bothers me that there are multiple copies of the same
    class files lying around.
    I'm sure I'm not the first developer who's written an EJB that shares
    classes with a servlet or JSP page. What's the proper way to do this?
    Thanks.

    Use a ClassPath entry in your EJB jar module MANIFEST.MF file
    Mark Cordobal
    [email protected] (Frank LaRosa) wrote:
    Hi,
    I have a burning question regarding EJBs and classpaths.
    Here is my situation:
    - My application uses EJBs, Servlets and JSP pages
    - My EJB remote interfaces and implementation classes extend common,
    abstract base classes
    - My EJB implementation classes use several utility classes, which are
    also used by my servlets.
    - Each EJB is deployed in a separate JAR file
    The question I have is which classes should be included in the EJB JAR
    files.
    I'd like to put just the EJB implementation class in the EJB JAR, and
    put everything else in a common JAR that is placed in my WEB-INF/lib
    folder and shared by the rest of the application. However, if I do
    that, Weblogic won't load the EJBs because it tries to do so before it
    deploys my web app, and hence before it adds the JARs in the
    WEB-INF/lib folder to its classpath.
    I can explicitly add my jar to the Weblogic classpath on the
    commandline (weblogic.class.path property). Now my EJBs load. However,
    my servlets become unable to load any classes from any jar in
    WEB-INF/lib. I read something about it being a bad idea to include a
    jar from WEB-INF/lib in the classpath, so I'm probably seeing that
    problem.
    The third option is to include all the dependent classes in my EJB
    jars themselves, in addition to deploying them in WEB-INF/lib. This
    works, but it bothers me that there are multiple copies of the same
    class files lying around.
    I'm sure I'm not the first developer who's written an EJB that shares
    classes with a servlet or JSP page. What's the proper way to do this?
    Thanks.

  • Weblogic 6.1 JMS/EJB Design Question

    Any thoughts from gurus or those who have skinned their knees on similar
    issues would be GREATLY appreciated!
    Environment:
    Weblogic 6.1 sp3/Oracle 8.1.7 on Solaris
    I've got a webservice that invokes the webservice ejb and then delegates
    down to business layer ejb that delegates down to data layer dao classes
    that store off on average 150 records which include a clob field containing
    about 4k of data. (All in one JTA transaction) (I'll refer to this as
    operation 1)
    There is a logically independent process (parsing the clob data elements)
    that I'd like to kick off after all 150 records have been stored. (Needs
    access to the committed data) (I'll refer to this as operation 2)
    Questions:
    1. Can a stateless session ejb running under a single phase JTS transaction
    safely post a message to a JMS topic or queue running on the same weblogic
    instance?
    2. If so, are there any guidelines as to whether the transaction for
    operation 1 will complete before the sender receives notification? (the
    concern being that operation 2 will be notified but the data it is
    interested in will not be visible yet) If no guarantees, would configuring
    a JMS message delivery delay help?
    3. This operation will get invoked perhaps a thousand times a day, and I'm
    fearful of falling into the message redelivery trap from transaction
    rollbacks which possibly could occur from operation 2. Above all else, I
    care about NOT having the queue get clogged up with resends. Given that
    bias, should I use NOTSUPPORTED then have the session bean that the MDB
    delegates to start a transaction or would using BMT from the MDB be more
    correct?
    4. Any other thoughts?
    Thanks!

    Alan May wrote:
    Any thoughts from gurus or those who have skinned their knees on similar
    issues would be GREATLY appreciated!
    Environment:
    Weblogic 6.1 sp3/Oracle 8.1.7 on Solaris
    I've got a webservice that invokes the webservice ejb and then delegates
    down to business layer ejb that delegates down to data layer dao classes
    that store off on average 150 records which include a clob field containing
    about 4k of data. (All in one JTA transaction) (I'll refer to this as
    operation 1)
    There is a logically independent process (parsing the clob data elements)
    that I'd like to kick off after all 150 records have been stored. (Needs
    access to the committed data) (I'll refer to this as operation 2)
    Questions:
    1. Can a stateless session ejb running under a single phase JTS transaction
    safely post a message to a JMS topic or queue running on the same weblogic
    instance?So is the first transaction going to be writing 150 records to the
    database and the publishing a JMS message? Yes, this can all be one in
    one transaction in WLS, but it will be a XA/2PC transaction. I'm
    curious why you specified single-phase?
    >
    2. If so, are there any guidelines as to whether the transaction for
    operation 1 will complete before the sender receives notification? (the
    concern being that operation 2 will be notified but the data it is
    interested in will not be visible yet) I'm not sure I follow you here. If the message publish is part of the
    transaction then no consumer will receive the message before the publish
    transaction commits.
    If no guarantees, would configuring a JMS message delivery delay help?
    3. This operation will get invoked perhaps a thousand times a day, and I'm
    fearful of falling into the message redelivery trap from transaction
    rollbacks which possibly could occur from operation 2. There's 2 important WLS JMS features I would suggest you look into:
    1) Message redelivery delay & limits
    2) Error destinations
    Take a look at
    http://e-docs.bea.com/wls/docs81/jms/implement.html#1255066
    Above all else, I
    care about NOT having the queue get clogged up with resends. Given that
    bias, should I use NOTSUPPORTED then have the session bean that the MDB
    delegates to start a transaction or would using BMT from the MDB be more
    correct?I think you'd be better off using redelivery limits and delay than
    trying to do the JMS acknowledgement and transaction management yourself.
    -- Rob
    >
    4. Any other thoughts?
    Thanks!

  • To EJB or Not to EJB (Design Question)

    Hello,
    New to EJB i am devlepoing a simple test App. Your suggestions will be very valuable.
    Test App..
    - Authenticate process
    - Search for Orders
    Our compnay policy forces that We must validate the sessionID (created internally) on every page call. Expected Client maybe Web srvices/servlet/JSP. Multiple users and heavy traffic expected.
    My Design...
    - Make Stateless Session EJBs for Authentication
    - Make Stateless Session EJBs for Orders search. Number of functions will be exposed for searching.
    Questions
    - Does it make sense to wrap all the SQL select calls in SESSION EJB? or should i call from JSP directly
    - IS SEESION EJB for authentication is the right choice
    - which is the best place for using Entity EJBs
    Regards
    H

    A good app. design would be as follows:
    Use three "Application Layers"
    1. PRESENTATION LAYER: this layer includes
    -JSP (only for view purposes!!!)
    -FrontController (Pattern usally implemented as Servlet for handling authentication/authorisation AND session handling!!!!!!)
    -ServiceDispatcher (Pattern for dispatching ;-))
    -BusinessDelegate (for encapsulation from the BUSINESS LAYER)
    2. BUSINESS LAYER: this layer includes
    -SessionFacade (usally Stateless Session Beans for your needs for example order!!!)
    3. PERSISTENCE LAYER: this layer includes
    -EntityBeans (CMP or BMP you must decide wich is better for your needs....I prefer BMP, it is more coding, but you are not dependent on app. server provider....CMP runs faster!!!!)
    -DataAccessObject (DAO--> here are your sql-statements and db-connections)
    For all Patterns here look at this side for more information
    http://java.sun.com/blueprints/corej2eepatterns/Patterns/
    TIP: Use the Session API for your session handling!!!!!!!!!!!!
    Regards
    howmad23

  • EJB QL question

    I have the following EJB QL query:
    SELECT object(ep) FROM Endpoint ep WHERE ep.sipAddress = :sipAddressWhen this was written sipAddress was a String ( with getter & setter) attribute within Endpoint.
    Now we have added a new Table called Address (since an endpoint can have more than one address). Endpoint class contains:
    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
    private Collection<Address> addresses = new ArrayList<Address>();
    public Collection<Address> getAddresses() {
              return addresses;
    }In my Address entity we have a boolean 'defaultValue' to determine if address is default.
    Question:
    How will my ejb ql change?
    //mike

    eraonel wrote:
    Question:
    How will my ejb ql change? that depends. what exactly do you want the query to do? find the endpoint with any matching address? find the endpoint with a "default" matching address?
    assuming you want the endpoint with any matching address, i'd go with the WHERE clause:
    :sipAddress MEMBER OF ep.sipAddress

  • EJB Architecture Question

    Hi everybody!
    As I am a newbie to EJB, but have to do a project with this technology, I have a basic question, that might seem very simple to the pros among you.
    I have to realise a system with an login at the beginning, but I am very unsure about how to realise this.
    I started by creating a table, holding the username and the password.
    Now I thaught about creating an enity bean, that checks if the user with the given password exists. Here is my first problem, entity beans only allow findbyPrimary() but i want to find a person by name and password. Is this possible? how?
    If the person exists in the DB i thaught about creating a new instance of an session bean, for the further transactions and pass the reference on to the user?
    Is this good?
    Please help!
    Thx in Advance!
    Stef

    You can certainly find a user via the name/password options. You need to implement a new finder for your entity bean - like findByUsernameAndPassword that accepts the 2 parms. The implementation is a little specific to the application server vendor, but it should be pretty easy to do regardless of the proprietary descriptors. Also, depending on the caching you're using on the enttity tier - using direct JDBC for along with entitiy beans can cause some issues. For example, you may have a specific instance of an entity bean that's cached in memory on the application server - they you change this using JDBC. The application server now has a stale version of the data - but it doesn't know that it's stale. Just some issues to consider.
    Cheers

  • EJB Sample Question

    Hi there,
    My questions here referred to WebLogic server 6.1 examples.ejb20.basic.statelessSession
    and I m yet not attended any J2EE classes yet.
    1. What does the method ejbPassivate() and setSessionContext(SessionContext ctx)
    invoked inside TraderBean class does? Since I can't find any codes called the setSessionContext
    that needs a input parameter?
    2. Under ejbCreate(), the line statd Integer tl = (Integer) ic.lookup("java:/comp/env/tradeLimit");,
    where do i get java:/comp/env/tradeLimit? Is that stated inside the ejb-jar.xml under
    the entry <env-entry>?
    3. Can explain what are the steps invoked inside the build.xml after compiling the
    class files?
    4. What does the weblogic-ejb-jar.xml does?
    Thanks
    Neo

    For 1 & 2 You need to read a EJB Book. There is a free one available at
    www.theserverside.com.
    for 4, look at
    http://e-docs.bea.com/wls/docs61/ejb/index.html
    "Neo Gigs" <[email protected]> wrote in message
    news:3cbe4ab1$[email protected]..
    >
    Hi there,
    My questions here referred to WebLogic server 6.1examples.ejb20.basic.statelessSession
    and I m yet not attended any J2EE classes yet.
    1. What does the method ejbPassivate() andsetSessionContext(SessionContext ctx)
    invoked inside TraderBean class does? Since I can't find any codes calledthe setSessionContext
    that needs a input parameter?
    2. Under ejbCreate(), the line statd Integer tl = (Integer)ic.lookup("java:/comp/env/tradeLimit");,
    where do i get java:/comp/env/tradeLimit? Is that stated inside theejb-jar.xml under
    the entry <env-entry>?
    3. Can explain what are the steps invoked inside the build.xml aftercompiling the
    class files?
    4. What does the weblogic-ejb-jar.xml does?
    Thanks
    Neo

  • EJB Newbie Question

    I am totally new to EJB and I have gone through Sun's tutorial at http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/GettingStarted.html and I've got everything in the tutorial working with the Sun J2EE server installed on my computer. They teach you how to write a bean and call it from a client application and from a .JSP page using the web server installed with J2EE on port 8080. Now, I want to call it from my ColdFusionMX page using the CFMX web server and I can't figure it out. Can anybody help me? I'm not sure what I need to do in CFMX to get the Java bean to work. I realize this is also a question for the ColdFusion community, but I'm sure connecting from ColdFusion is not very much different than from other languages.
    I created a very watered down ColdFusion version of the JSP page provided by Sun in the EJB tutorial. However, it looks like the JNDI lookup is not working for some reason. I think the problem is that I need to specify that the lookup will occur on my JNDI port, which is 10500 on my local host. It looks like it is trying to use a ColdFusion JNDI service that does not have the EJB installed or something like that. I would appreciate some code samples of how to get this to work. I can't find any good sites that give you a walk through of how this is supposed to work.
    Keep in mind this does work when I call the .JSP version of this page through the J2EE web server. The trick is for me to get this working in ColdFusion.
    Thanks everybody!
    Jon
    test.cfm
    <%@page import =
    "java.math.*,javax.naming.*,javax.rmi.PortableRemoteObject,java.rmi.RemoteEx
    ception,Converter,ConverterHome" %>
    <html>
    <head>
    <title>Converter</title>
    </head>
    <body bgcolor="white">
    <cfscript>
    initialContext = createObject("java", "javax.naming.InitialContext");
    ejbHome = initialContext.lookup("java:comp/env/ejb/TheConverter");
    </cfscript>
    I hope this page doesn't throw an error.
    </body>
    </html>
    page output
    Error Occurred While Processing Request
    No such binding: ejb
    The Error Occurred in C:\CFusionMX\wwwroot\test.cfm: line 51
    49 : initialContext = createObject("java", "javax.naming.InitialContext");
    50 :
    51 : ejbHome = initialContext.lookup("java:comp/env/ejb/TheConverter");

    It looks like it is
    trying to use a ColdFusion JNDI service that does not
    have the EJB installed or something like that. maybe... I am not familiar with CF.
    I would
    appreciate some code samples of how to get this to
    work. Install trial version of JRun 4.0, it has code samples how to call EJB from CF script.
    good luck
    Maris

  • EJB Specification question

    In the EJB Specs that I have been working with (1.1), whenever you make an entity bean, you have to specify the PK ID for the bean you wish to create. This ID goes into the database for the Server to be able to persist / find your bean. My question is:
    Why do I have to specify the PK ID when I create a bean? Why can't I just call ejbCreate() and have it return an ID to me? So the Server and the Database could handle making sure that it is not a duplicate key. I find it creates more work than necessary that I have to figure out what PK ID is not taken yet and create that one, when if I used an IDENTITY field in a database, that could easily do it for me.
    Anyone know why they chose to FORCE developers / (and Server admins not) to choose the PK ID? Why not give us the option of either having the server do it and return the ID, or us choosing it?
    Anyone have thoughts on this?
    Robert

    Hi,
    Although it would have been a lot easier, they
    propably didn't define this in the EJB specs this way
    to stay compatible with all databases. Not all
    databases support the IDENTITY field. I remember there
    were some interesting discussions about other ways to
    define a PK on www.theserverside.com.Yeah, but that's why they could give you a choice, so that if you didn't want to do it, or your db didn't support it, you wouldn't have to do that.

  • EJB library question

    Hi,
    I am new to EJB framework and I have a question.
    I want to access an EJB from another EJB. These two EJBs are in different EARs, and maybe on different servers. How can one accomplish this?
    Moreover, I want to create some wrapper classes for the first EJB in order to make the accessing process of the EJB easier.
    Is it good to create a new jar and pack this with the second EJB or to pack this with the client of the first EJB?
    I hope I have explained my question properly.
    Right now I saw that there is a section for Enterprise Java Beans. Sorry for this problem and an admin should move this thread in the right section.
    Edited by: mitroiasi on Dec 10, 2008 11:58 PM

    http://forum.java.sun.com/thread.jsp?thread=333894&forum=13&message=1363968

  • EJB Generator question

    I new to JDeveloper and I have question about the EJB Generator. I would like to generate EJBs for tables for a database for which I don't have access to the account who owns the tables. What I see in the wizard (EJBs from Tables - CMP) is only the few tables which are owned by the account I am using. I don't think the DBAs will give me their admin account. Is there another way to do this other than hand coding?
    The database is Sybase 12.5 and the JDBC Driver is jConnect 5.5. We are converting to Oracle 9i and I am researching strategies to do this. I'm not sure if my problem is platform related.
    Thanks,
    Jamie

    Jamie-
    We're adding this feature right now, so look for it in the forthcoming JDev 9.0.4 release.
    Users will be able to view accessible tables and views owned by all schemas, or filter out all but a specific schema (as we currently do, showing you only the objects owned by the default schema).
    Jon

  • Seemingly simple EJB-QL question

    I need to retrieve a single record matching two fields, call them jib and jab. The query is easy enough:
    <query>
      <query-method>
          <method-name>findMatchingRecord</method-name>
          <method-params>
         <method-param>java.lang.Integer</method-param>
            <method-param>java.lang.Integer</method-param>
          </method-params>
      </query-method>
      <ejb-ql>SELECT OBJECT(o) from MyTable o
              WHERE o.jib = ?1 AND o.jab = ?2
      </ejb-ql>
    </query>I know there will only be a single record, because I have a unique key constraint on jib and jab. However, jab can be null, and equality comparison doesn't work with nulls. I tried something like:
        WHERE (o.jib = ?1 AND o.jab = ?2) OR (o.jib = ?1 AND o.jab IS NULL AND ?2 IS NULL)Checking parameters with "IS NULL" apparently doesn't work though, even though it works in ordinary SQL. The only solution I can think of is to write two queries and force the application to decide which one to use. I'd appreciate any suggestions!
    We're using BEA WebLogic 8.1 and Oracle 9i.

    eraonel wrote:
    Question:
    How will my ejb ql change? that depends. what exactly do you want the query to do? find the endpoint with any matching address? find the endpoint with a "default" matching address?
    assuming you want the endpoint with any matching address, i'd go with the WHERE clause:
    :sipAddress MEMBER OF ep.sipAddress

Maybe you are looking for