2 Replies Latest reply on Sep 14, 2009 12:21 PM by hamid

    EntityManager is null in Weblogic 10.3

    hsiung

      my settings are
      - JBossTools 3
      - Weblogic 10.3
      - Seam 2.1.1
      - 1 EJB 3 Entity Bean WebService
      - 1 generated WebServiceHome and 1 webService.xhtml
      When I try to access webService.seam,
      I get an IllegalStateException: entityManager is null


      How can I configure Weblogic server 10.3 entityManager?


      persistence.xml:


      <?xml version="1.0" encoding="UTF-8"?>
      <!-- Persistence deployment descriptor for dev profile -->
      <persistence xmlns="http://java.sun.com/xml/ns/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">
                   
         <persistence-unit name="wsRepository">
            <provider>org.hibernate.ejb.HibernatePersistence</provider>
            <jta-data-source>seam-jee5-ds</jta-data-source>
            <properties>
               <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
               <property name="hibernate.hbm2ddl.auto" value="update"/>
               <property name="hibernate.show_sql" value="true"/>
               <property name="hibernate.format_sql" value="true"/>
               <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.WeblogicTransactionManagerLookup"/>
               <!-- property name="jboss.entity.manager.factory.jndi.name" value="java:/wsRepositoryEntityManagerFactory"/-->
            </properties>
         </persistence-unit>
          
      </persistence>
      



      components.xml:


      ?xml version="1.0" encoding="UTF-8"?>
      <components xmlns="http://jboss.com/products/seam/components"
                  xmlns:core="http://jboss.com/products/seam/core"
                  xmlns:persistence="http://jboss.com/products/seam/persistence"
                  xmlns:transaction="http://jboss.com/products/seam/transaction"
                  xmlns:drools="http://jboss.com/products/seam/drools"
                  xmlns:bpm="http://jboss.com/products/seam/bpm"
                  xmlns:security="http://jboss.com/products/seam/security"
                  xmlns:mail="http://jboss.com/products/seam/mail"
                  xmlns:web="http://jboss.com/products/seam/web"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation=
                      "http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.1.xsd
                       http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.1.xsd
                       http://jboss.com/products/seam/transaction http://jboss.com/products/seam/transaction-2.1.xsd
                       http://jboss.com/products/seam/drools http://jboss.com/products/seam/drools-2.1.xsd
                       http://jboss.com/products/seam/bpm http://jboss.com/products/seam/bpm-2.1.xsd
                       http://jboss.com/products/seam/security http://jboss.com/products/seam/security-2.1.xsd
                       http://jboss.com/products/seam/mail http://jboss.com/products/seam/mail-2.1.xsd
                       http://jboss.com/products/seam/web http://jboss.com/products/seam/web-2.1.xsd
                       http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.1.xsd">
      
         <core:init debug="true" jndi-pattern="@jndiPattern@"/>
      
         <core:manager concurrent-request-timeout="500"
                       conversation-timeout="120000"
                       conversation-id-parameter="cid"
                       parent-conversation-id-parameter="pid"/>
      
         <web:hot-deploy-filter url-pattern="*.seam"/>
                           
         <!--persistence:managed-persistence-context name="entityManager"
                                           auto-create="true"
                            persistence-unit-jndi-name="java:/wsRepositoryEntityManagerFactory"/-->
      
         <drools:rule-base name="securityRules">
            <drools:rule-files>
               <value>/security.drl</value>
            </drools:rule-files>
         </drools:rule-base>
      
         <security:rule-based-permission-resolver security-rules="#{securityRules}"/>
      
         <security:identity authenticate-method="#{authenticator.authenticate}" remember-me="true"/>
      
         <event type="org.jboss.seam.security.notLoggedIn">
            <action execute="#{redirect.captureCurrentView}"/>
         </event>
         <event type="org.jboss.seam.security.loginSuccessful">
            <action execute="#{redirect.returnToCapturedView}"/>
         </event>
      
         <mail:mail-session host="localhost" port="2525" username="test" password="test" />
      
         <!-- For use with jBPM pageflow or process management -->
         <!--
         <bpm:jbpm>
            <bpm:process-definitions></bpm:process-definitions>
            <bpm:pageflow-definitions></bpm:pageflow-definitions>
         </bpm:jbpm>
         -->
      
      </components>
      



      Another exception coming up is:


      <05.04.2009 22.24 Uhr CEST> <Warning> <HTTP> <BEA-101162> <User defined listener org.jboss.seam.servlet.SeamListener failed: org.jboss.seam.InstantiationException: Could not instantiate Seam component: org.jboss.seam.security.ruleBasedPermissionResolver.
      org.jboss.seam.InstantiationException: Could not instantiate Seam component: org.jboss.seam.security.ruleBasedPermissionResolver
           at org.jboss.seam.Component.newInstance(Component.java:2106)
           at org.jboss.seam.contexts.Contexts.startup(Contexts.java:304)
           at org.jboss.seam.contexts.Contexts.startup(Contexts.java:278)
           at org.jboss.seam.contexts.Lifecycle.beginSession(Lifecycle.java:209)
           at org.jboss.seam.contexts.ServletLifecycle.beginSession(ServletLifecycle.java:141)
           Truncated. see log file for complete stacktrace
      org.jboss.seam.InstantiationException: Could not instantiate Seam component: securityRules
           at org.jboss.seam.Component.newInstance(Component.java:2106)
           at org.jboss.seam.Component.getInstance(Component.java:1988)
           at org.jboss.seam.Component.getInstance(Component.java:1950)
           at org.jboss.seam.Component.getInstance(Component.java:1944)
           at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:55)
           Truncated. see log file for complete stacktrace
      org.drools.RuntimeDroolsException: Unable to load dialect 'org.drools.rule.builder.dialect.java.JavaDialectConfiguration:java'
           at org.drools.compiler.PackageBuilderConfiguration.addDialect(PackageBuilderConfiguration.java:152)
           at org.drools.compiler.PackageBuilderConfiguration.buildDialectConfigurationMap(PackageBuilderConfiguration.java:140)
           at org.drools.compiler.PackageBuilderConfiguration.init(PackageBuilderConfiguration.java:117)
           at org.drools.compiler.PackageBuilderConfiguration.<init>(PackageBuilderConfiguration.java:94)
           at org.jboss.seam.drools.RuleBase.compileRuleBase(RuleBase.java:40)
           Truncated. see log file for complete stacktrace
      java.lang.RuntimeException: The Eclipse JDT Core jar is not in the classpath
           at org.drools.rule.builder.dialect.java.JavaDialectConfiguration.setCompiler(JavaDialectConfiguration.java:93)
           at org.drools.rule.builder.dialect.java.JavaDialectConfiguration.init(JavaDialectConfiguration.java:54)
           at org.drools.compiler.PackageBuilderConfiguration.addDialect(PackageBuilderConfiguration.java:148)
           at org.drools.compiler.PackageBuilderConfiguration.buildDialectConfigurationMap(PackageBuilderConfiguration.java:140)
           at org.drools.compiler.PackageBuilderConfiguration.init(PackageBuilderConfiguration.java:117)
           Truncated. see log file for complete stacktrace
      > 



      Any ideas?

        • 1. Re: EntityManager is null in Weblogic 10.3
          hsiung

          I found a solution to configure EntityManager in Weblogic 10.3:


          in components.xml:


             <persistence:managed-persistence-context name="entityManager"
             auto-create="true"
             entity-manager-factory="#{wsRepositoryEntityManagerFactory}"/>
          
             <persistence:entity-manager-factory name="wsRepositoryEntityManagerFactory"
             persistence-unit-name="wsRepository"/>
          



          and a workaround for the The Eclipse JDT Core jar is not in the classpath exception:


          remove the drools:rule-base in components.xml:


             <!-- drools:rule-base name="securityRules">
                <drools:rule-files>
                   <value>/security.drl</value>
                </drools:rule-files>
             </drools:rule-base-->
          



          But is it the correct way?

          • 2. Re: EntityManager is null in Weblogic 10.3
            hamid

            Hi Alain,


            I am able to run the seamgen generated code on Weblogic. However, as soon as I try to annotate an entity class with @Webservice annotation I get the error No business interface, component interface or web service endpoint interface found for Session Bean.


            Could you please provide me with you sample webservice code that is running on weblogic?


            Thanks and Regards,
            Hamid