9 Replies Latest reply: Mar 21, 2011 4:46 AM by Aslak Knutsen RSS

Errors after upgrading to Alpha 5 with JBoss AS 6.0 Embedded and TestNG

Samuel Santos Newbie

With Alpha4 the code works fine, but after upgrading Arquillian to Alpha5 I'm getting the following error:

 

java.lang.NoSuchMethodError: org.jboss.shrinkwrap.api.spec.JavaArchive.addAsServiceProvider(Ljava/lang/Class;[Ljava/lang/Class;)Lorg/jboss/shrinkwrap/api/Archive;
    at org.jboss.arquillian.testng.TestNGDeploymentAppender.createAuxiliaryArchive(TestNGDeploymentAppender.java:42)
    at org.jboss.arquillian.impl.client.deployment.DeploymentGenerator.loadAuxiliaryArchives(DeploymentGenerator.java:194)
    at org.jboss.arquillian.impl.client.deployment.DeploymentGenerator.buildTestableDeployments(DeploymentGenerator.java:138)
    at org.jboss.arquillian.impl.client.deployment.DeploymentGenerator.createTestableDeployments(DeploymentGenerator.java:126)
    at org.jboss.arquillian.impl.client.deployment.DeploymentGenerator.generateDeployment(DeploymentGenerator.java:78)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

 

My test class code:

 

@RunAsClient
public class FooServiceIT extends Arquillian {

    private static final Logger LOGGER = Logger.getLogger(FooServiceIT.class.getName());

    @Deployment
    public static EnterpriseArchive createDeployment() throws IOException {
        final JavaArchive ejbJar = ShrinkWrap.create(JavaArchive.class, "ejb.jar").addClasses(FooService.class,
                FooServiceBean.class);
        final WebArchive war = ShrinkWrap.create(WebArchive.class, "foo.war").addClasses(EJBBean.class,
                EJBInterceptor.class, FooActionBean.class).addLibraries(
                MavenArtifactResolver.resolve("net.sourceforge.stripes:stripes:1.5.5")).addResource("index.jsp")
                .setWebXML("web.xml");
        final EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class, "stripes.ear").addModule(ejbJar)
                .addModule(war);

        LOGGER.info(ear.toString(true));

        return ear;
    }

    @Test
    public void shouldGreetUser() throws IOException {
        final String name = "Earthlings";
        final URL url = new URL("http://localhost:8080/foo/Foo.action");
        StringBuilder builder = new StringBuilder();
        BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
        String line;

        while ((line = reader.readLine()) != null) {
            builder.append(line);
        }
        reader.close();

        LOGGER.info("Returned response: " + builder.toString());
        assertEquals(builder.toString(), FooService.GREETING + name);
    }
}

 

Thanks in advance.