4 Replies Latest reply on Jul 15, 2009 1:56 PM by Caye

    hibernate is is unable to find my ejbs.jar

    Serkan Satir Newbie

      Hi!


      I have set up a multi module ear project with maven. I have put the tests into a separate project. To test my seam components i use jboss embedded inside maven. My project structure looks like this:


      relis
      |-- relis-ear
      |   -- src
      |       -- main
      |           |-- application
      |           |   -- META-INF
      |           -- resources
      |-- relis-ejb
      |   -- src
      |       |-- main
      |       |   |-- java
      |       |   |   -- com
      |       |   |       -- hp
      |       |   |           -- relis
      |       |   |               |-- action
      |       |   |               |-- dao
      |       |   |               -- model
      |       |   -- resources
      |       |       -- META-INF
      |       -- test
      |-- relis-test
      |   |-- bootstrap
      |   |   |-- META-INF
      |   |   |-- conf
      |   |   |   -- props
      |   |   |-- deploy
      |   |   |   |-- jboss-local-jdbc.rar
      |   |   |   |   -- META-INF
      |   |   |   -- messaging
      |   |   |-- deployers
      |   |   -- stylesheets
      |   -- src
      |       |-- main
      |       -- test
      |           |-- java
      |           |   -- com
      |           |       -- hp
      |           |           -- relis
      |           |               -- test
      |           -- resources
      |               -- META-INF
      -- relis-web
          -- src
              |-- main
              |   |-- java
              |   |-- resources
              |   -- webapp
              |       |-- META-INF
              |       -- WEB-INF
              |           -- lib
              -- test
      



      When i run mvn test inside my parent project, everythings works fine. the jboss embedded starts up properly and my test succeeds.


      But when i run mvn package or install the tests fail, because hibernate does not register my entity. In the log i have noticed the following lines:


      WARN  [org.hibernate.ejb.packaging.InputStreamZippedJarVisitor] Unable to find file (ignored): jar:file:/home/relisdev01/relis/project/relis/relis-ejb/target/relis-ejb-0.0.1-SNAPSHOT.jar!/
      java.io.IOException: no entry name specified
      .
      .
      ERROR [org.jboss.aspects.tx.TxPolicy] javax.ejb.EJBTransactionRolledbackException: org.hibernate.hql.ast.QuerySyntaxException: User is not mapped [select username from User where username = :el1]



      My test project pom looks like this:


      <?xml version="1.0" encoding="UTF-8"?>
      <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
              <parent>
                      <artifactId>relis</artifactId>
                      <groupId>com.hp.relis</groupId>
                      <version>0.0.1-SNAPSHOT</version>
              </parent>
              <modelVersion>4.0.0</modelVersion>
              <groupId>com.hp.relis</groupId>
              <artifactId>relis-test</artifactId>
              <packaging>jar</packaging>
              <name>relis-test</name>
              <version>0.0.1-SNAPSHOT</version>
      
              <dependencies>
                      <dependency>
                              <groupId>com.hp.relis</groupId>
                              <artifactId>relis-ejb</artifactId>
                              <version>${project.version}</version>
                              <type>ejb</type>
                              <scope>test</scope>
                      </dependency>
                      <dependency>
                              <groupId>org.jboss.seam.embedded</groupId>
                              <artifactId>jboss-embedded-all</artifactId>
                              <version>beta3</version>
                              <scope>test</scope>
                              <exclusions>
                                      <exclusion>
                                              <groupId>org.jboss.microcontainer</groupId>
                                              <artifactId>jboss-deployers-client-spi</artifactId>
                                      </exclusion>
                              </exclusions>
                      </dependency>
                      <dependency>
                              <groupId>org.jboss.seam.embedded</groupId>
                              <artifactId>jboss-embedded-api</artifactId>
                              <version>beta3</version>
                              <scope>test</scope>
                      </dependency>
                      <dependency>
                              <groupId>org.jboss.seam.embedded</groupId>
                              <artifactId>hibernate-all</artifactId>
                              <version>beta3</version>
                              <scope>test</scope>
                      </dependency>
                      <dependency>
                              <groupId>org.jboss.seam.embedded</groupId>
                              <artifactId>thirdparty-all</artifactId>
                              <version>beta3</version>
                              <scope>test</scope>
                      </dependency>
                      <dependency>
                              <groupId>org.jboss.seam</groupId>
                              <artifactId>jboss-seam</artifactId>
                              <version>${seam.version}</version>
                              <scope>test</scope>
                      </dependency>
                      <dependency>
                              <groupId>org.jboss.seam</groupId>
                              <artifactId>jboss-el</artifactId>
                              <version>2.0.0.GA</version>
                              <scope>test</scope>
                      </dependency>
                      <dependency>
                              <groupId>javax.faces</groupId>
                              <artifactId>jsf-api</artifactId>
                              <version>${jsf.version}</version>
                              <scope>test</scope>
                      </dependency>
                      <dependency>
                              <groupId>javax.el</groupId>
                              <artifactId>el-api</artifactId>
                              <version>1.0</version>
                              <scope>test</scope>
                      </dependency>
                      <dependency>
                              <groupId>javax.activation</groupId>
                              <artifactId>activation</artifactId>
                              <version>1.1</version>
                              <scope>test</scope>
                      </dependency>
                      <dependency>
                              <groupId>org.testng</groupId>
                              <artifactId>testng</artifactId>
                              <version>5.8</version>
                              <classifier>jdk15</classifier>
                              <scope>test</scope>
                      </dependency>
                      <dependency>
                              <groupId>org.slf4j</groupId>
                              <artifactId>slf4j-api</artifactId>
                              <version>1.4.2</version>
                              <scope>test</scope>
                      </dependency>
                      <dependency>
                              <groupId>org.slf4j</groupId>
                              <artifactId>slf4j-nop</artifactId>
                              <version>1.4.2</version>
                              <scope>test</scope>
                      </dependency>
              </dependencies>
      
              <build>
                      <testResources>
                              <testResource>
                                      <directory>bootstrap</directory>
                              </testResource>
                              <testResource>
                                      <directory>src/test/resources</directory>
                              </testResource>
                      </testResources>
              </build>
      
              <reporting>
                      <plugins>
                              <plugin>
                                      <groupId>org.apache.maven.plugins</groupId>
                                      <artifactId>maven-surefire-report-plugin</artifactId>
                                      <version>2.4.2</version>
                              </plugin>
                      </plugins>
              </reporting>
      
      </project>
      



      I have no idea why my test does not run whithin package or install but otherwise runs correct when i run mvn test alone.
      Does anybody have a hint what i am doing wrong?


      Thanks in advance!
      Serkan