Arquillian is a highly extensible testing platform for the JVM that enables developers to easily create automated integration, function, and acceptance tests for Java middleware. This article describes how to create a Liberty container for Arquillian, create a class that uses the Spring framework, and write and execute an Arquillian test in Eclipse.

At the end of the article you will:

  • Know what Arquillian is
  • Have set up an Arquillian environment on your workstation
  • Have created a Liberty container for Arquillian and run the GreeterTest against it
  • Have created a HelloWorldServlet class that uses the Spring Framework
  • Have written an Arquillian test for the HelloWorldServlet class
  • Have executed the Arquillian test against the Liberty container from Eclipse

Before you start:

What is Arquillian?

Arquillian is an innovative and highly extensible testing platform for the JVM that enables developers to easily create automated integration, function, and acceptance tests for Java middleware. Arquillian brings the test to the runtime so you do not have to manage the runtime from the test (or the build). Arquillian eliminates this burden by covering all aspects of test execution, which entails:

  • Managing the life-cycle of the container (or containers)
  • Bundling the test case, dependent classes and resources into a ShrinkWrap archive
  • Deploying the archive (or archives) to the container (or containers)
  • Enriching the test case providing dependency injection and other declarative services
  • Executing the tests inside (or against) the container
  • Capturing the results and returning them to the test runner for reporting

To do this, you’ll:

  1. Select a container
  2. Start or connect to the container
  3. Package the test archive and deploy it to the container
  4. Run test(s) in the container
  5. Capture and report the test results
  6. Undeploy the test archive and stop or disconnect from the container

Here’s how…

Set up the Arquillian environment on your workstation

The steps to set up your Arquillian environment are described in the Arquillian Getting Started Guide, which to summarize says:

  • Install Maven
  • Create a new Maven project
  • Import project into Eclipse
  • Create a component (i.e. Java class)
  • Add Arquillian APIs
  • Write an Arquillian test
  • Add a container adapter
  • Run the Arquillian test
  • Add more containers
  • Test across containers

More Arquillian guides can be found here.

Create a Liberty container and run the GreeterTest against it

  1. Create a Liberty server in Eclipse if you do not already have one.
  2. Add the jsp-2.2, webProfile-6.0 and localConnector-1.0 features to the server.xml file.  If there are missing required features, then you will receive NPEs when running tests.
  3. Enable applicationMonitor Mbean support in the server.xml file.
  4. The server.xml file should minimally look like this:
    <?xml version="1.0" encoding="UTF-8"?>
     <server>
     <featureManager>
     <feature>jsp-2.2</feature>
     <feature>localConnector-1.0</feature>
     <feature>webProfile-6.0</feature>
     </featureManager>
     <httpEndpoint host="localhost" httpPort="9080" httpsPort="9443" id="defaultHttpEndpoint" />
     <applicationMonitor updateTrigger="mbean" />
     </server>
    

    where the httpPort and httpsPort are unused ports on your workstation

  5. Add a Liberty container profile in the Arquillian pom.xml file.  The profile should look like:
    <profile>
    <id>arquillian-wlp-managed</id>
    <dependencies>
    <dependency>
    <groupId>org.jboss.arquillian.container</groupId>
    <artifactId>arquillian-wlp-managed-8.5</artifactId>
    <version>1.0.0.Beta1</version>
    <scope>test</scope>
    </dependency>
    <dependency>
    <groupId>org.jboss.spec</groupId>
    <artifactId>jboss-javaee-6.0</artifactId>
    <version>1.0.0.Final</version>
    <type>pom</type>
    <scope>provided</scope>
    </dependency>
    </dependencies>
    </profile>
    
  6. Switch to using the Liberty profile in Eclipse (set properties value to arquillian-wlp-managed).  More detail can be found in the Arquillian Getting Started Guide.
  7. Update the arquillian.xml file to point to the Liberty configuration.  The arquillian.xml file should look something like:
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
     <arquillian xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://jboss.org/schema/arquillian" xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
     <engine>
     <property name="deploymentExportPath">target/</property>
     </engine>
     <container qualifier="websphere" default="true">
     <configuration>
     <property name="wlpHome">C:WebSphereLibertyusrservers</property>
     <property name="serverName">server1</property>
     <property name="httpPort">9080</property>
     </configuration>
     </container>
     </arquillian>
    

    where wlpHome is set to the Liberty installation location, serverName is set to the Liberty server name, and httpPort is set to the http port defined in the server.xml file.¬† By default, the Arquillian test applications are deployed to the server’s dropins directory.

  8. If the Liberty server is running, then stop it.
  9. Run the GreeterTest against the Liberty container.

