2 Replies Latest reply on Dec 14, 2010 8:24 AM by mimik789

    Seam-Persistence on Glassfish 3.0.1

    James Williams Newbie

      Bit of a long one here. I've been reading trying to solve this one for a few days now. Thankfully not my day job!


      After adding Seam Persistence to a basic CDI and JSF project running on Glassfish 3.0.1 I received a very oblique error.




      Caused by: org.jboss.weld.exceptions.DefinitionException: Exception #0 :null
              at org.jboss.weld.bootstrap.events.AbstractDefinitionContainerEvent.fire(AbstractDefinitionContainerEvent.java:45)
              at org.jboss.weld.bootstrap.events.ProcessAnnotatedTypeImpl.fire(ProcessAnnotatedTypeImpl.java:44)
              at org.jboss.weld.bootstrap.BeanDeployer.addClass(BeanDeployer.java:61)
              at org.jboss.weld.bootstrap.BeanDeployer.addClasses(BeanDeployer.java:88)
              at org.jboss.weld.bootstrap.BeanDeployment.deployBeans(BeanDeployment.java:134)
              at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:377)
              at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:165)
              ... 30 more





      After further investigation I found the cause is




      FINER: loadClass(org.jboss.logging.MessageLogger) FINER: Delegating to classloader1 org.glassfish.internal.api.DelegatingClassLoader@6f9240a4 FINER: Searching local repositories FINER: findClass(org.jboss.logging.MessageLogger) FINER: findClassInternal(org.jboss.logging.MessageLogger) FINER: --> Passing on ClassNotFoundException SEVERE: Exception while loading the app org.glassfish.deployment.common.DeploymentException: Exception #0 :null at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:167) at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:125)





      It seems that the MessageLogger class is missing. I did some further searching and added



      <dependency>
                  <groupId>org.jboss.slf4j</groupId>
                  <artifactId>slf4j-jboss-logging</artifactId>
                  <version>1.0.2.GA</version>
              </dependency>
              <dependency>
                  <groupId>org.jboss.logging</groupId>
                  <artifactId>jboss-logging</artifactId>
                  <version>3.0.0.Beta4</version>
              </dependency>




      to my pom file.


      This resolved the missing class but now the LogFactory.getLogger method is throwing a NPE.



      Caused by: java.lang.NullPointerException at
      org.apache.log4j.LogManager.getLogger(LogManager.java:188) at 
      org.apache.log4j.Logger.getLogger(Logger.java:104) at 
      org.jboss.logging.Log4jLogger.(Log4jLogger.java:35) at 
      org.jboss.logging.Log4jLoggerProvider.getLogger(Log4jLoggerProvider.java:33) at 
      org.jboss.logging.Logger.getLogger(Logger.java:2164) at 
      org.jboss.slf4j.JBossLoggerFactory.getLogger(JBossLoggerFactory.java:66) at 
      org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:246) at 
      org.hibernate.search.util.LoggerFactory.make(LoggerFactory.java:38) at 
      org.hibernate.search.store.FSDirectoryProvider.(FSDirectoryProvider.java:55)



      I'm now having trouble configuring log4j on Glassfish. I'm not asking for help on configuring Glassfish, but rather why the dependencies appear to be missing. Also is it possible to decouple the extensions from log4j and use the default logging in Glassfish? I know this is via jboss-logging so not trivial.


      This is completely blocking my ability to use the seam extensions on Glassfish!


      Please see below the dependency tree of my project.



      [INFO] com.mycompany:web:war:1.0-SNAPSHOT
      [INFO] +- com.mycompany:mycompany-data-access:jar:1.0-SNAPSHOT:compile
      [INFO] |  +- org.hibernate:hibernate-search:jar:3.2.1.Final:compile
      [INFO] |  |  +- org.hibernate:hibernate-commons-annotations:jar:3.2.0.Final:compile
      [INFO] |  |  +- org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.0.Final:compile
      [INFO] |  |  +- org.apache.lucene:lucene-core:jar:2.9.3:compile
      [INFO] |  |  +- org.apache.solr:solr-core:jar:1.4.0:compile
      [INFO] |  |  |  +- org.apache.solr:solr-solrj:jar:1.4.0:compile
      [INFO] |  |  |  +- commons-codec:commons-codec:jar:1.3:compile
      [INFO] |  |  |  \- commons-io:commons-io:jar:1.4:compile
      [INFO] |  |  +- org.apache.lucene:lucene-snowball:jar:2.9.3:compile
      [INFO] |  |  \- org.apache.lucene:lucene-analyzers:jar:2.9.3:compile
      [INFO] |  +- org.hibernate:hibernate-entitymanager:jar:3.5.6-Final:compile
      [INFO] |  |  +- org.hibernate:hibernate-annotations:jar:3.5.6-Final:compile
      [INFO] |  |  +- cglib:cglib:jar:2.2:compile
      [INFO] |  |  |  \- asm:asm:jar:3.1:compile
      [INFO] |  |  \- javassist:javassist:jar:3.11.0.GA:compile (version managed from 3.9.0.GA)
      [INFO] |  +- joda-time:joda-time:jar:1.6:compile
      [INFO] |  +- joda-time:joda-time-hibernate:jar:1.2:compile
      [INFO] |  \- commons-lang:commons-lang:jar:2.5:compile
      [INFO] +- org.hibernate:hibernate-core:jar:3.5.6-Final:compile
      [INFO] |  +- antlr:antlr:jar:2.7.6:compile
      [INFO] |  +- commons-collections:commons-collections:jar:3.1:compile
      [INFO] |  +- dom4j:dom4j:jar:1.6.1:compile
      [INFO] |  |  \- xml-apis:xml-apis:jar:1.0.b2:compile
      [INFO] |  +- javax.transaction:jta:jar:1.0.1B:compile (version managed from 1.1)
      [INFO] |  \- org.slf4j:slf4j-api:jar:1.5.9.RC1:compile (version managed from 1.5.8)
      [INFO] +- org.hibernate:hibernate-validator:jar:4.0.0.GA:provided
      [INFO] |  +- javax.xml.bind:jaxb-api:jar:2.1:provided
      [INFO] |  |  +- javax.xml.stream:stax-api:jar:1.0-2:provided
      [INFO] |  |  \- javax.activation:activation:jar:1.1:provided
      [INFO] |  \- com.sun.xml.bind:jaxb-impl:jar:2.1.3:provided
      [INFO] +- com.mycompany:mycompany-test-utils:jar:1.0-SNAPSHOT:test
      [INFO] +- javax.enterprise:cdi-api:jar:1.0:provided (scope not updated to compile)
      [INFO] |  +- org.jboss.interceptor:jboss-interceptor-api:jar:1.1:provided
      [INFO] |  \- javax.inject:javax.inject:jar:1:provided
      [INFO] +- org.jboss.ejb3:jboss-ejb3-api:jar:3.1.0:provided
      [INFO] +- javax.annotation:jsr250-api:jar:1.0:provided
      [INFO] +- javax.validation:validation-api:jar:1.0.0.GA:provided
      [INFO] +- org.jboss.seam.persistence:seam-persistence-impl:jar:3.0.0.Alpha1:compile
      [INFO] |  +- org.jboss.seam.persistence:seam-persistence-api:jar:3.0.0.Alpha1:compile
      [INFO] |  \- org.jboss.weld:weld-extensions:jar:1.0.0.Beta1:compile
      [INFO] |     \- javax.el:el-api:jar:2.1.2-b04:compile (version managed from 2.2)
      [INFO] +- org.jboss.slf4j:slf4j-jboss-logging:jar:1.0.2.GA:compile
      [INFO] |  \- org.jboss.logging:jboss-logging-spi:jar:2.1.0.GA:compile
      [INFO] +- org.jboss.logging:jboss-logging-log4j:jar:2.1.0.GA:compile
      [INFO] |  \- log4j:log4j:jar:1.2.14:compile
      [INFO] +- org.jboss.logging:jboss-logging:jar:3.0.0.Beta4:compile
      [INFO] +- javax.faces:jsf-api:jar:2.0.0-RC:provided
      [INFO] +- javax.persistence:persistence-api:jar:1.0:provided
      [INFO] +- junit:junit:jar:4.8.1:test
      [INFO] \- org.easymock:easymock:jar:3.0:test
      [INFO]    +- cglib:cglib-nodep:jar:2.2:test
      [INFO]    \- org.objenesis:objenesis:jar:1.2:test