tomee persistence.xml in EJB JAR META-INF crashes my application deployment - persistence.xml

I am using TomEE to deploy an EAR file, that contains one EJB JAR and one WAR.
I want to add entities using the default provider. I have created a resource in tomee.xml to use MySQL DB.
Then I would like to use entity manager so I am trying to create the following persistence.xml in the EJB JAR META-INF directory:
<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
<persistence-unit name="MyProjectDataBase" transaction-type="JTA">
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
<jta-data-source>MyProjectDS</jta-data-source>
<non-jta-data-source>MyProjectDSUnmanaged</non-jta-data-source>
<properties>
<property name="openjpa.jdbc.DBDictionary" value="mysql" />
<property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema" />
</properties>
</persistence-unit>
</persistence>
MyProject & MyProjectUnmanaged are the resources Ids I created in tomee.xml.
Once I add this persistence.xml I get the following exception in catalina.out and my app is not deployed:
SEVERE: Application could not be deployed: /Users/avitale/Development/apache-tomee-jaxrs-1.5.0/apps/projecteam-ear
org.apache.openejb.OpenEJBException: Creating application failed: /Users/avitale/Development/apache-tomee-jaxrs-1.5.0/apps/projecteam-ear: loader (instance of org/apache/catalina/loader/StandardClassLoader): attempted duplicate class definition for name: "org/apache/openejb/cdi/CdiPlugin"
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:940)
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:532)
at org.apache.openejb.assembler.classic.Assembler.buildContainerSystem(Assembler.java:433)
at org.apache.openejb.assembler.classic.Assembler.build(Assembler.java:341)
at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:144)
at org.apache.openejb.OpenEJB.init(OpenEJB.java:290)
at org.apache.tomee.catalina.TomcatLoader.initialize(TomcatLoader.java:231)
at org.apache.tomee.catalina.TomcatLoader.init(TomcatLoader.java:131)
at org.apache.tomee.catalina.ServerListener.lifecycleEvent(ServerListener.java:113)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:401)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:110)
at org.apache.catalina.startup.Catalina.load(Catalina.java:633)
at org.apache.catalina.startup.Catalina.load(Catalina.java:658)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:281)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:450)
Caused by: java.lang.LinkageError: loader (instance of org/apache/catalina/loader/StandardClassLoader): attempted duplicate class definition for name: "org/apache/openejb/cdi/CdiPlugin"
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:295)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at org.apache.openejb.cdi.OptimizedLoaderService.loadWebBeansPlugins(OptimizedLoaderService.java:70)
at org.apache.openejb.cdi.OptimizedLoaderService.load(OptimizedLoaderService.java:53)
at org.apache.openejb.cdi.OptimizedLoaderService.load(OptimizedLoaderService.java:47)
at org.apache.webbeans.plugins.PluginLoader.startUp(PluginLoader.java:75)
at org.apache.openejb.cdi.OpenEJBLifecycle.startApplication(OpenEJBLifecycle.java:159)
at org.apache.openejb.cdi.ThreadSingletonServiceImpl.initialize(ThreadSingletonServiceImpl.java:150)
at org.apache.openejb.cdi.CdiBuilder.build(CdiBuilder.java:44)
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:794)
... 20 more
Once I remove the persistence.xml then the application is successfully deployed.
Please help me as I don't understand how to proceed :(
Thanks in advance.

Would be helpful if you could specify the version you are actually using.
More over, did you check you won't deliver TomEE or any related dependencies in your EAR file (I mean lib/ or WEB-INF/lib)?
For your information, TomEE 1.5.1 will be released shortly with some fixes around EAR deployments.

Related

ignite upgrade from 2.7 to 2.11 , error occurred during startup

