9 Replies Latest reply: Jul 19, 2012 2:58 AM by Aliaksei Lahachou RSS

Arquillian and jboss-4.2.3.GA

Rajmahendra Hegde Newbie


i am workign on a jboss-4.2.3.GA project. Its a old project but we cant upgrade to new server.

 

I am trying to use Arquillian for JPA..

 

We are using folliwng entry in pom for JPA

 

          

<dependency>

            <groupId>com.jboss</groupId>

            <artifactId>ejb3-persistence.jar</artifactId>

            <version>4.2.3</version>

            <scope>provided</scope>

        </dependency>

        <dependency>

            <groupId>hibernate</groupId>

            <artifactId>hibernate3</artifactId>

            <version>3.2.4.SP1</version>

            <scope>provided</scope>

        </dependency>

 

I am trying to configure Arquillian but i am getting some issue like nosuchmethod found or some time no default container set.

Anyone help me what container i need to set and any dependency settings ?

  • 1. Re: Arquillian and jboss-4.2.3.GA
    Aslak Knutsen Master

    Could you provide your full pom.xml ?

  • 2. Re: Arquillian and jboss-4.2.3.GA
    Rajmahendra Hegde Newbie

    <?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">

        <modelVersion>4.0.0</modelVersion>

     

        <groupId>myproject</groupId>

        <artifactId>jpaPersist</artifactId>

        <name>sp7 EJB3 persist</name>

        <version>1.0-SNAPSHOT</version>

        <packaging>ejb</packaging>

     

        <properties>

            <hibernate.show_sql>false</hibernate.show_sql>

        </properties>

        <profiles>

            <profile>

                <id>debug</id>

                <properties>

                    <hibernate.show_sql>true</hibernate.show_sql>

                    <hibernate.format_sql>true</hibernate.format_sql>

                    <hibernate.use_sql_comments>true</hibernate.use_sql_comments>

                </properties>

            </profile>

        </profiles>

        <repositories>

            <repository>

                <id>jboss</id>

                <url>http://repository.jboss.com/maven2</url>

                <releases>

                    <enabled>true</enabled>

                </releases>

                <snapshots>

                    <enabled>false</enabled>

                </snapshots>

            </repository>

        </repositories>

        <dependencies>

           

           

    <dependency>
     
    <groupId>org.jboss.arquillian.container</groupId>
     
    <artifactId>arquillian-jbossas-remote-4.2</artifactId>
     
    <version>1.0.0.CR3</version>
     
    <scope>test</scope>
    </dependency>

           

           

           

            <dependency>

                <groupId>junit</groupId>

                <artifactId>junit</artifactId>

                <version>4.8.1</version>

                <scope>test</scope>

            </dependency>

           

            <dependency>

                <groupId>org.jboss.arquillian</groupId>

                <artifactId>arquillian-bom</artifactId>

                <version>1.0.1.Final</version>

                <scope>import</scope>

                <type>pom</type>

            </dependency>

           

           

           

            <dependency>

                <groupId>com.jboss</groupId>

                <artifactId>ejb3-persistence.jar</artifactId>

                <version>4.2.3</version>

                <scope>provided</scope>

            </dependency>

            <dependency>

                <groupId>hibernate</groupId>

                <artifactId>hibernate3</artifactId>

                <version>3.2.4.SP1</version>

                <scope>provided</scope>

            </dependency>

           

            <dependency>

        <groupId>org.jboss.arquillian.junit</groupId>

        <artifactId>arquillian-junit-container</artifactId>

        <version>1.0.0.Final</version>

        <scope>test</scope>

    </dependency>

        </dependencies>

        <build>

            <plugins>

                <plugin>

                    <groupId>org.apache.maven.plugins</groupId>

                    <artifactId>maven-ejb-plugin</artifactId>

                    <configuration>

                        <ejbVersion>3.0</ejbVersion>

                        <generateClient>true</generateClient>

                    </configuration>

                </plugin>

            </plugins>

        </build>

    </project>

  • 3. Re: Arquillian and jboss-4.2.3.GA
    Aliaksei Lahachou Newbie

    I think I had some similar problem this week, I configured a new project which has some JBoss AS 4 tests. In my case this was an incompatibility between arquillian-jbossas-remote-4.2:1.0.0.CR3 and Arquillian 1.0.1.Final.

     

    I upgraded dependencies and created a pull request https://github.com/arquillian/arquillian-container-jbossas/pull/8 - all tests pass and it actually works in my environment. It would be great if you could accept the request and are a release.

     

     

    Regards,

    htfv (Aliaksei Lahachou)

  • 4. Re: Arquillian and jboss-4.2.3.GA
    Aslak Knutsen Master

    Try adding the arquillian-bom to the dependencyManagement section of the your pom, see the Getting Started Guide: http://arquillian.org/guides/getting_started/#add_the_arquillian_apis

     

    That will update the version of the dependencies the jbossas adaptor has on arquillian core. Without it you will be running a mix of Core 1.0.1.Final and Core X (what ever the adaptor happenes to be compiled aginst currently which may or may not be compatibile with the 1.0.1.Final Core artifacts).

  • 5. Re: Arquillian and jboss-4.2.3.GA
    Aliaksei Lahachou Newbie

    I had arquillian-bom in dependency management section and it did not work. I think the problem can be that arquillian-jbossas-remote-4.2:1.0.0.CR3 is compiled against Arquillian 1.0.0.CR7 and some API has changed since then. I can investigate it with arquillian-jbossas-remote-4.2:1.0.0.CR3 in more details tomorrow.

     

    Also, as a side note, you should be careful with boms, because sometimes they give unexpected results. For example, importing Weld BOM may manage Arquillian version to 1.0.0.CR7. I'm going to file a bug, because Weld BOM should manage only Weld dependencies and should not mess with my Arquillian configuration.

     

     

    Regards,

    htfv (Aliaksei Lahachou)

  • 6. Re: Arquillian and jboss-4.2.3.GA
    Aslak Knutsen Master

    Yea, Weld Core BOM should not expose Arquillian

  • 7. Re: Arquillian and jboss-4.2.3.GA
    Rajmahendra Hegde Newbie

    Try adding the arquillian-bom to the dependencyManagement section of the your pom, see the Getting Started Guide: http://arquillian.org/guides/getting_started/#add_the_arquillian_apis

    Thank you it workds now the Arq is working. I am writing EJB3 JPA ...

     

    how can i use jboss-4.2.3.GA for testing ?

     

    and one more doubt..

     

    I have placed ejb-jar.xml and persistence.xml in src/test/resources/META-INF/ and i added following in Deployment

     

    public static WebArchive createDeployment() {

            return ShrinkWrap.create(WebArchive.class, "test.war")

                             .addPackage(Diagnosis.class.getPackage())

                             .addAsResource("persistence.xml", "META-INF/persistence.xml")

                              .addAsResource("ejb-jar.xml", "META-INF/ejb-jar.xml")

                             .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");

        }

    but i am getting following error

     

    Caused by: java.lang.IllegalArgumentException: persistence.xml doesn't exist or can't be accessed

    am i missing something here ?

  • 8. Re: Arquillian and jboss-4.2.3.GA
    Aliaksei Lahachou Newbie

    I tested it, too, and indeed it works.

     

    My problem was weld-core-bom, but I realized it only later. It somehow manages only some of arquillian dependencies to 1.0.0.CR7, so what I had was a mix of 1.0.0.CR7 and 1.0.1.Final.

     

    com.brandmaker.interops:bm-interops-jbossas-4:jar:1.0.0-SNAPSHOT
    +- com.brandmaker.interops:bm-interops:jar:1.0.0-SNAPSHOT:compile
    +- org.jboss.arquillian.container:arquillian-jbossas-remote-4.2:jar:1.0.0.CR3:compile
    |  +- org.jboss.arquillian.container:arquillian-container-spi:jar:1.0.0.CR7:compile
    |  +- org.jboss.arquillian.container:arquillian-container-test-spi:jar:1.0.0.CR7:compile
    |  +- org.jboss.arquillian.protocol:arquillian-protocol-servlet:jar:1.0.1.Final:compile (version managed from 1.0.0.CR7)
    |  +- org.jboss.arquillian.testenricher:arquillian-testenricher-ejb:jar:1.0.1.Final:compile (version managed from 1.0.0.CR7)
    |  +- org.jboss.arquillian.testenricher:arquillian-testenricher-resource:jar:1.0.1.Final:compile (version managed from 1.0.0.CR7)
    |  \- org.jboss.arquillian.testenricher:arquillian-testenricher-initialcontext:jar:1.0.1.Final:compile (version managed from 1.0.0.CR7)
    \- org.jboss.arquillian.junit:arquillian-junit-container:jar:1.0.0.CR7:test
       +- org.jboss.arquillian.junit:arquillian-junit-core:jar:1.0.1.Final:test (version managed from 1.0.0.CR7)
       +- org.jboss.arquillian.core:arquillian-core-impl-base:jar:1.0.1.Final:test (version managed from 1.0.0.CR7)
       +- org.jboss.arquillian.test:arquillian-test-impl-base:jar:1.0.0.CR7:test
       +- org.jboss.arquillian.container:arquillian-container-impl-base:jar:1.0.1.Final:test (version managed from 1.0.0.CR7)
       +- org.jboss.arquillian.container:arquillian-container-test-impl-base:jar:1.0.0.CR7:test
       \- org.jboss.shrinkwrap:shrinkwrap-impl-base:jar:1.0.0-cr-1:test
    

     

     

    Regards,

    htfv (Aliaksei Lahachou)

  • 9. Re: Arquillian and jboss-4.2.3.GA
    Aliaksei Lahachou Newbie

    I have placed ejb-jar.xml and persistence.xml in src/test/resources/META-INF/ and i added following in Deployment

    public static WebArchive createDeployment() {

            return ShrinkWrap.create(WebArchive.class, "test.war")

                             .addPackage(Diagnosis.class.getPackage())

                             .addAsResource("persistence.xml", "META-INF/persistence.xml")

                              .addAsResource("ejb-jar.xml", "META-INF/ejb-jar.xml")

                             .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");

        }

     

    You placed them to META-INF/*.xml, but reference using *.xml. The following should work:

     

    .addAsResource("META-INF/persistence.xml")

    .addAsResource("META-INF/ejb-jar.xml")