FYI:
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-junit-container</artifactId>
<version>1.1.5.Final</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.openejb</groupId>
<artifactId>arquillian-tomee-embedded</artifactId>
<version>2.0.0-SNAPSHOT</version> <!-- or 1.7.0 -->
</dependency>
@MessageDriven
public class AnMdb implements MessageListener {
@Override
public void onMessage(final Message message) {
System.out.println(message);
}
}
and
@RunWith(Arquillian.class)
public class TheTest {
@Deployment
public static Archive<?> war() {
return ShrinkWrap.create(WebArchive.class, "the-test.war")
.addClasses(AnMdb.class);
}
@Resource(name = "AnMdb")
private Queue queue;
@Resource
private ConnectionFactory connectionFactory;
@Test
public void run() throws JMSException, InterruptedException {
final Connection connection = connectionFactory.createConnection();
final Session session = connection.createSession(false, 0);
final MessageProducer producer = session.createProducer(queue);
producer.send(session.createTextMessage("hello"));
producer.close();
session.close();
connection.close();
sleep(10000);
}
}
works as expected (ok code is not that sexy but that was not the purpose ;))
Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau
2014-08-21 22:48 GMT+02:00 Emmanuel Touzery <[email protected]>:
> Hello,
>
> thought you'd like to know, for now I decided to go for a quick solution
> as we have many other tasks waiting and moved to temporarily simply exclude
> the classes using JMS from the shrinkwrap to have at least tests working. Of
> course this prevents us to test the JMS-supported functionnality for now, I
> hope to get back to this soon.
>
> I used this in the createArchive():
> .addPackages(true, Filters.exclude(<regex of the classes to exclude>), <our
> package prefix>)
>
> Regards,
>
>
> Emmanuel
>
> On 21/08/14 15:17, Romain Manni-Bucau wrote:
>>
>> 1) openejb-core-hibernate instead of openejb-core for embedded case ;)
>>
>> 2) same version (ie tomee 1.7)? You can also just drop it and
>> configure what you need in arquillian.xml, what is the difference?
>>
>> arquillian-tomee-*-tests are our test suites modules, don't use it.
>> Pointed out the pom for other dependencies. Basically what you need is
>>
>> http://svn.apache.org/repos/asf/tomee/tomee/trunk/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/resources/arquillian.xml
>> (tomee-remote block)
>>
>>
>> Romain Manni-Bucau
>> Twitter: @rmannibucau
>> Blog: http://rmannibucau.wordpress.com/
>> LinkedIn: http://fr.linkedin.com/in/rmannibucau
>> Github: https://github.com/rmannibucau
>>
>>
>> 2014-08-21 15:11 GMT+02:00 Emmanuel Touzery
>> <[email protected]>:
>>>
>>> Hello,
>>>
>>> great about 1), good to know that's an option. I also considered
>>> running
>>> simply openejb 4.7.0... To me it seems like tomee+ minus some things so I
>>> expected it to work, but it failed at startup, I think due to some JPA
>>> problem (we're also using hibernate...).
>>>
>>> About 2) no in fact I am exactly trying to use the already running
>>> tomee, which is the one that we use to develop the application, which is
>>> tomee+ and which should work fine. There is only one tomee running on my
>>> dev
>>> machine and that is the one I want. Can you make sense of that error, or
>>> tell me where to get a more descriptive one?
>>>
>>> Thank you!
>>>
>>> Emmanuel
>>>
>>>
>>> On 21/08/14 15:06, Romain Manni-Bucau wrote:
>>>>
>>>> Hi
>>>>
>>>> 1) you can use tomee-embedded "+" adding dependencies you need (need
>>>> to spend few time but that works) - this pom
>>>>
>>>>
>>>> http://svn.apache.org/repos/asf/tomee/tomee/trunk/arquillian/arquillian-tomee-tests/pom.xml
>>>> test jaxrs, jaxws, and jms against tomee remote and tomee embedded,
>>>> just few dependencies to add (surely openejb-core to force and maybe
>>>> some activemq)
>>>> 2) your error means you have a tomee or tomcat already running which
>>>> is reused and that's the not one you expected I think
>>>>
>>>>
>>>> Romain Manni-Bucau
>>>> Twitter: @rmannibucau
>>>> Blog: http://rmannibucau.wordpress.com/
>>>> LinkedIn: http://fr.linkedin.com/in/rmannibucau
>>>> Github: https://github.com/rmannibucau
>>>>
>>>>
>>>> 2014-08-21 14:24 GMT+02:00 Emmanuel Touzery
>>>> <[email protected]>:
>>>>>
>>>>> Hello,
>>>>>
>>>>> we have a working arquillian setup with tomee embedded. But we
>>>>> now
>>>>> started using tomee plus instead of the usual tomee, because we are now
>>>>> using also JMS through activeMQ.
>>>>>
>>>>> Now of course the arquillian tests fail because they can't find
>>>>> the
>>>>> JMS
>>>>> bits.
>>>>>
>>>>> Since there is no tomee plus artifact to use instead of the plain
>>>>> arquillian-tomee-embedded, I'm trying to use instead
>>>>> arquillian-tomee-remote
>>>>> and have it connect to a running tomee+ instance on localhost (it
>>>>> should
>>>>> also speed up the tests, saving the tomee embedded startup time).
>>>>>
>>>>> However it fails with an error that I don't understand ("can't
>>>>> get
>>>>> appInfo"). Keep in mind that when configured with embedded tomee
>>>>> everything
>>>>> works fine (except for the JMS part, again).
>>>>>
>>>>> There is really nothing else in the tomee logs. I checked in the
>>>>> tomee
>>>>> logs folder and I believe there is nothing else to be found.
>>>>>
>>>>> Any idea what is the problem, what could I do to fix it or gather
>>>>> more
>>>>> information on the issue?
>>>>>
>>>>> Regards,
>>>>>
>>>>> Emmanuel
>>>>>
>>>>> -------------------------------------------------------
>>>>> T E S T S
>>>>> -------------------------------------------------------
>>>>> Java HotSpot(TM) 64-Bit Server VM warning: ignoring option
>>>>> MaxPermSize=512m;
>>>>> support was removed in 8.0
>>>>> Running XXXXXXXXXXXXXX
>>>>> Aug 21, 2014 2:12:55 PM org.reflections.Reflections scan
>>>>> INFO: Reflections took 191 ms to scan 4 urls, producing 121 keys and
>>>>> 943
>>>>> values
>>>>> Aug 21, 2014 2:12:55 PM
>>>>> org.apache.tomee.arquillian.remote.RemoteTomEEContainer start
>>>>> INFO: TomEE found running on port 8080
>>>>> Aug 21, 2014 2:12:57 PM org.apache.openejb.client.EventLogger log
>>>>> INFO:
>>>>>
>>>>> RemoteInitialContextCreated{providerUri=http://localhost:8080/tomee/ejb}
>>>>> Aug 21, 2014 2:12:57 PM org.apache.openejb.client.EventLogger log
>>>>> INFO:
>>>>>
>>>>> RemoteInitialContextCreated{providerUri=http://localhost:8080/tomee/ejb}
>>>>> Aug 21, 2014 2:12:57 PM
>>>>> org.apache.openejb.arquillian.common.TomEEContainer
>>>>> deploy
>>>>> SEVERE: appInfo was not found for
>>>>> /tmp/arquillian-tomee-app-working-dir/0/test.war, available are:
>>>>> [/home/emmanuel/programs/apache-tomee-plus-1.7.0-1/webapps/ROOT,
>>>>> /home/emmanuel/programs/apache-tomee-plus-1.7.0-1/webapps/tomee,
>>>>> /home/emmanuel/programs/apache-tomee-plus-1.7.0-1/webapps/manager,
>>>>> /home/emmanuel/programs/apache-tomee-plus-1.7.0-1/webapps/host-manager,
>>>>> openejb,
>>>>> /home/emmanuel/programs/apache-tomee-plus-1.7.0-1/webapps/docs]
>>>>> org.apache.openejb.OpenEJBException: can't get appInfo
>>>>> at
>>>>>
>>>>>
>>>>> org.apache.openejb.arquillian.common.TomEEContainer.deploy(TomEEContainer.java:288)
>>>>> at
>>>>>
>>>>>
>>>>> org.jboss.arquillian.container.impl.client.container.ContainerDeployController$3.call(ContainerDeployController.java:161)
>>>>> at
>>>>>
>>>>>
>>>>> org.jboss.arquillian.container.impl.client.container.ContainerDeployController$3.call(ContainerDeployController.java:128)
>>>>> at
>>>>>
>>>>>
>>>>> org.jboss.arquillian.container.impl.client.container.ContainerDeployController.executeOperation(ContainerDeployController.java:271)
>>>>> at
>>>>>
>>>>>
>>>>> org.jboss.arquillian.container.impl.client.container.ContainerDeployController.deploy(ContainerDeployController.java:127)
>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>> at
>>>>>
>>>>>
>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>>>>> at
>>>>>
>>>>>
>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>>>> at java.lang.reflect.Method.invoke(Method.java:483)
>>>>> at
>>>>>
>>>>> org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
>>>>> at
>>>>>
>>>>>
>>>>> org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
>>>>> at
>>>>>
>>>>>
>>>>> org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
>>>>> at
>>>>>
>>>>>
>>>>> org.jboss.arquillian.container.impl.client.container.DeploymentExceptionHandler.verifyExpectedExceptionDuringDeploy(DeploymentExceptionHandler.java:50)
>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>> at
>>>>>
>>>>>
>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>>>>> at
>>>>>
>>>>>
>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>>>> at java.lang.reflect.Method.invoke(Method.java:483)
>>>>> at
>>>>>
>>>>> org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
>>>>> at
>>>>>
>>>>>
>>>>> org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
>>>>> at
>>>>>
>>>>>
>>>>> org.jboss.arquillian.container.impl.client.ContainerDeploymentContextHandler.createDeploymentContext(ContainerDeploymentContextHandler.java:78)
>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>> at
>>>>>
>>>>>
>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>>>>> at
>>>>>
>>>>>
>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>>>> at java.lang.reflect.Method.invoke(Method.java:483)
>>>>> at
>>>>>
>>>>> org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
>>>>> at
>>>>>
>>>>>
>>>>> org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
>>>>> at
>>>>>
>>>>>
>>>>> org.jboss.arquillian.container.impl.client.ContainerDeploymentContextHandler.createContainerContext(ContainerDeploymentContextHandler.java:57)
>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>> at
>>>>>
>>>>>
>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>>>>> at
>>>>>
>>>>>
>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>>>> at java.lang.reflect.Method.invoke(Method.java:483)
>>>>> at
>>>>>
>>>>> org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
>>>>> at
>>>>>
>>>>>
>>>>> org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
>>>>> at
>>>>> org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)
>>>>> at
>>>>> org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115)
>>>>> at
>>>>> org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67)
>>>>> at
>>>>>
>>>>>
>>>>> org.jboss.arquillian.container.impl.client.container.ContainerDeployController$1.perform(ContainerDeployController.java:95)
>>>>> at
>>>>>
>>>>>
>>>>> org.jboss.arquillian.container.impl.client.container.ContainerDeployController$1.perform(ContainerDeployController.java:80)
>>>>> at
>>>>>
>>>>>
>>>>> org.jboss.arquillian.container.impl.client.container.ContainerDeployController.forEachDeployment(ContainerDeployController.java:263)
>>>>> at
>>>>>
>>>>>
>>>>> org.jboss.arquillian.container.impl.client.container.ContainerDeployController.forEachManagedDeployment(ContainerDeployController.java:239)
>>>>> at
>>>>>
>>>>>
>>>>> org.jboss.arquillian.container.impl.client.container.ContainerDeployController.deployManaged(ContainerDeployController.java:79)
>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>> at
>>>>>
>>>>>
>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>>>>> at
>>>>>
>>>>>
>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>>>> at java.lang.reflect.Method.invoke(Method.java:483)
>>>>> at
>>>>>
>>>>> org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
>>>>> at
>>>>>
>>>>>
>>>>> org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
>>>>> at
>>>>>
>>>>>
>>>>> org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
>>>>> at
>>>>>
>>>>>
>>>>> org.eu.ingwar.tools.arquillian.extension.suite.ArquillianSuiteExtension$SuiteDeployer.blockDeployManagedDeploymentsWhenNeeded(ArquillianSuiteExtension.java:128)
>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>> at
>>>>>
>>>>>
>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>>>>> at
>>>>>
>>>>>
>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>>>> at java.lang.reflect.Method.invoke(Method.java:483)
>>>>> at
>>>>>
>>>>> org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
>>>>> at
>>>>>
>>>>>
>>>>> org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
>>>>> at
>>>>> org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)
>>>>> at
>>>>> org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115)
>>>>> at
>>>>> org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67)
>>>>> at
>>>>>
>>>>>
>>>>> org.jboss.arquillian.container.test.impl.client.ContainerEventController.execute(ContainerEventController.java:101)
>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>> at
>>>>>
>>>>>
>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>>>>> at
>>>>>
>>>>>
>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>>>> at java.lang.reflect.Method.invoke(Method.java:483)
>>>>> at
>>>>>
>>>>> org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
>>>>> at
>>>>>
>>>>>
>>>>> org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
>>>>> at
>>>>>
>>>>>
>>>>> org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
>>>>> at
>>>>>
>>>>>
>>>>> org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:75)
>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>> at
>>>>>
>>>>>
>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>>>>> at
>>>>>
>>>>>
>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>>>> at java.lang.reflect.Method.invoke(Method.java:483)
>>>>> at
>>>>>
>>>>> org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
>>>>> at
>>>>>
>>>>>
>>>>> org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
>>>>> at
>>>>>
>>>>>
>>>>> org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:60)
>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>> at
>>>>>
>>>>>
>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>>>>> at
>>>>>
>>>>>
>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>>>> at java.lang.reflect.Method.invoke(Method.java:483)
>>>>> at
>>>>>
>>>>> org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
>>>>> at
>>>>>
>>>>>
>>>>> org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
>>>>> at
>>>>> org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)
>>>>> at
>>>>> org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115)
>>>>> at
>>>>>
>>>>>
>>>>> org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.beforeClass(EventTestRunnerAdaptor.java:80)
>>>>> at
>>>>> org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:182)
>>>>> at
>>>>> org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:314)
>>>>> at
>>>>> org.jboss.arquillian.junit.Arquillian.access$100(Arquillian.java:46)
>>>>> at
>>>>> org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:199)
>>>>> at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
>>>>> at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:147)
>>>>> at
>>>>>
>>>>>
>>>>> org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:254)
>>>>> at
>>>>>
>>>>>
>>>>> org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:149)
>>>>> at
>>>>>
>>>>>
>>>>> org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124)
>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>> at
>>>>>
>>>>>
>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>>>>> at
>>>>>
>>>>>
>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>>>> at java.lang.reflect.Method.invoke(Method.java:483)
>>>>> at
>>>>>
>>>>>
>>>>> org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray2(ReflectionUtils.java:208)
>>>>> at
>>>>>
>>>>>
>>>>> org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:158)
>>>>> at
>>>>>
>>>>>
>>>>> org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:86)
>>>>> at
>>>>>
>>>>>
>>>>> org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
>>>>> at
>>>>>
>>>>> org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:95)
>>>
>>>
>