I use ansible install ignite, just replace artiface zip. The error log for the startup script is as follows, it's strange ClassNotFoundException:ZkDiscoveryNodeFailEventData( which occur in 2.7 version).
Caused by: java.lang.ClassNotFoundException: org.apache.ignite.spi.discovery.zk.internal.ZkDiscoveryNodeFailEventData
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at org.apache.ignite.internal.util.IgniteUtils.forName(IgniteUtils.java:9064)
at org.apache.ignite.internal.util.IgniteUtils.forName(IgniteUtils.java:9002)
at org.apache.ignite.marshaller.jdk.JdkMarshallerObjectInputStream.resolveClass(JdkMarshallerObjectInputStream.java:59)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1866)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1749)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2040)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1571)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:431)
at java.util.TreeMap.buildFromSorted(TreeMap.java:2568)
at java.util.TreeMap.buildFromSorted(TreeMap.java:2551)
at java.util.TreeMap.buildFromSorted(TreeMap.java:2508)
at java.util.TreeMap.readObject(TreeMap.java:2454)
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:498)
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1158)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2176)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2067)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1571)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2285)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2209)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2067)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1571)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:431)
at org.apache.ignite.marshaller.jdk.JdkMarshaller.unmarshal0(JdkMarshaller.java:124)
... 11 more
Failed to start grid: Failed to start manager: GridManagerAdapter [enabled=true, name=org.apache.ignite.internal.managers.discovery.GridDiscoveryManager]
Note! You may use 'USER_LIBS' environment variable to specify your classpath.
tail: /opt/rdx/log/ignite/ignite_console.out: file truncated
I have solved this problem , just change zkRootPath from /apacheIgnite to /otherPath, or connect zookeeper shell and rmr /apacheIgnite
<property name="discoverySpi">
<bean class="org.apache.ignite.spi.discovery.zk.ZookeeperDiscoverySpi">
<property name="zkConnectionString" value="ip1:2181,ip2:2181,ip3:2181"/>
<property name="zkRootPath" value="/apacheIgnite"/>
<property name="sessionTimeout" value="400000"/>
</bean>
</property>
besides, you need to delete the data for the paths in the following properties
<property name="storagePath" value="/xxx/persistent" />
<property name="walPath" value="/xxx/wal_store"/>
<property name="walArchivePath" value="/xxx/wal_archive"/>

Configuring Nutch 2.3 with HSQL 2.3.3 - ClassNotFoundException : org/apache/avro/ipc/ByteBufferOutputStream

