12 Replies Latest reply on Feb 7, 2008 7:02 PM by Ariel Castro

    Two applications with two different persistence.xml in same OC4J of OAS

    Ariel Castro
      I am using jdev 10.1.3.3 and deploying in an mid tier OAS 10.1.3.3.
      I have develop two different applications (projects in jdev). Each one has its own persistence.xml file.. where i map de classes and the datasource is defined.
      The problem is when i deployed both of them in the same OC4J at de app server. The problem may be that de oc4j only takes de persistence.xml of the app that firs is run.... if i deploy them in separates oc4j they run ok. But i need them to run at the same oc4j.
      What am i doing wrong?. Is it possible to have this two ears each one with one persistence.xml file?.
      Please help.
      Ariel
        • 1. Re: Two applications with two different persistence.xml in same OC4J of OAS
          mkeith
          It is perfectly reasonable to want to have two separate applications, each of them having their own persistence.xml file. How are you deploying them, to an embedded OC4J from within JDev, from within JDev to an external instance of the server, or from outside of JDev to a standalone server?
          • 2. Re: Two applications with two different persistence.xml in same OC4J of OAS
            Ariel Castro
            Hi.. thanks for your answer.
            I am deploying them into a Oracle Application Server 10 g Versión 3 (10.1.3.3) through de Enterprise Manager (http://appserver:7780/em). I mean that i generate de ears files with de deploy profile in de jdeveloper 10.1.3.3 and then deploy those ears into the app server in the same OC4J instance.
            Any idea?
            Regards.
            Ariel
            • 3. Re: Two applications with two different persistence.xml in same OC4J of OAS
              mkeith
              What breaks? What leads you to the conclusion that only one of the two persistence.xml files is being read? Is there an exception? Does it look like they are both using the same one when they should be different?

              One thing you can do to narrow things down betwen dev and deploy is to check the ear files that are being generated and ensure that they have the files that you are expecting them to have.
              • 4. Re: Two applications with two different persistence.xml in same OC4J of OAS
                Ariel Castro
                I became with that conclusion because when i stop and start de OC4J from the EM the first application that i run is the one that works.. the other shows an exception. The exception that is showing is that it doesnt find de persistence unit XXX. If i put the same name of persistence unit in both persistence.xml files, the exception that it shows is that it doesnt find de XX descriptor class.. this is because the descriptors class that it finds are the ones that are defined in the first persistence.xml.
                I dont know if i am clear.. (sorry for my english).
                I checked the ears and they are right,... as i told you.. if i deploy them in differents OC4J they work fine.
                Regards,.
                Ariel
                • 5. Re: Two applications with two different persistence.xml in same OC4J of OAS
                  mkeith
                  Okay, maybe you can provide some more details, then, to help narrow down the problem.

                  - Are you using container-managed EntityManagers (injecting an EntityManager into a session bean) or the bootstrap API (calling Persistence.createEntityManagerFactory() method)?
                  - Are you specifying the persistence providers in the persistence.xml file(s)?
                  - How are the persistence.xml files deployed in each app? In the META-INF of an EJB jar, or in some other location?
                  - Is there a web archive being deployed and is the persistence unit accessed from somewhere within that archive? Which component is actually causing the deployment of the persistence unit?
                  - Posting the full stack trace would actually help a lot

                  PS The two applications wouldn't happen to have the same application names would they?
                  • 6. Re: Two applications with two different persistence.xml in same OC4J of OAS
                    Ariel Castro
                    Hi mkeith,
                    Here are the answers:
                    My persistence.xml file of one of the apps is this..

                    <?xml version="1.0" encoding="windows-1252" ?>
                    <persistence xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
                    version="1.0" xmlns="http://java.sun.com/xml/ns/persistence">
                    <persistence-unit name="consu2">
                    <non-jta-data-source>jdbc/dnevadaCoreDS</non-jta-data-source>
                    <class>consulta.model.Mcoam</class>
                    <class>consulta.model.Mcupon</class>
                    <class>consulta.model.Msaldo</class>
                    <class>consulta.model.Mtarje</class>
                    <properties>
                    <property name="toplink.logging.level" value="FINER"/>
                         <non-jta-data-source>jdbc/dnevadaCoreDS</non-jta-data-source>
                    </properties>
                    </persistence-unit>
                    </persistence>

                    and calling the pesistence like this in the facade...

                    private EntityManagerFactory emf = Persistence.createEntityManagerFactory("consu2");

                    Both of the persistence.xml files are in the META-INF directory of the model.

                    The applications doesn't have the same name.. nor the context root...

                    Regards.
                    Ariel.
                    • 7. Re: Two applications with two different persistence.xml in same OC4J of OAS
                      mkeith
                      I don't understand what you mean when you say that your persistence.xml file is in a META-INF dir of the model. Where is the model relative to the deployment packaging? (e.g. is it in an EJB JAR, or in the WEB-INF/classes dir of a WAR?)

                      Is your facade a session bean, then? You didn't post the stack trace or say from which components you are trying to access the EM.

                      Using the Persistence class within a container is actually more trouble (and takes more knowledge) than simply using container-managed EntityManagers because of classloaders. It has to do with where the persistence.xml is packaged and which classloader happens to be the current context loader when the file is being searched for. I would recommend using injection and the @PersistenceContext annotation to obtain the EntityManager within a container.

                      Also, having a non-jta-data-source element in the properties section of the persistence.xml file is not well-fomed according to the schema. You should remove that element from the <properties> section.
                      • 8. Re: Two applications with two different persistence.xml in same OC4J of OAS
                        Ariel Castro
                        Hi mkeith, sorry no to be enough clear.
                        The persistence.xml file is in the war created. (deploy.war\WEB-INF\classes\META-INF).

                        I have just deployect both app in the same OC4J in OAS 10.1.3.1 whit patch 10.1.3.3.
                        Started the OC4J instance, and run the app A. The app A runs perfect, and when i run app B this is the error that i get.:
                        Here is the stack trace of the exception that throws the the second application that is initialized.

                        08/01/23 18:49:54.959 consu: Servlet error

                        oracle.jbo.JboException: JBO-29000: Unexpected exception caught: javax.persistence.PersistenceException, msg=No Persistence provider
                        for EntityManager named consu2

                        at oracle.adf.model.generic.DataControlFactoryImpl.createSession(DataControlFactoryImpl.java:94)

                        at oracle.adf.model.binding.DCDataControlReference.getDataControl(DCDataControlReference.java:76)

                        at oracle.adf.model.BindingContext.get(BindingContext.java:457)

                        at oracle.adf.model.binding.DCUtil.findSpelObject(DCUtil.java:280)

                        at oracle.adf.model.binding.DCUtil.findSpelObject(DCUtil.java:248)

                        at oracle.adf.model.binding.DCUtil.findContextObject(DCUtil.java:383)

                        at oracle.adf.model.binding.DCIteratorBinding.<init>(DCIteratorBinding.java:127)

                        at oracle.jbo.uicli.binding.JUIteratorBinding.<init>(JUIteratorBinding.java:60)

                        at oracle.jbo.uicli.binding.JUMethodIteratorDef$JUMethodIteratorBinding.<init>(JUMethodIteratorDef.java:138)

                        at oracle.jbo.uicli.binding.JUMethodIteratorDef.createIterBinding(JUMethodIteratorDef.java:93)

                        at oracle.jbo.uicli.binding.JUMethodIteratorDef.createIterBinding(JUMethodIteratorDef.java:84)

                        at oracle.adf.model.binding.DCIteratorBindingDef.createExecutableBinding(DCIteratorBindingDef.java:277)

                        at oracle.adf.model.binding.DCBindingContainerDef.createExecutables(DCBindingContainerDef.java:296)

                        at oracle.adf.model.binding.DCBindingContainerDef.createBindingContainer(DCBindingContainerDef.java:425)

                        at oracle.adf.model.binding.DCBindingContainerReference.createBindingContainer(DCBindingContainerReference.java:54)

                        at oracle.adf.model.binding.DCBindingContainerReference.getBindingContainer(DCBindingContainerReference.java:44)

                        at oracle.adf.model.BindingContext.get(BindingContext.java:483)

                        at oracle.adf.model.BindingContext.findBindingContainer(BindingContext.java:313)

                        at oracle.adf.model.BindingContext.findBindingContainerByPath(BindingContext.java:633)

                        at oracle.adf.model.BindingRequestHandler.isPageViewable(BindingRequestHandler.java:265)

                        at oracle.adf.model.BindingRequestHandler.beginRequest(BindingRequestHandler.java:169)

                        at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:161)

                        at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher
                        .java:621)

                        at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher
                        .java:370)

                        at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler
                        .java:871)

                        at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].server.http.HttpRequestHandler.processRequest(HttpRequestHandler
                        .java:453)

                        at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].server.http.AJPRequestHandler.run(AJPRequestHandler.java:302)

                        at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].server.http.AJPRequestHandler.run(AJPRequestHandler.java:190)

                        at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)

                        at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:239)

                        at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:34)

                        at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:880)

                        at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor
                        .java:303)

                        at java.lang.Thread.run(Thread.java:595)

                        ## Detail 0 ##

                        javax.persistence.PersistenceException: No Persistence provider for EntityManager named consu2

                        at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:65)

                        at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:48)

                        at consulta.model.ServiceConsulta.$init$(ServiceConsulta.java:14)

                        at consulta.model.ServiceConsulta.<init>(ServiceConsulta.java:16)

                        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

                        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)

                        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)

                        at java.lang.reflect.Constructor.newInstance(Constructor.java:494)

                        at java.lang.Class.newInstance0(Class.java:350)

                        at java.lang.Class.newInstance(Class.java:303)

                        at oracle.adf.model.generic.DataControlFactoryImpl.createSession(DataControlFactoryImpl.java:86)

                        at oracle.adf.model.binding.DCDataControlReference.getDataControl(DCDataControlReference.java:76)

                        at oracle.adf.model.BindingContext.get(BindingContext.java:457)

                        at oracle.adf.model.binding.DCUtil.findSpelObject(DCUtil.java:280)

                        at oracle.adf.model.binding.DCUtil.findSpelObject(DCUtil.java:248)

                        at oracle.adf.model.binding.DCUtil.findContextObject(DCUtil.java:383)

                        at oracle.adf.model.binding.DCIteratorBinding.<init>(DCIteratorBinding.java:127)

                        at oracle.jbo.uicli.binding.JUIteratorBinding.<init>(JUIteratorBinding.java:60)

                        at oracle.jbo.uicli.binding.JUMethodIteratorDef$JUMethodIteratorBinding.<init>(JUMethodIteratorDef.java:138)

                        at oracle.jbo.uicli.binding.JUMethodIteratorDef.createIterBinding(JUMethodIteratorDef.java:93)

                        at oracle.jbo.uicli.binding.JUMethodIteratorDef.createIterBinding(JUMethodIteratorDef.java:84)

                        at oracle.adf.model.binding.DCIteratorBindingDef.createExecutableBinding(DCIteratorBindingDef.java:277)

                        at oracle.adf.model.binding.DCBindingContainerDef.createExecutables(DCBindingContainerDef.java:296)

                        at oracle.adf.model.binding.DCBindingContainerDef.createBindingContainer(DCBindingContainerDef.java:425)

                        at oracle.adf.model.binding.DCBindingContainerReference.createBindingContainer(DCBindingContainerReference.java:54)

                        at oracle.adf.model.binding.DCBindingContainerReference.getBindingContainer(DCBindingContainerReference.java:44)

                        at oracle.adf.model.BindingContext.get(BindingContext.java:483)

                        at oracle.adf.model.BindingContext.findBindingContainer(BindingContext.java:313)

                        at oracle.adf.model.BindingContext.findBindingContainerByPath(BindingContext.java:633)

                        at oracle.adf.model.BindingRequestHandler.isPageViewable(BindingRequestHandler.java:265)

                        at oracle.adf.model.BindingRequestHandler.beginRequest(BindingRequestHandler.java:169)

                        at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:161)

                        at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher
                        .java:621)

                        at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher
                        .java:370)

                        at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler
                        .java:871)

                        at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].server.http.HttpRequestHandler.processRequest(HttpRequestHandler
                        .java:453)

                        at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].server.http.AJPRequestHandler.run(AJPRequestHandler.java:302)

                        at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].server.http.AJPRequestHandler.run(AJPRequestHandler.java:190)

                        at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)

                        at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:239)

                        at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:34)

                        at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:880)

                        at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor
                        .java:303)

                        at java.lang.Thread.run(Thread.java:595)


                        Then i stopped th OC4J instance and started again, and run the app B. The app B runs pefect, and when i run app A this is the error that i get.:

                        The stack trace of the exception that throws the the second application that is initialized is the same as above.. but with the persistence.xml of the app A.
                        oracle.jbo.JboException: JBO-29000: Unexpected exception caught: javax.persistence.PersistenceException, msg=No Persistence provider
                        for EntityManager named Model-2 .


                        Here i paste both persistence.xml files.

                        app A
                        <?xml version="1.0" encoding="windows-1252" ?>
                        <persistence xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                        xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
                        version="1.0" xmlns="http://java.sun.com/xml/ns/persistence">
                        <persistence-unit name="Model-2">
                        <non-jta-data-source>jdbc/dnevadaCoreDS</non-jta-data-source>
                        <class>menu.model.Mhabilita</class>
                        <class>menu.model.Menu</class>
                        <properties>
                        <property name="toplink.logging.level" value="FINER"/>
                        <property name="toplink.session.customizer" value="menu.model.ToplinkSessionCustomizer"/>
                        </properties>
                        </persistence-unit>
                        </persistence>

                        app B
                        <?xml version="1.0" encoding="windows-1252" ?>
                        <persistence xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                        xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
                        version="1.0" xmlns="http://java.sun.com/xml/ns/persistence">
                        <persistence-unit name="consu2">
                        <non-jta-data-source>jdbc/dnevadaCoreDS</non-jta-data-source>
                        <class>consulta.model.Mcoam</class>
                        <class>consulta.model.Mcupon</class>
                        <class>consulta.model.Msaldo</class>
                        <class>consulta.model.Mtarje</class>
                        <properties>
                        <property name="toplink.logging.level" value="FINER"/>
                        <property name="toplink.session.customizer" value="consulta.model.ToplinkSessionCustomizer"/>
                        </properties>
                        </persistence-unit>
                        </persistence>


                        I try defining the same persistence-unit name at both persistence.xml files.. and the error that i get is that it doesnt find XXX class descriptor... it seems that the OC4J is loading the first persistence.xml file.. and uses that in both app. I dont know how i can define or configure the OC4J to use more than one persistence.xml file.... Thats why the apps works fine if i deploy them in differents OC4Js.


                        Here is the facade file that i am using.. i didnt undestand clearly what yuo suggested...

                        package menu.model;

                        import java.math.BigDecimal;

                        import java.util.List;


                        import java.util.Vector;

                        import javax.persistence.EntityManager;
                        import javax.persistence.EntityManagerFactory;
                        import javax.persistence.EntityTransaction;
                        import javax.persistence.Persistence;

                        import javax.persistence.Query;


                        public class JavaServiceFacade {
                        private EntityManagerFactory emf = Persistence.createEntityManagerFactory("Model-2");

                        public JavaServiceFacade() {
                        }

                        public static void main(String [] args) {
                        final JavaServiceFacade javaServiceFacade = new JavaServiceFacade();
                        // TODO: Call methods on javaServiceFacade here...
                        }

                        private EntityManager getEntityManager() {
                        return emf.createEntityManager();
                        }

                        public Object mergeEntity(Object entity) {
                        final EntityManager em = getEntityManager();
                        try {
                        final EntityTransaction et = em.getTransaction();
                        try {
                        et.begin();
                        em.merge(entity);
                        et.commit();
                        } finally {
                        if (et != null && et.isActive()) {
                        entity = null;
                        et.rollback();
                        }
                        }
                        } finally {
                        if (em != null && em.isOpen()) {
                        em.close();
                        }
                        }
                        return entity;
                        }

                        public Object refreshEntity(Object entity) {
                        final EntityManager em = getEntityManager();
                        try {
                        final EntityTransaction et = em.getTransaction();
                        try {
                        et.begin();
                        em.refresh(entity);
                        et.commit();
                        } finally {
                        if (et != null && et.isActive()) {
                        entity = null;
                        et.rollback();
                        }
                        }
                        } finally {
                        if (em != null && em.isOpen()) {
                        em.close();
                        }
                        }
                        return entity;
                        }



                        public Object persistEntity(Object entity) {
                        final EntityManager em = getEntityManager();
                        try {
                        final EntityTransaction et = em.getTransaction();
                        try {
                        et.begin();
                        em.persist(entity);
                        et.commit();
                        } finally {
                        if (et != null && et.isActive()) {
                        entity = null;
                        et.rollback();
                        }
                        }
                        } finally {
                        if (em != null && em.isOpen()) {
                        em.close();
                        }
                        }
                        return entity;
                        }

                        /** <code>select o from Menu o</code> */
                        public List<Menu> queryMenuFindAll() {
                        return getEntityManager().createNamedQuery("Menu.findAll").getResultList();
                        }

                        public List<Menu> queryMenuFindUser(String user) {

                        List<Menu> lista = null;

                        lista = getEntityManager().createNativeQuery(
                        "select * from menu " +
                        "where " +
                        "mnu_nom_prg in (select hab_nom_prg from mhabilita where hab_cod_usr = '"+ user.trim() +"' ) " +
                        "or mnu_tipo = 'C' order by mnu_tipo ,mnu_titulo , mnu_padre ", Menu.class).
                        getResultList();
                        return lista;
                        }

                        public void removeMenu(Menu menu) {
                        final EntityManager em = getEntityManager();
                        try {
                        final EntityTransaction et = em.getTransaction();
                        try {
                        et.begin();
                        Query query = em.createNamedQuery("Menu.removeMenu");
                        query.setParameter("mnuCodigo", menu.getMnuCodigo());
                        query.executeUpdate();
                        et.commit();
                        } finally {
                        if (et != null && et.isActive()) {
                        et.rollback();
                        }
                        }
                        } finally {
                        if (em != null && em.isOpen()) {
                        em.close();
                        }
                        }
                        }


                        public Menu menuConstructor(){
                        Menu menu = new Menu();
                        menu.setMnuTipo("P");
                        menu.setMnuOperacion("N");
                        menu.setMnuBloqueado("D");
                        return menu;
                        }

                        public long seqMenuNextval(){
                        long seqVal = 0;
                        try {
                        Vector a = (Vector)getEntityManager().createNativeQuery("select menu_seq.nextval from dual").getSingleResult();
                        BigDecimal aux = (BigDecimal)a.get(0);
                        seqVal = aux.longValue();
                        } catch(Exception ex){
                        System.out.println(ex.getMessage()); //99
                        }
                        return seqVal;

                        }

                        public Menu editarMenu(Menu menu){        
                        if (menu == null)
                        return new Menu();
                        else
                        return menu;
                        }

                        public void borrarMenus(List<String> lstCodigos){

                        if (lstCodigos != null && lstCodigos.size() != 0){
                        String codigos = "";
                        for (String codigo : lstCodigos){              
                        codigos += codigo + ",";
                        }
                        codigos = codigos.substring(0, (codigos.length() -1));
                        System.out.println(codigos);



                        final EntityManager em = getEntityManager();
                        try {
                        final EntityTransaction et = em.getTransaction();
                        try {
                        et.begin();
                        em.createNativeQuery("DELETE FROM MENU WHERE MNU_CODIGO IN ( " + codigos + ")").executeUpdate();
                        et.commit();
                        } finally {
                        if (et != null && et.isActive()) {
                        et.rollback();
                        }
                        }
                        } finally {
                        if (em != null && em.isOpen()) {
                        em.close();
                        }
                        }







                        }


                        }





                        }


                        Having the non-jta-data-source in the properties section was a "copy" mistake, in the persistence.xml file is correct. :-)

                        Ariel
                        Regards
                        • 9. Re: Two applications with two different persistence.xml in same OC4J of OAS
                          mkeith
                          Thanks for the info.

                          I think I have the full story now, but am still not able to see what the problem is. It could be a bug in the version of TopLink Essentials that got shipped in 10.1.3.3. I'm not sure which version got shipped but you might want to try replacing the toplink-essentials.jar with an updated version that you can download (V2 final build) from https://glassfish.dev.java.net/downloads/persistence/JavaPersistence.html. Try that one out and see if you still get the same behavior.
                          • 10. Re: Two applications with two different persistence.xml in same OC4J of OAS
                            Ariel Castro
                            Do you mean to add that jar in my libraries in the proyect and try again?... I have to rewrite the code of the app?.... o you are trying to tell me to replace the toplink.essencials libs that are in the app server?
                            • 11. Re: Two applications with two different persistence.xml in same OC4J of OAS
                              mkeith
                              Replace the one that was shipped with the app server.
                              • 12. Re: Two applications with two different persistence.xml in same OC4J of OAS
                                Ariel Castro
                                Hi Mkeith... i have updated de toplink essential jar in the applicatoin server and in the jdevelper.. but i am still getting an error. Here is the stack.

                                Texto del Log
                                08/02/07 16:20:44.328 10.1.3.1.0 Started

                                08/02/07 16:20:48.937 aplicacion2: 10.1.3.1.0 Started

                                08/02/07 16:50:04.671 aplicacion2: Servlet error

                                oracle.jbo.JboException: JBO-29000: null

                                at oracle.adf.model.generic.DataControlFactoryImpl.createSession(DataControlFactoryImpl.java:94)

                                at oracle.adf.model.binding.DCDataControlReference.getDataControl(DCDataControlReference.java:76)

                                at oracle.adf.model.BindingContext.get(BindingContext.java:457)

                                at oracle.adf.model.binding.DCUtil.findSpelObject(DCUtil.java:280)

                                at oracle.adf.model.binding.DCUtil.findSpelObject(DCUtil.java:248)

                                at oracle.adf.model.binding.DCUtil.findContextObject(DCUtil.java:383)

                                at oracle.adf.model.binding.DCIteratorBinding.<init>(DCIteratorBinding.java:128)

                                at oracle.jbo.uicli.binding.JUIteratorBinding.<init>(JUIteratorBinding.java:60)

                                at oracle.jbo.uicli.binding.JUMethodIteratorDef$JUMethodIteratorBinding.<init>(JUMethodIteratorDef.java:138)

                                at oracle.jbo.uicli.binding.JUMethodIteratorDef.createIterBinding(JUMethodIteratorDef.java:93)

                                at oracle.jbo.uicli.binding.JUMethodIteratorDef.createIterBinding(JUMethodIteratorDef.java:84)

                                at oracle.adf.model.binding.DCIteratorBindingDef.createExecutableBinding(DCIteratorBindingDef.java:277)

                                at oracle.adf.model.binding.DCBindingContainerDef.createExecutables(DCBindingContainerDef.java:296)

                                at oracle.adf.model.binding.DCBindingContainerDef.createBindingContainer(DCBindingContainerDef.java:425)

                                at oracle.adf.model.binding.DCBindingContainerReference.createBindingContainer(DCBindingContainerReference.java:54)

                                at oracle.adf.model.binding.DCBindingContainerReference.getBindingContainer(DCBindingContainerReference.java:44)

                                at oracle.adf.model.BindingContext.get(BindingContext.java:483)

                                at oracle.adf.model.BindingContext.findBindingContainer(BindingContext.java:313)

                                at oracle.adf.model.BindingContext.findBindingContainerByPath(BindingContext.java:633)

                                at oracle.adf.model.BindingRequestHandler.isPageViewable(BindingRequestHandler.java:265)

                                at oracle.adf.model.BindingRequestHandler.beginRequest(BindingRequestHandler.java:169)

                                at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:161)

                                at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher
                                .java:619)

                                at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher
                                .java:368)

                                at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler
                                .java:866)

                                at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.processRequest(HttpRequestHandler
                                .java:448)

                                at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.AJPRequestHandler.run(AJPRequestHandler.java:302)

                                at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.AJPRequestHandler.run(AJPRequestHandler.java:190)

                                at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)

                                at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor
                                .java:303)

                                at java.lang.Thread.run(Thread.java:595)

                                ## Detail 0 ##

                                java.lang.NullPointerException

                                at oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.createEntityManagerFactory(EntityManagerFactoryProvider.java
                                :120)

                                at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:59)

                                at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:48)

                                at prueba2.model.JavaServiceFacade.$init$(JavaServiceFacade.java:11)

                                at prueba2.model.JavaServiceFacade.<init>(JavaServiceFacade.java:13)

                                at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

                                at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)

                                at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)

                                at java.lang.reflect.Constructor.newInstance(Constructor.java:494)

                                at java.lang.Class.newInstance0(Class.java:350)

                                at java.lang.Class.newInstance(Class.java:303)

                                at oracle.adf.model.generic.DataControlFactoryImpl.createSession(DataControlFactoryImpl.java:86)

                                at oracle.adf.model.binding.DCDataControlReference.getDataControl(DCDataControlReference.java:76)

                                at oracle.adf.model.BindingContext.get(BindingContext.java:457)

                                at oracle.adf.model.binding.DCUtil.findSpelObject(DCUtil.java:280)

                                at oracle.adf.model.binding.DCUtil.findSpelObject(DCUtil.java:248)

                                at oracle.adf.model.binding.DCUtil.findContextObject(DCUtil.java:383)

                                at oracle.adf.model.binding.DCIteratorBinding.<init>(DCIteratorBinding.java:128)

                                at oracle.jbo.uicli.binding.JUIteratorBinding.<init>(JUIteratorBinding.java:60)

                                at oracle.jbo.uicli.binding.JUMethodIteratorDef$JUMethodIteratorBinding.<init>(JUMethodIteratorDef.java:138)

                                at oracle.jbo.uicli.binding.JUMethodIteratorDef.createIterBinding(JUMethodIteratorDef.java:93)

                                at oracle.jbo.uicli.binding.JUMethodIteratorDef.createIterBinding(JUMethodIteratorDef.java:84)

                                at oracle.adf.model.binding.DCIteratorBindingDef.createExecutableBinding(DCIteratorBindingDef.java:277)

                                at oracle.adf.model.binding.DCBindingContainerDef.createExecutables(DCBindingContainerDef.java:296)

                                at oracle.adf.model.binding.DCBindingContainerDef.createBindingContainer(DCBindingContainerDef.java:425)

                                at oracle.adf.model.binding.DCBindingContainerReference.createBindingContainer(DCBindingContainerReference.java:54)

                                at oracle.adf.model.binding.DCBindingContainerReference.getBindingContainer(DCBindingContainerReference.java:44)

                                at oracle.adf.model.BindingContext.get(BindingContext.java:483)

                                at oracle.adf.model.BindingContext.findBindingContainer(BindingContext.java:313)

                                at oracle.adf.model.BindingContext.findBindingContainerByPath(BindingContext.java:633)

                                at oracle.adf.model.BindingRequestHandler.isPageViewable(BindingRequestHandler.java:265)

                                at oracle.adf.model.BindingRequestHandler.beginRequest(BindingRequestHandler.java:169)

                                at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:161)

                                at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher
                                .java:619)

                                at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher
                                .java:368)

                                at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler
                                .java:866)

                                at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.processRequest(HttpRequestHandler
                                .java:448)

                                at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.AJPRequestHandler.run(AJPRequestHandler.java:302)

                                at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.AJPRequestHandler.run(AJPRequestHandler.java:190)

                                at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)

                                at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor
                                .java:303)

                                at java.lang.Thread.run(Thread.java:595)

                                Thanks.
                                Ariel