Create a HelloWorld Servlet

  1. Create a new class, HelloWorldServlet, under the src/main/java/org.arquillian.example package:
    package org.arquillian.example;
    import java.io.IOException;
    import javax.servlet.ServletException;
    import javax.servlet.annotation.WebServlet;
     import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import org.springframework.context.ApplicationContext;
    import org.springframework.context.support.ClassPathXmlApplicationContext;
    /**
     * Servlet implementation class HelloWorldServlet
     */
     @WebServlet("/HelloWorldServlet")
     public class HelloWorldServlet extends HttpServlet {
     private static final long serialVersionUID = 1L;
     private ApplicationContext context;
         /**
     * @see HttpServlet#HttpServlet()
     */
     public HelloWorldServlet() {
     super();
     }
         /**
     * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
     */
     protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
     context = new ClassPathXmlApplicationContext("SpringBean.xml");
     HelloWorld helloWorld = (HelloWorld) context.getBean("helloWorld");
     response.getWriter().print(helloWorld.getBeanValue());
     }
         /**
     * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
     */
     protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
     // TODO Auto-generated method stub
     }
     }
    
  2. Create a new spring bean, SpringBean.xml, under the src/main/java directory
    <?xml version="1.0" encoding="UTF-8"?>
     <beans xmlns="http://www.springframework.org/schema/beans"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://www.springframework.org/schema/beans<code>http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
        <bean id="helloWorld">
            <property name="SpringBeans" value="Hello World!"/>
        </bean>
    </beans>
    

You should now have a simple HelloWorld application that uses the Spring Framework.

Write an Arquillian Test for the HelloWorldServlet class

  1. Create a new class, HelloWorldServletTest, under the src/test/java/org.arquillian.example package.  The HelloWorldServletTest class will initially look like this:
    package org.arquillian.example;
     public class HelloWorldServletTest {
     }
    
  2. Using ShrinkWrap create an Enterprise Archive to be deployed that contains the HelloWorldServlet class and the SpringBean.xml.  The HelloWorldServletTest class should now look like this:
    package org.arquillian.example;
    import org.jboss.arquillian.container.test.api.Deployment;
    import org.jboss.arquillian.junit.Arquillian;
    import org.jboss.shrinkwrap.api.ShrinkWrap;
    import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
    import org.jboss.shrinkwrap.api.spec.WebArchive;
    @RunWith(Arquillian.class)
    public class HelloWorldServletTest {
       @Deployment(testable=false)
     public static EnterpriseArchive createDeployment()
     {
     EnterpriseArchive ear =  ShrinkWrap.create(EnterpriseArchive.class, "test.ear")
     .addAsModule(ShrinkWrap.create(WebArchive.class, "test.war")
     .addClasses(HelloWorldServlet.class, HelloWorld.class)
     .addAsResource("SpringBean.xml"));
     return ear;
     }
     }
    

    This is a simple EAR file that contains a single Web Archive with a single class and the SpringBean.xml file.  Note that the Spring bean needs to be added as a resource to the Web Archive so that the HelloWorldServlet class can find it.

  3. Add a test that verifies that the output of the servlet is correct.  The completed HelloWorldServletTest class should now look like this:
    package org.arquillian.example;
    import java.io.ByteArrayOutputStream;
    import java.io.InputStream;
    import java.net.URL;
    import org.jboss.arquillian.container.test.api.Deployment;
    import org.jboss.arquillian.junit.Arquillian;
     import org.jboss.arquillian.test.api.ArquillianResource;
    import org.jboss.shrinkwrap.api.ShrinkWrap;
    import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
    import org.jboss.shrinkwrap.api.spec.WebArchive;
    import org.junit.Assert;
    import org.junit.Test;
    import org.junit.runner.RunWith;
    @RunWith(Arquillian.class)
    public class HelloWorldServletTest {
        @Deployment(testable=false)
     public static EnterpriseArchive createDeployment()
     {
     EnterpriseArchive ear =  ShrinkWrap.create(EnterpriseArchive.class, "test.ear")
     .addAsModule(ShrinkWrap.create(WebArchive.class, "test.war")
     .addClasses(HelloWorldServlet.class, HelloWorld.class)
     .addAsResource("SpringBean.xml"));
     return ear;
     }
        @Test
     public void shouldBeAbleToInvokeServletInDeployedWebApp(@ArquillianResource URL url) throws Exception
     {
     String body = readAllAndClose(new URL(url, "HelloWorldServlet").openStream());
            Assert.assertEquals("Verify that the servlet was deployed and returns expected result",
     "Output from Spring Bean : Hello World!", body);
     }
        private String readAllAndClose(InputStream is) throws Exception
     {
     ByteArrayOutputStream out = new ByteArrayOutputStream();
     try
     {
     int read;
     while( (read = is.read()) != -1)
     {
     out.write(read);
     }
     }
     finally
     {
     try { is.close(); } catch (Exception e) { }
     }
     return out.toString();
     }
     }
    

