4 Replies Latest reply on Jan 11, 2008 3:44 PM by neilac333

    Datasource Issue in WebLogic 9.2

    neilac333 Novice

      My Seam-JPA application can't be deployed to WebLogic 9.2 because there is a JNDI error when trying to locate the datasource. I have set up a datasource in the Admin Console called java:/myWebAppDS. Then, in my persistence.xml I have this:

      <persistence-unit name="srmWebapp" transaction-type="JTA">
       <provider>org.hibernate.ejb.HibernatePersistence</provider>
       <jta-data-source>java:/myWebAppDS</jta-data-source>
       <properties>
       [Some stuff...]
       <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.WeblogicTransactionManagerLookup" />
       <property name="hibernate.transaction.factory_class" value="org.hibernate.transaction.CMTTransactionFactory" />
       [More stuff...]
       </properties>
      </persistence-unit>
      


      This seems right to me, but then I get this exception:

      javax.naming.NameNotFoundException: While trying to look up /myWebAppDS in /app/webapp/myProject.war/3153055.; remaining name '/myWebAppDS'
       at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:1139)
       at weblogic.jndi.internal.ApplicationNamingNode.lookup(ApplicationNamingNode.java:142)
       at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.java:269)
       at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:362)
       at weblogic.jndi.factories.java.ReadOnlyContextWrapper.lookup(ReadOnlyContextWrapper.java:45)
       at weblogic.jndi.internal.AbstractURLContext.lookup(AbstractURLContext.java:130)
       at javax.naming.InitialContext.lookup(InitialContext.java:351)
       at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:52)
       at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:124)
       at org.hibernate.ejb.InjectionSettingsFactory.createConnectionProvider(InjectionSettingsFactory.java:29)
       at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:62)
       at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2009)
       at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1292)
       at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:915)
       at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:730)
       at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:121)
       at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:83)
       at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:60)
       at org.jboss.seam.persistence.EntityManagerFactory.createEntityManagerFactory(EntityManagerFactory.java:81)
       at org.jboss.seam.persistence.EntityManagerFactory.startup(EntityManagerFactory.java:50)
       at jrockit.reflect.VirtualNativeMethodInvoker.invoke(Ljava.lang.Object;[Ljava.lang.Object;)Ljava.lang.Object;(Unknown Source)
       at java.lang.reflect.Method.invoke(Ljava.lang.Object;[Ljava.lang.Object;I)Ljava.lang.Object;(Unknown Source)
       at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
      
      


      I cannot figure out what the issue is, so any insight is appreciated.

      Thanks.

        • 1. Re: Datasource Issue in WebLogic 9.2
          Jay Balunas Master

          I have not worked with Weblogic 92 ( I've worked on 10), but from what I can see try not having "java:/" in the JNDI. JBoss prepends the "java;/" and I do not think that weblogic supports it.

          I just checked in resources and reference guide chapter on deploying to Weblogic 10 which might also provide some help.

          • 2. Re: Datasource Issue in WebLogic 9.2
            neilac333 Novice

            So I made some changes to my WAR file:

            Added weblogic.jar to my WAR and these properties to persistence.xml

            <property name="jndi.url" value="t3://localhost:7001"/>
            <property name="jndi.class" value="weblogic.jndi.WLInitialContextFactory"/>
            


            Changed the datasource in the Admin Console to the name myWebAppDS and made the change in persistence.xml to the following:

            <jta-data-source>myWebAppDS</jta-data-source>
            


            Sadly, I am getting the same error.

            I will keep looking into WebLogic and how it handles JNDI.

            Thanks for your help and any more insight you may have.

            Neil



            • 3. Re: Datasource Issue in WebLogic 9.2
              Jay Balunas Master

              I'm curious why you added the weblogic.jar to you WAR and changed the properties? I'm just not familiar with that change.

              The other change looks right.

              Have you looked at the seam jpa example? It has specific resource files and build scripts for weblogic 92, and 10 (weblogic 10 is only in cvs + a new reference guide chapter on weblogic 10).

              • 4. Re: Datasource Issue in WebLogic 9.2
                neilac333 Novice

                Those initial changes were based on this: http://forum.hibernate.org/viewtopic.php?p=2215254&sid=28f8e2bcf55c7278f196fbb17aa1bec5. Granted, the WL version in that post was 8.1, and I am on 9.2. Still, I figured why not give those a shot.

                As for the Seam JPA example, I used it as a model for my configuration. Since all this happened, I tried to deploy it. I got this error:

                 An error occurred during activation of changes, please see the log for details.
                 Message icon - Error [HTTP:101064][WebAppModule(jboss-seam-jpa:jboss-seam-jpa.war)] Error parsing descriptor in Web appplication "D:\bea_dev\domains\domain_dev\jboss-seam-jpa.war" weblogic.application.ModuleException: Unmarshaller failed at weblogic.servlet.internal.WebAppModule.loadDescriptor(WebAppModule.java:781) at weblogic.servlet.internal.WebAppModule.prepare(WebAppModule.java:272) at weblogic.application.internal.flow.ScopedModuleDriver.prepare(ScopedModuleDriver.java:176) at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:93) at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:360) at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26) at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:56) at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:46) at weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:615) at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26) at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:191) at weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:147) at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:61) at weblogic.deploy.internal.targetserver.operations.ActivateOperation.createAndPrepareContainer(ActivateOperation.java:189) at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doPrepare(ActivateOperation.java:87) at weblogic.deploy.internal.targetserver.operations.AbstractOperation.prepare(AbstractOperation.java:217) at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentPrepare(DeploymentManager.java:718) at weblogic.deploy.internal.targetserver.DeploymentManager.prepareDeploymentList(DeploymentManager.java:1185) at weblogic.deploy.internal.targetserver.DeploymentManager.handlePrepare(DeploymentManager.java:247) at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.prepare(DeploymentServiceDispatcher.java:157) at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doPrepareCallback(DeploymentReceiverCallbackDeliverer.java:157) at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$000(DeploymentReceiverCallbackDeliverer.java:12) at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$1.run(DeploymentReceiverCallbackDeliverer.java:45) at weblogic.work.ServerWorkManagerImpl$WorkAdapterImpl.run(ServerWorkManagerImpl.java:518) at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209) at weblogic.work.ExecuteThread.run(ExecuteThread.java:181) Caused by: com.bea.xml.XmlException: failed to load java type corresponding to e=web-app@http://java.sun.com/xml/ns/javaee at com.bea.staxb.runtime.internal.UnmarshalResult.getPojoBindingType(UnmarshalResult.java:325) at com.bea.staxb.runtime.internal.UnmarshalResult.determineTypeForGlobalElement(UnmarshalResult.java:292) at com.bea.staxb.runtime.internal.UnmarshalResult.determineTypeForGlobalElement(UnmarshalResult.java:302) at com.bea.staxb.runtime.internal.UnmarshalResult.determineRootType(UnmarshalResult.java:283) at com.bea.staxb.runtime.internal.UnmarshalResult.unmarshalDocument(UnmarshalResult.java:153) at com.bea.staxb.runtime.internal.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:65) at weblogic.descriptor.internal.MarshallerFactory$1.createDescriptor(MarshallerFactory.java:136) at weblogic.descriptor.DescriptorManager.createDescriptor(DescriptorManager.java:280) at weblogic.descriptor.DescriptorManager.createDescriptor(DescriptorManager.java:248) at weblogic.application.descriptor.AbstractDescriptorLoader2.getDescriptorBeanFromReader(AbstractDescriptorLoader2.java:749) at weblogic.application.descriptor.AbstractDescriptorLoader2.createDescriptorBean(AbstractDescriptorLoader2.java:378) at weblogic.application.descriptor.AbstractDescriptorLoader2.loadDescriptorBeanWithoutPlan(AbstractDescriptorLoader2.java:720) at weblogic.application.descriptor.AbstractDescriptorLoader2.loadDescriptorBean(AbstractDescriptorLoader2.java:729) at weblogic.servlet.internal.WebAppDescriptor.getWebAppBean(WebAppDescriptor.java:134) at weblogic.servlet.internal.WebAppModule.loadDescriptor(WebAppModule.java:775) at weblogic.servlet.internal.WebAppModule.prepare(WebAppModule.java:272) at weblogic.application.internal.flow.ScopedModuleDriver.prepare(ScopedModuleDriver.java:176) at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:93) at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:360) at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26) at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:56) at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:46) at weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:615) at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26) at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:191) at weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:147) at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:61) at weblogic.deploy.internal.targetserver.operations.ActivateOperation.createAndPrepareContainer(ActivateOperation.java:189) at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doPrepare(ActivateOperation.java:87) at weblogic.deploy.internal.targetserver.operations.AbstractOperation.prepare(AbstractOperation.java:217) at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentPrepare(DeploymentManager.java:718) at weblogic.deploy.internal.targetserver.DeploymentManager.prepareDeploymentList(DeploymentManager.java:1185) weblogic.application.ModuleException: Unmarshaller failed
                 Message icon - Error failed to load java type corresponding to e=web-app@http://java.sun.com/xml/ns/javaee
                


                The thing at the bottom seems to be the only useful thing there. But anyway, that wasn't a lot of help.

                So I am still searching...

                Thanks.