I'm getting ClassNotFoundException : org/apache/avro/ipc/ByteBufferOutputStream when I run apache Nutch with HSQLDB although I have all the avro related jar files under lib
avro-1.7.6.jar
avro-compiler-1.7.6.jar
avro-ipc-1.7.6.jar
avro-mapred-1.7.6.jar
This is what I did:
Got HSQLDB up and running
root#elephant hsqldb# sudo java -cp /home/hsqldb/hsqldb-2.3.3/hsqldb/lib/hsqldb.jar org.hsqldb.server.Server --props /home/hsqldb/hsqldb-2.3.3/hsqldb/conf/server.properties
[Server#372f7a8d]: [Thread[main,5,main]]: checkRunning(false) entered
[Server#372f7a8d]: [Thread[main,5,main]]: checkRunning(false) exited
[Server#372f7a8d]: Startup sequence initiated from main() method
[Server#372f7a8d]: Loaded properties from [/home/hsqldb/hsqldb-2.3.3/hsqldb/conf/server.properties]
[Server#372f7a8d]: Initiating startup sequence...
[Server#372f7a8d]: Server socket opened successfully in 28 ms.
[Server#372f7a8d]: Database [index=0, id=0, db=file:/home/hsqldb/hsqldb-2.3.3/hsqldb/data/nutch, alias=nutchdb] opened sucessfully in 1406 ms.
[Server#372f7a8d]: Startup sequence completed in 1438 ms.
[Server#372f7a8d]: 2015-12-26 18:30:13.841 HSQLDB server 2.3.3 is online on port 9001
[Server#372f7a8d]: To close normally, connect and execute SHUTDOWN SQL
[Server#372f7a8d]: From command line, use [Ctrl]+[C] to abort abruptly
Configured ivy/ivy.xml
uncommented below lines in ivy.xml
<dependency org="org.apache.gora" name="gora-core" rev="0.5" conf="*->default"/>
and
<dependency org="org.apache.gora" name="gora-sql" rev="0.1.1-incubating"
conf="*->default" />
uncommented the below lines conf/gora.properites
###############################
# Default SqlStore properties #
###############################
gora.sqlstore.jdbc.driver=org.hsqldb.jdbc.JDBCDriver
gora.sqlstore.jdbc.url=jdbc:hsqldb:hsql://localhost/nutchdb
gora.sqlstore.jdbc.user=sa
gora.sqlstore.jdbc.password=
Ran ant build
ant runtime
Added configuration for nutch-site.xml
root#elephant conf# cat nutch-site.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>storage.data.store.class</name>
<value>org.apache.gora.sql.store.SqlStore</value>
</property>
<property>
<name>http.agent.name</name>
<value>NutchCrawler</value>
</property>
<property>
<name>http.robots.agents</name>
<value>NutchCrawler,*</value>
</property>
</configuration>
Created seed.txt under urls folder
Executed the nutch by injecting the urls
[root#elephant local]# bin/nutch inject urls/
InjectorJob: starting at 2015-12-26 19:11:24
InjectorJob: Injecting urlDir: urls
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/avro/ipc/ByteBufferOutputStream
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:259)
at org.apache.nutch.storage.StorageUtils.getDataStoreClass(StorageUtils.java:93)
at org.apache.nutch.storage.StorageUtils.createWebStore(StorageUtils.java:77)
at org.apache.nutch.crawl.InjectorJob.run(InjectorJob.java:218)
at org.apache.nutch.crawl.InjectorJob.inject(InjectorJob.java:252)
at org.apache.nutch.crawl.InjectorJob.run(InjectorJob.java:275)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:65)
at org.apache.nutch.crawl.InjectorJob.main(InjectorJob.java:284)
Caused by: java.lang.ClassNotFoundException: org.apache.avro.ipc.ByteBufferOutputStream
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 9 more
Gora-sql is not supported. Due some licenses issues (if I am not wrong), it became disabled around Gora 0.2.
So I suggest you to use other storage like, for example, HBase.
How to get HBase up&running fast: read answer at https://stackoverflow.com/a/39837926/582789

JBoss not loading inner classes from modules

I have created a new module for my sample.jar. It is having package like sample/example. Under example I have 2 more packages sample1, sample2.
I created module like modules/sample/example and my module.xml is
<module xmlns="urn:jboss:module:1.1" name="sample.example">
<resources>
<resource-root path="sample.jar"/>
<!-- Insert resources here -->
</resources>
In my deployment-structure xml,
<dependencies>
<module name="sample.example" />
</dependencies>
sample.example.sample1.Test class is importing sample.example.sample2.Test2 file
When I am creating object for sample.example.sample1.Test, I am getting below exception.
Exception in thread "main" java.lang.LinkageError: Failed to link sample/example/sample1/Test (Module "sample.example:main" from local module loader #117843d (finder: local module finder #eacb9c (roots: C:\Daten\Softwares\jboss-eap-6.2.0\jboss-eap-6.2\modules,C:\Daten\Softwares\jboss-eap-6.2.0\jboss-eap-6.2\modules\system\layers\base)))
Caused by: java.lang.NoClassDefFoundError: sample/example/sample2/Test2
at java.lang.ClassLoader.defineClass1(Native Method)
Caused by: java.lang.ClassNotFoundException: sample.example.sample2.Test2 from [Module "sample.example:main" from local module loader #117843d (finder: local module finder #eacb9c (roots: C:\Daten\Softwares\jboss-eap-6.2.0\jboss-eap-6.2\modules,C:\Daten\Softwares\jboss-eap-6.2.0\jboss-eap-6.2\modules\system\layers\base))]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:197)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:443)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:431)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:373)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:118)
... 61 more
The module.xml and the JAR should be in the modules\sample\sample\main directory. It looks like in your case C:\Daten\Softwares\jboss-eap-6.2.0\jboss-eap-6.2\modules\sample\sample\main.
You could also use the CLI command module add command.
%JBOSS_HOME%\bin\jboss-cli.bat -c "module add --name=sample.sample --resources=sample.jar"
You could just connect the CLI client too and use tab complete to see all the options as well. The --resource will take the full path to your sample.jar and copy it over into the correct directory and make the module.xml file for you.

Can't use Arquillian with remote WL

I want to use arquillian to create unit tests for a ADF project. The tests should run on a remote WL 10.3.6.
With a weld-container everything is fine but if I change to remote WL I always get the following exception:
java.lang.IllegalArgumentException: ArquillianServletRunner not found. Could not determine ContextRoot from ProtocolMetadata, please contact DeployableContainer developer.
at org.jboss.arquillian.protocol.servlet.ServletUtil.determineBaseURI(ServletUtil.java:64)
at org.jboss.arquillian.protocol.servlet.ServletURIHandler.locateTestServlet(ServletURIHandler.java:60)
at org.jboss.arquillian.protocol.servlet.ServletMethodExecutor.invoke(ServletMethodExecutor.java:84)
at org.jboss.arquillian.container.test.impl.execution.RemoteTestExecuter.execute(RemoteTestExecuter.java:120)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
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.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.execution.ClientTestExecuter.execute(ClientTestExecuter.java:57)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
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.test.impl.client.ContainerEventController.createContext(ContainerEventController.java:142)
at org.jboss.arquillian.container.test.impl.client.ContainerEventController.createTestContext(ContainerEventController.java:129)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
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.createTestContext(TestContextHandler.java:89)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
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.createClassContext(TestContextHandler.java:75)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
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:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
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.test.impl.EventTestRunnerAdaptor.test(EventTestRunnerAdaptor.java:111)
at org.jboss.arquillian.junit.Arquillian$6.evaluate(Arquillian.java:263)
at org.jboss.arquillian.junit.Arquillian$4.evaluate(Arquillian.java:226)
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$5.evaluate(Arquillian.java:240)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:185)
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:236)
at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:147)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
I removed all unneeded stuff to have a very basic setup / project:
pom.xml:
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.company</groupId>
<artifactId>test-arquilian</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-bom</artifactId>
<version>1.1.1.Final</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-wls-remote-12.1</artifactId>
<version>1.0.0.Alpha2</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.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
arquillian.xml
<arquillian xmlns="http://jboss.org/schema/arquillian"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://jboss.org/schema/arquillian
http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
<container qualifier="wls" default="true">
<configuration>
<property name="adminUrl">t3://localhost:7001</property>
<property name="adminUserName">weblogic</property>
<property name="adminPassword">Welcome1</property>
<property name="target">DefaultServer</property>
<property name="wlsHome">C:\space\wls_10_3_6\wlserver_10.3</property>
</configuration>
</container>
</arquillian>
FirstArquilianTest.java
package de.company;
import junit.framework.Assert;
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.JavaArchive;
import org.junit.Test;
import org.junit.runner.RunWith;
#RunWith(Arquillian.class)
public class FirstArquilianTest {
#Deployment
public static JavaArchive createDeployment() {
return ShrinkWrap.create(JavaArchive.class);
}
#Test
public void failTest() {
Assert.fail("Not yet implemented");
}
}
When I start the test I will receive the following output:
Sep 13, 2013 10:51:34 AM org.jboss.arquillian.container.wls.WebLogicDeployerClient deploy
INFO: Starting weblogic.Deployer to deploy the test artifact.
Sep 13, 2013 10:51:38 AM org.jboss.arquillian.container.wls.WebLogicDeployerClient forkWebLogicDeployer
INFO: weblogic.Deployer appears to have terminated successfully.
Sep 13, 2013 10:51:38 AM org.jboss.arquillian.container.wls.WebLogicDeployerClient undeploy
INFO: Starting weblogic.Deployer to undeploy the test artifact.
Sep 13, 2013 10:51:41 AM org.jboss.arquillian.container.wls.WebLogicDeployerClient forkWebLogicDeployer
INFO: weblogic.Deployer appears to have terminated successfully.
If I add a breakpoint I can see that the application is deloyed to the weblogic (in weblogic console). Here everything looks right.
Maybe anyone can help me with this exception?
Update:
I tried it with
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-wls-remote-12.1</artifactId>
<version>1.0.0.Final-SNAPSHOT</version>
but it has the same effect / exception.
I exported the artefact as mentioned in the comments. Here is the output:
Update:
I changed the dep to "arquillian-wls-remote-10.3" and now I receive this exception:
java.lang.ClassNotFoundException: de.company.FirstArquilianTest
at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:297)
at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:270)
at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:64)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:179)
at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(ChangeAwareClassLoader.java:43)
at org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner.executeTest(ServletTestRunner.java:158)
at org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner.execute(ServletTestRunner.java:126)
at org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner.doGet(ServletTestRunner.java:90)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:301)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60)
at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
at java.security.AccessController.doPrivileged(Native Method)
at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:324)
at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:460)
at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60)
at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:163)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3739)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3705)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2282)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2181)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1491)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
After changing to "arquillian-wls-remote-10.3" an ear instead of a war is build. The ear has much more content (web.xml, etc.). Will upload an example.
Here is the zipped ear-File: http://www.guigarage.com/wordpress/wp-content/uploads/2013/09/ear.zip
Solution
You need at least one EJB in your deployment. If no EJB is specified the ear can't be deployed to WL. After adding a EJB everithing was fine. The WL-Test from Arquillian is a great example: https://github.com/arquillian/arquillian-container-wls/blob/master/wls-remote-10.3/src/test/java/org/jboss/arquillian/container/wls/remote_10_3/WebLogicDeployJarTest.java
WLS 10.3.x if I'm not mistaken uses only the Java EE 5 APIs, and hence you'll need to use the arquillian-wls-remote-10.3 artifact for this series of the WLS containers.
arquillian-wls-remote-12.1 is to be used only for WLS 12c.
As for testing JAR deployments on Java EE 5 containers, Arquillian chooses to wrap JARs inside an EAR file to make them deployable. Ideally for Java EE 5 containers, you would create EJB modules as JAR files, and hence this would make sense in such a scenario.
I do not know what you want to test yet, but the advice here is: your ShrinkWrap deployment should mirror the actual deployment you make in production as much as possible. If you're testing EJBs, you should prepare a deployment that includes the EJBs in the same structure as your project build output. If you're testing a POJO that resides in a utility JAR eventually packaged in a WAR/EAR file, then by all means create a ShrinkWrap JavaArchive for the JAR, but wrap it inside a WebArchive or EnterpriseArchive for Java EE 5 containers. You may find that Java EE 6 containers operate differently so you will need revisit these guidelines.
If you want an example test, on how JAR based deployments are tested in WLS 10.3.x, you could take a look at this test in the Arquillian WLS container test suite.