Execute the Arquillian test against the Liberty container

  1. Install the Spring/Spring MVC v3.2.1 Sample application from the developerWorks Liberty Repository.  We will be making use of the Spring configuration libraries that are installed with the application.
  2. Add the servlet-3.0 feature to the server.xml file
  3. Include the Spring configuration libraries in the server.xml file
  4. The server.xml file should minimally look like this:
    <?xml version="1.0" encoding="UTF-8"?>
     <server>
     <featureManager>
     <feature>jsp-2.2</feature>
     <feature>localConnector-1.0</feature>
     <feature>webProfile-6.0</feature>
     <feature>servlet-3.0</feature>
     </featureManager>
     <httpEndpoint host="localhost" httpPort="9080" httpsPort="9443" id="defaultHttpEndpoint" />
     <applicationMonitor updateTrigger="mbean" />
     <include location="${shared.config.dir}/SpringSamplesLibs.xml" />
     </server>
    

    where the httpPort and httpsPort are unused ports on your workstation

  5. Because our application uses a shared library the arquillian.xml file needs to be updated to use the server.xml for deployment and to include the shared library as a part of the application deployment.  The arquillian.xml file should look something like:
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
     <arquillian xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://jboss.org/schema/arquillian" xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
     <engine>
     <property name="deploymentExportPath">target/</property>
     </engine>
     <container qualifier="websphere" default="true">
     <configuration>
     <property name="wlpHome">C:WebSphereLibertyusrservers</property>
     <property name="serverName">server1</property>
     <property name="httpPort">9080</property>
                  <property name="sharedLib">SpringSampleLibs</property>
     <property name="deployType">xml</property>
     </configuration>
     </container>
     </arquillian>
    

    where wlpHome is set to the Liberty installation location, serverName is set to the Liberty server name, and httpPort is set to the HTTP port defined in the server.xml file.¬† By default, the Arquillian test applications are deployed to the server’s dropins directory but you can specify a deployType of dropins as well.¬† Additionally, if your application uses more than one shared library, then the sharedLib property can specify them as a comma-separated list (i.e. SpringSampleLibs, HibernateSampleLibs).

  6. Run the HelloWorldServletTest against the Liberty container

