1 Reply Latest reply on Jan 3, 2008 1:34 AM by Cory Prowse

    Maven2 example application for Seam2

    Cory Prowse Newbie

      This is a crosspost from the Seam forum http://www.jboss.com/index.html?module=bb&op=viewtopic&t=126786

      ---
      Hi,

      I have made available for download a work in progress to getting a sample project going with Seam2 building and testing using Maven2 and JBossEmbedded. I thought a lot of the issues would be solved since there is a root pom provided for Seam (and hence the dependencies would be managed for me).

      Alas, I always get the following error from the first unit test that attempts to start Embedded JBoss (using the provided SeamTest class in Seam).

      ERROR [AbstractKernelController] Error installing to Instantiated: name=FileStructure state=Described
      java.lang.NoSuchMethodError: javassist.scopedpool.ScopedClassPool.(Ljava/lang/ClassLoader;Ljavassist/ClassPool;Ljavassist/scopedpool/ScopedClassPoolRepository;Z)V
      at org.jboss.aop.classpool.AOPClassPool.(AOPClassPool.java:69)


      I have archived an example application and provided it for download so that perhaps others can point me towards the correct means of achieving this.
      The project will build an EAR that successfully deploys and runs within Glassfish v2, however only if you skip the unit tests:
      mvn -Dmaven.test.skip=true clean install


      It uses the 2.0.1.CR1 root pom and the recently published beta3-SNAPSHOT of Embedded JBoss.
      It also will enforce using Java5 and Maven 2.0.8+ to ensure the environment is supported correctly.

      The archive can be obtained from here: http://www.users.on.net/~cory_prowse/seamMavenExample-20080102.zip

      Would love to get some help in getting this to work from anyone capable.
      Would it require the new version of JBoss Embedded to be released first?

      Hopefully those working on Seam and/or JBossEmbedded can review this before their respective projects make their next releases.

        • 1. Re: Maven2 example application for Seam2
          Cory Prowse Newbie

          (Again I've crossposted from http://www.jboss.com/index.html?module=bb&op=viewtopic&t=126786

          This appears more relevant to the embedded JBoss project than to Seam, as it relates to the classpath specified in the poms provided by Embedded JBoss.

          ---

          "pete.muir@jboss.org" wrote:
          there is nothing wrong with Seam or Embedded here, just the way Maven sets up the classpath when running tests.


          Aha!

          The problem then appears to be with the thirdparty-all-beta*.jar file as it contains a separate copy of javassist.

          Adding an exclusion for javassist to jboss-seam and hibernate-entitymanager in the Ejb's POM as follows:
          <dependency>
           <groupId>org.jboss.seam</groupId>
           <artifactId>jboss-seam</artifactId>
           <exclusions>
           <exclusion>
           <groupId>jboss</groupId>
           <artifactId>javassist</artifactId>
           </exclusion>
           </exclusions>
           </dependency>
          ...
           <dependency>
           <groupId>org.hibernate</groupId>
           <artifactId>hibernate-entitymanager</artifactId>
           <exclusions>
           <exclusion>
           <groupId>jboss</groupId>
           <artifactId>javassist</artifactId>
           </exclusion>
           </exclusions>
           </dependency>


          causes the tests to now fail with:

          ERROR [AbstractKernelController] Error installing to Start: name=java:comp state=Create
          javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
           at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645)
           at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
           at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:284)
           at javax.naming.InitialContext.lookup(InitialContext.java:351)
           at org.jboss.naming.JavaCompInitializer.start(JavaCompInitializer.java:83)


          So it appears the dependencies need to be properly and fully speced out in the appropriate poms.

          The use of these "*-all-*.jar" files appear the be the culprit.

          Namely:
          hibernate-all-*.jar
          jboss-embedded-all-*.jar
          thirdparty-all-*.jar


          These are not very useful in their current form for Maven.

          Unless someone knows of a way to exclude certain dependencies in the test scope within maven? (I can't see a way)