com.impetus.kundera.utils.InvalidConfigurationException: Could not find any META-INF/persistence.xml file in the classpath

I am trying to deploy sample war file build using Kundera on jboss AS7.1.1.final.
Here are the steps which I have followed:
1. created a module (com.impetus.kundera), here is module.xml
<module xmlns="urn:jboss:module:1.1" name="com.impetus.kundera" slot="2.0.7">
<resources>
<resource-root path="kundera-core-2.0.7-SNAPSHOT.jar"/>
<resource-root path="cglib-2.2.jar"/>
<resource-root path="commons-logging-1.1.1.jar"/>
<!-- Insert resources here -->
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.persistence.api"/>
<module name="javax.transaction.api"/>
<module name="javax.validation.api"/>
<module name="org.javassist"/>
<module name="org.slf4j"/>
<module name="org.apache.commons.lang"/>
<module name="org.apache.commons.collections"/>
</dependencies>
Copied resource root path jars under 2.0.7 folder.
Modified persistence.xml for:
<property name="jboss.as.jpa.providerModule"
value="com.impetus.kundera:2.0.7" />
Note: My persistence.xml is under deployment/KunderaSampleApp.war/WEB-INF/classes/META-INF folder, but somehow I am getting given below error:
org.jboss.msc.service.StartException in service
jboss.persistenceunit."KunderaSampleApp.war#personnel_cass_pu": Failed
to start service
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1767)
[jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
[rt.jar:1.6.0_15]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
[rt.jar:1.6.0_15]
at java.lang.Thread.run(Thread.java:619) [rt.jar:1.6.0_15] Caused by: com.impetus.kundera.loader.PersistenceLoaderException:
com.impetus.kundera.utils.InvalidConfigurationException: Could not
find any META-INF/persistence.xml file in the classpath
at com.impetus.kundera.configure.PersistenceUnitConfiguration.configure(PersistenceUnitConfiguration.java:102)
at com.impetus.kundera.configure.Configurator.configure(Configurator.java:63)
at com.impetus.kundera.KunderaPersistence.initializeKundera(KunderaPersistence.java:96)
at com.impetus.kundera.KunderaPersistence.createEntityManagerFactory(KunderaPersistence.java:71)
at com.impetus.kundera.KunderaPersistence.createContainerEntityManagerFactory(KunderaPersistence.java:58)
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:162)
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.start(PersistenceUnitServiceImpl.java:85)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
[jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
[jboss-msc-1.0.2.GA.jar:1.0.2.GA]
... 3 more Caused by: com.impetus.kundera.utils.InvalidConfigurationException: Could not
find any META-INF/persistence.xml file in the classpath
at com.impetus.kundera.configure.PersistenceUnitConfiguration.findPersistenceMetadatas(PersistenceUnitConfiguration.java:130)
at com.impetus.kundera.configure.PersistenceUnitConfiguration.configure(PersistenceUnitConfiguration.java:86)
... 11 more
19:17:46,590 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC00001: Failed to start service
jboss.persistenceunit."KunderaSampleApp.war#address_mongo_pu":
org.jboss.msc.service.StartException in service
jboss.persistenceunit."KunderaSampleApp.war#address_mongo_pu": Failed
to start service
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1767)
[jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
[rt.jar:1.6.0_15]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
[rt.jar:1.6.0_15]
at java.lang.Thread.run(Thread.java:619) [rt.jar:1.6.0_15] Caused by: com.impetus.kundera.loader.PersistenceLoaderException:
com.impetus.kundera.utils.InvalidConfigurationException: Could not
find any META-INF/persistence.xml file in the classpath
at com.impetus.kundera.configure.PersistenceUnitConfiguration.configure(PersistenceUnitConfiguration.java:102)
at com.impetus.kundera.configure.Configurator.configure(Configurator.java:63)
at com.impetus.kundera.KunderaPersistence.initializeKundera(KunderaPersistence.java:96)
at com.impetus.kundera.KunderaPersistence.createEntityManagerFactory(KunderaPersistence.java:71)
at com.impetus.kundera.KunderaPersistence.createContainerEntityManagerFactory(KunderaPersistence.java:58)
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:162)
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.start(PersistenceUnitServiceImpl.java:85)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
[jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
[jboss-msc-1.0.2.GA.jar:1.0.2.GA]
... 3 more Caused by: com.impetus.kundera.utils.InvalidConfigurationException: Could not
find any META-INF/persistence.xml file in the classpath
at com.impetus.kundera.configure.PersistenceUnitConfiguration.findPersistenceMetadatas(PersistenceUnitConfiguration.java:130)
at com.impetus.kundera.configure.PersistenceUnitConfiguration.configure(PersistenceUnitConfiguration.java:86)
... 11 more
It is working absolutely fine with JBoss AS5CR2.
Any pointer to issue will be a great help!
-Vivek
I'm not sure you can just replace the JPA implementation like that. You can have a look at https://community.jboss.org/wiki/HowToUseEclipseLinkWithAS7 which may give some help, but I'm not sure it of any details.
You might have better luck asking in the JBoss Comunity forums.
Also you shouldn't need to add the commons-logging library. Just use <module name="org.apache.commons.logging"/>.