7 comments on"Getting started with Liberty and Arquillian"

  1. Bodhayan Guha November 23, 2016

    I am using the following stack : –

    arquillian-junit-container- 1.1.11.FINAL
    arquillian-wlp-remote-8.5 – 1.0.0.Beta2
    arquillian-bom – 1.1.11.Final
    jUnit – 4.12

    (WebSphere Application Server 8.5.5.9/wlp-1.0.12.cl50920160227-1523) on Java HotSpot(TM) 64-Bit Server VM, version 1.8.0_65-b17 (en_US)

    And have the arquilian.xml as part of src/test/resources and have included the same as part of my Project POM :

    src/test/resources

    But when am trying to execute a standalone test with “Run as JUnit State” its failing with the below stack. Have gone through the getting started guide[earlier was using a Managed version of wlp]

    org.jboss.arquillian.container.spi.ConfigurationException: hostName is required for initialization
    at org.jboss.arquillian.container.was.wlp_remote_8_5.WLPRemoteContainerConfiguration.validate(WLPRemoteContainerConfiguration.java:53)
    at org.jboss.arquillian.container.impl.ContainerImpl.createDeployableConfiguration(ContainerImpl.java:115)

    Can you please suggest hints to resolve this ?

  2. Hi,
    I followed the instruction that you did. And worked properly. For applying to solution to my project I have to add log4j logger utils. So I did the modifications, and having some warnings that say log4j.xml file cant be parsed. So there is a problem with parsing xml files.
    I added log4j.xml and log4j.dtd file to src/main/resources.

    Thanks for helps.

    Modified HelloWorld.java class like below:

    package org.arquillian.example;
    import org.apache.log4j.Logger;
    public class HelloWorld {
    protected static final Logger logger = Logger.getLogger(HelloWorld.class);
    public String getBeanValue() {
    logger.info(“—————————–logging something here————“);
    return “Hello World!”;
    }
    }

    And modified HelloWorldServletTest.java class for adding all resources to the war file.

    package org.arquillian.example;

    import java.io.ByteArrayOutputStream;
    import java.io.File;
    import java.io.InputStream;
    import java.net.URL;

    import org.jboss.arquillian.container.test.api.Deployment;
    import org.jboss.arquillian.junit.Arquillian;
    import org.jboss.arquillian.test.api.ArquillianResource;
    import org.jboss.shrinkwrap.api.ShrinkWrap;
    import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
    import org.jboss.shrinkwrap.api.spec.WebArchive;
    import org.junit.Assert;
    import org.junit.Test;
    import org.junit.runner.RunWith;

    @RunWith(Arquillian.class)
    public class HelloWorldServletTest {
    private static final String RESOURCES_DIR = “src/main/resources”;

    @Deployment(testable = false)
    public static EnterpriseArchive createDeployment() {

    WebArchive war = ShrinkWrap.create(WebArchive.class, “arquilliantestweb.war”).addClasses(HelloWorldServlet.class, HelloWorld.class)
    .addAsResource(“SpringBean.xml”).addPackages(true, “org.arquillian”).addPackages(true, “org.makslab”).addPackages(true, “org.apache.log4j”)
    .addPackages(true, “javax.mail”).addPackages(true, “com.sun.mail”);
    addAllResources(war, RESOURCES_DIR);

    EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class, “arquilliantestweb.ear”).addAsModule(war);
    return ear;
    }

    @Test
    public void shouldBeAbleToInvokeServletInDeployedWebApp(@ArquillianResource URL url) throws Exception {
    String body = readAllAndClose(new URL(url, “HelloWorldServlet”).openStream());
    Assert.assertEquals(“Verify that the servlet was deployed and returns expected result”, “Hello World!”, body);
    }

    private String readAllAndClose(InputStream is) throws Exception {
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    try {
    int read;
    while ((read = is.read()) != -1) {
    out.write(read);
    }
    } finally {
    try {
    is.close();
    } catch (Exception e) {
    }
    }
    return out.toString();
    }

    /**
    * Add all resources from the given directory, recursively. Only adds
    * subdirectories when they start with a lower case letter
    *
    * @param war
    * war archive to add packages to
    * @param directory
    * directory with resources to add
    */
    private static void addAllResources(WebArchive war, String directory) {
    for (File file : new File(directory).listFiles()) {
    addAllResources(war, “”, file);
    }
    }

    private static void addAllResources(WebArchive war, String prefix, File dir) {
    if (dir.getPath().endsWith(“CVS”))
    return;
    if (dir.isDirectory()) {
    prefix += dir.getName() + “/”;
    for (File file : dir.listFiles()) {
    addAllResources(war, prefix, file);
    }
    } else {
    war.addAsResource(prefix + dir.getName());
    }
    }
    }

    And here is the my log4j.xml file:

    And here is the Websphere liberty profile log file messages.log:

    ********************************************************************************
    product = WebSphere Application Server 8.5.5.1 (wlp-1.0.4.cl50120131011-1639)
    wlp.install.dir = C:/Was_8.5.5_LibProfile/wlp/
    java.home = C:\Program Files\IBM\SDP\jdk\jre
    java.version = 1.7.0
    java.runtime = Java(TM) SE Runtime Environment (pwa6470sr6fp1ifx-20140317_01 (SR6 FP1+IX90136+IX90137+IV39749))
    os = Windows 7 (6.1; amd64) (tr_TR)
    ********************************************************************************
    [18.12.2015 16:42:10:617 EET] 00000001 com.ibm.ws.logging.internal.TraceSpecification I TRAS0018I: The trace state has been changed. The new trace state is *=info.
    [18.12.2015 16:42:10:632 EET] 00000001 com.ibm.ws.kernel.launch.internal.FrameworkManager A CWWKE0001I: The server defaultServer has been launched.
    [18.12.2015 16:42:11:632 EET] 00000001 com.ibm.ws.kernel.launch.internal.FrameworkManager I CWWKE0002I: The kernel started after 1.217 seconds
    [18.12.2015 16:42:11:671 EET] 00000024 com.ibm.ws.kernel.feature.internal.FeatureManager I CWWKF0007I: Feature update started.
    [18.12.2015 16:42:12:506 EET] 0000001c com.ibm.ws.security.internal.SecurityReadyServiceImpl I CWWKS0007I: The security service is starting…
    [18.12.2015 16:42:12:960 EET] 0000002a com.ibm.ws.tcpchannel.internal.TCPChannel I CWWKO0219I: TCP Channel defaultHttpEndpoint has been started and is now listening for requests on host 127.0.0.1 (IPv4: 127.0.0.1) port 9081.
    [18.12.2015 16:42:13:151 EET] 00000028 com.ibm.ws.security.token.ltpa.internal.LTPAKeyCreator I CWWKS4105I: LTPA configuration is ready after 0.291 seconds.
    [18.12.2015 16:42:13:438 EET] 0000001c com.ibm.ws.app.manager.internal.monitor.DropinMonitor A CWWKZ0058I: Monitoring dropins for applications.
    [18.12.2015 16:42:13:473 EET] 00000020 com.ibm.ws.app.manager.internal.statemachine.StartAction I CWWKZ0018I: Starting application KYSWeb.
    [18.12.2015 16:42:14:556 EET] 00000020 com.ibm.ws.webcontainer.osgi.webapp.WebGroup I SRVE0169I: Loading Web Module: KYSWeb.
    [18.12.2015 16:42:14:557 EET] 00000020 com.ibm.ws.webcontainer I SRVE0250I: Web Module KYSWeb has been bound to default_host.
    [18.12.2015 16:42:14:558 EET] 00000020 com.ibm.ws.http.internal.VirtualHostImpl A CWWKT0016I: Web application available (default_host): http://localhost:9081/KYSWeb/
    [18.12.2015 16:42:14:561 EET] 00000020 com.ibm.ws.app.manager.internal.statemachine.StartAction A CWWKZ0001I: Application KYSWeb started in 1.087 seconds.
    [18.12.2015 16:42:14:590 EET] 00000024 com.ibm.ws.kernel.feature.internal.FeatureManager I CWWKF0008I: Feature update completed in 2.959 seconds.
    [18.12.2015 16:42:14:591 EET] 00000024 com.ibm.ws.kernel.feature.internal.FeatureManager A CWWKF0011I: The server defaultServer is ready to run a smarter planet.
    [18.12.2015 16:42:15:069 EET] 00000020 com.ibm.ws.app.manager.internal.statemachine.StartAction I CWWKZ0018I: Starting application arquilliantestweb.
    [18.12.2015 16:42:15:172 EET] 00000020 com.ibm.ws.webcontainer.osgi.webapp.WebGroup I SRVE0169I: Loading Web Module: arquilliantestweb.
    [18.12.2015 16:42:15:172 EET] 00000020 com.ibm.ws.webcontainer I SRVE0250I: Web Module arquilliantestweb has been bound to default_host.
    [18.12.2015 16:42:15:172 EET] 00000020 com.ibm.ws.http.internal.VirtualHostImpl A CWWKT0016I: Web application available (default_host): http://localhost:9081/arquilliantestweb/
    [18.12.2015 16:42:15:172 EET] 00000020 com.ibm.ws.app.manager.internal.statemachine.StartAction A CWWKZ0001I: Application arquilliantestweb started in 0.103 seconds.
    [18.12.2015 16:42:15:302 EET] 0000002a com.ibm.ws.session.WASSessionCore I SESN8501I: The session manager did not find a persistent storage location; HttpSession objects will be stored in the local application server’s memory.
    [18.12.2015 16:42:15:306 EET] 0000002a com.ibm.ws.session.WASSessionCore I SESN0176I: A new session context will be created for application key default_host/arquilliantestweb
    [18.12.2015 16:42:15:312 EET] 0000002a com.ibm.ws.util I SESN0172I: The session manager is using the Java default SecureRandom implementation for session ID generation.
    [18.12.2015 16:42:15:403 EET] 0000002a com.ibm.ws.webcontainer.servlet I SRVE0242I: [arquilliantestweb] [/arquilliantestweb] [org.arquillian.example.HelloWorldServlet]: Initialization successful.
    [18.12.2015 16:42:15:435 EET] 0000002a SystemErr R log4j:WARN Could not find [log4j.dtd] using [com.ibm.ws.classloading.internal.AppClassLoader@a5037bec] class loader, parsed without DTD.
    [18.12.2015 16:42:15:436 EET] 0000002a SystemErr R log4j:WARN Continuable parsing error 4 and column 49
    [18.12.2015 16:42:15:436 EET] 0000002a SystemErr R log4j:WARN Element type “log4j:configuration” must be declared.
    [18.12.2015 16:42:15:437 EET] 0000002a SystemErr R log4j:WARN Continuable parsing error 6 and column 74
    [18.12.2015 16:42:15:440 EET] 0000002a SystemErr R log4j:WARN Element type “appender” must be declared.
    [18.12.2015 16:42:15:440 EET] 0000002a SystemErr R log4j:WARN Continuable parsing error 7 and column 61
    [18.12.2015 16:42:15:440 EET] 0000002a SystemErr R log4j:WARN Element type “param” must be declared.
    [18.12.2015 16:42:15:440 EET] 0000002a SystemErr R log4j:WARN Continuable parsing error 8 and column 53
    [18.12.2015 16:42:15:441 EET] 0000002a SystemErr R log4j:WARN Element type “param” must be declared.
    [18.12.2015 16:42:15:441 EET] 0000002a SystemErr R log4j:WARN Continuable parsing error 9 and column 42
    [18.12.2015 16:42:15:441 EET] 0000002a SystemErr R log4j:WARN Element type “param” must be declared.
    [18.12.2015 16:42:15:441 EET] 0000002a SystemErr R log4j:WARN Continuable parsing error 10 and column 51
    [18.12.2015 16:42:15:442 EET] 0000002a SystemErr R log4j:WARN Element type “layout” must be declared.
    [18.12.2015 16:42:15:442 EET] 0000002a SystemErr R log4j:WARN Continuable parsing error 11 and column 67
    [18.12.2015 16:42:15:442 EET] 0000002a SystemErr R log4j:WARN Element type “param” must be declared.
    [18.12.2015 16:42:15:442 EET] 0000002a SystemErr R log4j:WARN Continuable parsing error 14 and column 67
    [18.12.2015 16:42:15:443 EET] 0000002a SystemErr R log4j:WARN Element type “appender” must be declared.
    [18.12.2015 16:42:15:443 EET] 0000002a SystemErr R log4j:WARN Continuable parsing error 15 and column 45
    [18.12.2015 16:42:15:443 EET] 0000002a SystemErr R log4j:WARN Element type “param” must be declared.
    [18.12.2015 16:42:15:443 EET] 0000002a SystemErr R log4j:WARN Continuable parsing error 16 and column 42
    [18.12.2015 16:42:15:443 EET] 0000002a SystemErr R log4j:WARN Element type “param” must be declared.
    [18.12.2015 16:42:15:444 EET] 0000002a SystemErr R log4j:WARN Continuable parsing error 17 and column 51
    [18.12.2015 16:42:15:444 EET] 0000002a SystemErr R log4j:WARN Element type “layout” must be declared.
    [18.12.2015 16:42:15:444 EET] 0000002a SystemErr R log4j:WARN Continuable parsing error 18 and column 67
    [18.12.2015 16:42:15:444 EET] 0000002a SystemErr R log4j:WARN Element type “param” must be declared.
    [18.12.2015 16:42:15:445 EET] 0000002a SystemErr R log4j:WARN Continuable parsing error 22 and column 67
    [18.12.2015 16:42:15:445 EET] 0000002a SystemErr R log4j:WARN Element type “appender” must be declared.
    [18.12.2015 16:42:15:445 EET] 0000002a SystemErr R log4j:WARN Continuable parsing error 23 and column 42
    [18.12.2015 16:42:15:445 EET] 0000002a SystemErr R log4j:WARN Element type “param” must be declared.
    [18.12.2015 16:42:15:445 EET] 0000002a SystemErr R log4j:WARN Continuable parsing error 24 and column 56
    [18.12.2015 16:42:15:446 EET] 0000002a SystemErr R log4j:WARN Element type “param” must be declared.
    [18.12.2015 16:42:15:446 EET] 0000002a SystemErr R log4j:WARN Continuable parsing error 25 and column 53
    [18.12.2015 16:42:15:446 EET] 0000002a SystemErr R log4j:WARN Element type “param” must be declared.
    [18.12.2015 16:42:15:446 EET] 0000002a SystemErr R log4j:WARN Continuable parsing error 26 and column 54
    [18.12.2015 16:42:15:447 EET] 0000002a SystemErr R log4j:WARN Element type “param” must be declared.
    [18.12.2015 16:42:15:447 EET] 0000002a SystemErr R log4j:WARN Continuable parsing error 27 and column 56
    [18.12.2015 16:42:15:447 EET] 0000002a SystemErr R log4j:WARN Element type “param” must be declared.
    [18.12.2015 16:42:15:447 EET] 0000002a SystemErr R log4j:WARN Continuable parsing error 28 and column 51
    [18.12.2015 16:42:15:448 EET] 0000002a SystemErr R log4j:WARN Element type “layout” must be declared.
    [18.12.2015 16:42:15:448 EET] 0000002a SystemErr R log4j:WARN Continuable parsing error 29 and column 67
    [18.12.2015 16:42:15:448 EET] 0000002a SystemErr R log4j:WARN Element type “param” must be declared.
    [18.12.2015 16:42:15:448 EET] 0000002a SystemErr R log4j:WARN Continuable parsing error 31 and column 59
    [18.12.2015 16:42:15:448 EET] 0000002a SystemErr R log4j:WARN Element type “filter” must be declared.
    [18.12.2015 16:42:15:449 EET] 0000002a SystemErr R log4j:WARN Continuable parsing error 32 and column 43
    [18.12.2015 16:42:15:449 EET] 0000002a SystemErr R log4j:WARN Element type “param” must be declared.
    [18.12.2015 16:42:15:449 EET] 0000002a SystemErr R log4j:WARN Continuable parsing error 33 and column 43
    [18.12.2015 16:42:15:449 EET] 0000002a SystemErr R log4j:WARN Element type “param” must be declared.
    [18.12.2015 16:42:15:450 EET] 0000002a SystemErr R log4j:WARN Continuable parsing error 38 and column 21
    [18.12.2015 16:42:15:450 EET] 0000002a SystemErr R log4j:WARN Element type “logger” must be declared.
    [18.12.2015 16:42:15:450 EET] 0000002a SystemErr R log4j:WARN Continuable parsing error 39 and column 26
    [18.12.2015 16:42:15:456 EET] 0000002a SystemErr R log4j:WARN Element type “level” must be declared.
    [18.12.2015 16:42:15:456 EET] 0000002a SystemErr R log4j:WARN Continuable parsing error 40 and column 30
    [18.12.2015 16:42:15:456 EET] 0000002a SystemErr R log4j:WARN Element type “appender-ref” must be declared.
    [18.12.2015 16:42:15:457 EET] 0000002a SystemErr R log4j:WARN Continuable parsing error 41 and column 32
    [18.12.2015 16:42:15:457 EET] 0000002a SystemErr R log4j:WARN Element type “appender-ref” must be declared.
    [18.12.2015 16:42:15:457 EET] 0000002a SystemErr R log4j:WARN Continuable parsing error 42 and column 31
    [18.12.2015 16:42:15:457 EET] 0000002a SystemErr R log4j:WARN Element type “appender-ref” must be declared.
    [18.12.2015 16:42:15:465 EET] 0000002a SystemOut O log4j: reset attribute= “”.
    [18.12.2015 16:42:15:465 EET] 0000002a SystemOut O log4j: Threshold =””.
    [18.12.2015 16:42:15:466 EET] 0000002a SystemOut O log4j: Retreiving an instance of org.apache.log4j.Logger.
    [18.12.2015 16:42:15:467 EET] 0000002a SystemOut O log4j: Setting [org] additivity to [true].
    [18.12.2015 16:42:15:469 EET] 0000002a SystemOut O log4j: Level value for org is [TRACE].
    [18.12.2015 16:42:15:469 EET] 0000002a SystemOut O log4j: org level set to TRACE
    [18.12.2015 16:42:15:470 EET] 0000002a SystemOut O log4j: Class name: [org.apache.log4j.DailyRollingFileAppender]
    [18.12.2015 16:42:15:483 EET] 0000002a SystemOut O log4j: Setting property [file] to .
    [18.12.2015 16:42:15:484 EET] 0000002a SystemOut O log4j: Setting property [datePattern] to [‘.’yyyy-MM-dd].
    [18.12.2015 16:42:15:484 EET] 0000002a SystemOut O log4j: Setting property [threshold] to [INFO].
    [18.12.2015 16:42:15:484 EET] 0000002a SystemOut O log4j: Parsing layout of class: “org.apache.log4j.PatternLayout”
    [18.12.2015 16:42:15:492 EET] 0000002a SystemOut O log4j: Setting property [conversionPattern] to [[%d{ISO8601}] – %m%n].
    [18.12.2015 16:42:15:493 EET] 0000002a SystemOut O log4j: setFile called: c:/home/sistem/sgbm/sgbm.log, true
    [18.12.2015 16:42:15:494 EET] 0000002a SystemOut O log4j: setFile ended
    [18.12.2015 16:42:15:495 EET] 0000002a SystemOut O log4j: Appender [file] to be rolled at midnight.
    [18.12.2015 16:42:15:495 EET] 0000002a SystemOut O log4j: Adding appender named [file] to category [org].
    [18.12.2015 16:42:15:496 EET] 0000002a SystemOut O log4j: Class name: [org.apache.log4j.ConsoleAppender]
    [18.12.2015 16:42:15:498 EET] 0000002a SystemOut O log4j: Setting property [target] to [System.out].
    [18.12.2015 16:42:15:498 EET] 0000002a SystemOut O log4j: Setting property [threshold] to [INFO].
    [18.12.2015 16:42:15:499 EET] 0000002a SystemOut O log4j: Parsing layout of class: “org.apache.log4j.PatternLayout”
    [18.12.2015 16:42:15:499 EET] 0000002a SystemOut O log4j: Setting property [conversionPattern] to [[%d{ISO8601}] – %m%n].
    [18.12.2015 16:42:15:499 EET] 0000002a SystemOut O log4j: Adding appender named [stdout] to category [org].
    [18.12.2015 16:42:15:499 EET] 0000002a SystemOut O log4j: Class name: [org.apache.log4j.net.SMTPAppender]
    [18.12.2015 16:42:15:511 EET] 0000002a SystemOut O log4j: Setting property [bufferSize] to [512].
    [18.12.2015 16:42:15:511 EET] 0000002a SystemOut O log4j: Setting property [SMTPHost] to [mail.isdemir.com.tr].
    [18.12.2015 16:42:15:511 EET] 0000002a SystemOut O log4j: Setting property [from] to [log4j@isdemir.com.tr].
    [18.12.2015 16:42:15:512 EET] 0000002a SystemOut O log4j: Setting property [to] to [makbolat@isdemir.com.tr].
    [18.12.2015 16:42:15:512 EET] 0000002a SystemOut O log4j: Setting property [subject] to [Uygulama Hata Mesaji].
    [18.12.2015 16:42:15:512 EET] 0000002a SystemOut O log4j: Parsing layout of class: “org.apache.log4j.PatternLayout”
    [18.12.2015 16:42:15:512 EET] 0000002a SystemOut O log4j: Setting property [conversionPattern] to [[%d{ISO8601}] – %m%n].
    [18.12.2015 16:42:15:515 EET] 0000002a SystemOut O log4j: Setting property [levelMin] to [TRACE].
    [18.12.2015 16:42:15:515 EET] 0000002a SystemOut O log4j: Setting property [levelMax] to [FATAL].
    [18.12.2015 16:42:15:516 EET] 0000002a SystemOut O log4j: Adding filter of type [class org.apache.log4j.varia.LevelRangeFilter] to appender named [email].
    [18.12.2015 16:42:15:539 EET] 0000002a SystemOut O log4j: Adding appender named [email] to category [org].
    [18.12.2015 16:42:15:541 EET] 0000002a SystemOut O [2015-12-18 16:42:15,541] – —————————–logging something here————————————
    [18.12.2015 16:42:15:768 EET] 00000020 com.ibm.ws.http.internal.VirtualHostImpl A CWWKT0017I: Web application removed (default_host): http://localhost:9081/arquilliantestweb/
    [18.12.2015 16:42:15:769 EET] 00000020 com.ibm.ws.webcontainer.servlet I SRVE0253I: [arquilliantestweb] [/arquilliantestweb] [org.arquillian.example.HelloWorldServlet]: Destroy successful.
    [18.12.2015 16:42:15:776 EET] 00000020 com.ibm.ws.app.manager.internal.statemachine.StopAction A CWWKZ0009I: The application arquilliantestweb has stopped successfully.

  3. Since you mention Java middleware I wanted to ask if this is possible.We have WAS, Spring JMS listeners for MQ and our code that listens for XML requests and converts them to JAXB classes. Everything else is routine. We post to the queue after processing. But I haven’t been able to locate this setup using Arquillian. We face untold miseries because we don’t have this integration test. I have asked the Arquillian forum but didn’t get useful pointers.

  4. Hi,

    following your instructions run into problems during starting the GreeterTest. WLP is started in Eclipse and seems to wait for actions. JUnit test seems to run into a timeout (about 30 seconds) before ending with the following exception.

    I have double checked everything. I also found out that i am not able to connect to WLP by using jconsole. Process is listed and grayed out which indicates that connection is disabled. But i use JDK 1.6 (JMX is enabled by default there).

    I would agree if you argue that this is a local environment problem. But could you give me a hint how to solve it?

    org.jboss.arquillian.container.spi.client.container.LifecycleException: Could not start container
    at org.jboss.arquillian.container.was.wlp_managed_8_5.WLPManagedContainer.start(WLPManagedContainer.java:190)

    Caused by: org.jboss.arquillian.container.spi.client.container.LifecycleException: Unable to retrieve connector address for localConnector of started VM
    at org.jboss.arquillian.container.was.wlp_managed_8_5.WLPManagedContainer.start(WLPManagedContainer.java:185)
    … 61 more

    • Nichole Stewart April 08, 2015

      Hi Karsten,

      Please ensure that your liberty server is stopped. I believe that this will fix the problem that you are seeing. When using the WLP Managed Container with Arquillian your liberty server must always be stopped before starting the JUnit test.

      • Thanks for the comment!

        I found a solution for my problem (I am using Windows 7!):
        When you start a java process, a special file named with the java process id is created in a special directory which is /hsperfdata_. In my case, the user ID part of the folder name was upper case! I changed this to lower case and after that i was able to connect with jconsole and the arquillian connector is now also able to connect to the server.

        (You will get a “Connecting to an already running server is not allowed” message if it already runs.)

        • previous comment looks ugly because of character filtering issue:

          Correction:
          “… a special directory which is usertempdir/hsperfdata_userid/ . In my …”

Join The Discussion

Your email address will not be published. Required fields are marked *