Arquillian Exception:java.lang.NoClassDefFoundError
Issue:
When you deploy and run Arquillian testcase, you may encountered java.lang.NoClassDefFoundError exception like following.
Exception:
15:07:54,364 INFO [org.jboss.as.repository] (management-handler-thread - 13) JBAS014900: Content added at location D:\jboss\standalone\data\content\f4\db8b058b61b2509e8ed692bacb90d9641b5b4e\content
15:07:54,366 INFO [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015876: Starting deployment of "test.war"
15:07:57,922 INFO [org.jboss.as.jpa] (MSC service thread 1-9) JBAS011401: Read persistence.xml for primary
15:07:57,931 INFO [org.jboss.weld.deployer] (MSC service thread 1-8) JBAS016002: Processing weld deployment test.war
15:07:57,932 INFO [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-8) JNDI bindings for session bean named BirdRegistration in deployment unit deployment "test.war" are as follows:
java:global/test/BirdRegistration!net.mytest.xye.service.BirdRegistration
java:app/test/BirdRegistration!net.mytest.xye.service.BirdRegistration
java:module/BirdRegistration!net.mytest.xye.service.BirdRegistration
java:global/test/BirdRegistration
java:app/test/BirdRegistration
java:module/BirdRegistration
15:07:57,941 INFO [org.jboss.weld.deployer] (MSC service thread 1-1) JBAS016005: Starting Services for CDI deployment: test.war
15:07:57,942 INFO [org.jboss.as.jpa] (MSC service thread 1-12) JBAS011402: Starting Persistence Unit Service 'test.war#primary'
15:07:57,943 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-3) JBAS010400: Bound data source [jboss/datasources/XYE-webapp5TestDS]
15:07:57,944 INFO [org.hibernate.ejb.Ejb3Configuration] (MSC service thread 1-12) HHH000204: Processing PersistenceUnitInfo [
name: primary
...]
15:07:57,949 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-12) MSC00001: Failed to start service jboss.persistenceunit."test.war#primary": org.jboss.msc.service.StartException in service jboss.persistenceunit."test.war#primary": 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(Unknown Source) [rt.jar:1.6.0_35]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.6.0_35]
at java.lang.Thread.run(Unknown Source) [rt.jar:1.6.0_35]
Caused by: java.lang.NoClassDefFoundError: net/mytest/xye/model/Sighting
at java.lang.Class.getDeclaredMethods0(Native Method) [rt.jar:1.6.0_35]
at java.lang.Class.privateGetDeclaredMethods(Unknown Source) [rt.jar:1.6.0_35]
at java.lang.Class.getDeclaredMethods(Unknown Source) [rt.jar:1.6.0_35]
at org.hibernate.annotations.common.reflection.java.JavaXClass.getDeclaredMethodProperties(JavaXClass.java:112)
at org.hibernate.annotations.common.reflection.java.JavaXClass.getDeclaredProperties(JavaXClass.java:129)
at org.hibernate.annotations.common.reflection.java.JavaXClass.getDeclaredProperties(JavaXClass.java:121)
at org.hibernate.cfg.InheritanceState.determineDefaultAccessType(InheritanceState.java:262)
at org.hibernate.cfg.InheritanceState.getElementsToProcess(InheritanceState.java:224)
at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:663)
at org.hibernate.cfg.Configuration$MetadataSourceQueue.processAnnotatedClassesQueue(Configuration.java:3406)
at org.hibernate.cfg.Configuration$MetadataSourceQueue.processMetadata(Configuration.java:3360)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1334)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1724)
at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:84)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:904)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:889)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73)
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: java.lang.ClassNotFoundException: net.mytest.xye.model.Sighting from [Module "deployment.test.war:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) [jboss-modules.jar:1.1.1.GA]
... 24 more
15:07:58,166 INFO [org.jboss.as.server] (management-handler-thread - 13) JBAS015870: Deploy of deployment "test.war" was rolled back with failure message {"JBAS014671: Failed services" => {"jboss.persistenceunit.\"test.war#primary\"" => "org.jboss.msc.service.StartException
in service jboss.persistenceunit.\"test.war#primary\": Failed to start service"}}
15:07:58,174 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-9) JBAS010409: Unbound data source [jboss/datasources/XYE-webapp5TestDS]
15:07:58,194 INFO [org.jboss.as.server.deployment] (MSC service thread 1-9) JBAS015877: Stopped deployment test.war in 28ms
15:07:58,194 INFO [org.jboss.as.controller] (management-handler-thread - 13) JBAS014774: Service status report
JBAS014777: Services which failed to start: service jboss.persistenceunit."test.war#primary": org.jboss.msc.service.StartException in service jboss.persistenceunit."test.war#primary": Failed to start service
Solution:
Please add missed class 'Sighting.class' to TestArchive, such as
@Deployment public static Archive<?> createTestArchive() { return ShrinkWrap.create(WebArchive.class, "test.war") .addClasses(Bird.class, Sighting.class, BirdRegistration.class, Resources.class) .addAsResource("META-INF/test-persistence.xml", "META-INF/persistence.xml") .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml") // Deploy our test datasource .addAsWebInfResource("test-ds.xml", "test-ds.xml"); }
Arquillian Exception:java.lang.NoClassDefFoundError的更多相关文章
- exception java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11GraphicsEnvironment
exception java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11GraphicsEnvironmen ...
- Error:java: Internal compiler error: java.lang.Exception: java.lang.NoClassDefFoundError解决
场景:将Eclipse的可以运行的项目转到IDEA发现一个奇怪的错误 今天用IDEA2018.1运行SpringBoot项目报错如下: Error:java: Internal compiler er ...
- 错误处理:java.lang.NoClassDefFoundError: org/apache/taglibs/standard/tag/rt/core/ForEachTag
在使用JSP.Servlet进行开发时,遇到java.lang.NoClassDefFoundError: org/apache/taglibs/standard/tag/rt/core/ForEac ...
- java.lang.NoClassDefFoundError: org/apache/commons/io/output/DeferredFileOutputStream(转)
java.lang.NoClassDefFoundError: org/apache/commons/io/output/DeferredFileOutputStream 使用Tomcat的Manag ...
- java.lang.NoClassDefFoundError: org/apache/jsp/jsp/Container_jsp
1.错误描述 八月 20, 2014 7:10:18 下午 org.apache.catalina.core.StandardWrapperValve invoke 严重: Servlet.servi ...
- spring boot 启动报 java.lang.NoClassDefFoundError: ch/qos/logback/core/spi/LifeCycle 错误
Failed to instantiate SLF4J LoggerFactory Reported exception: java.lang.NoClassDefFoundError: ch/qos ...
- Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
学习架构探险,从零开始写Java Web框架时,在学习到springAOP时遇到一个异常: "C:\Program Files\Java\jdk1.7.0_40\bin\java" ...
- zookeeper_service 出错 java.lang.NoClassDefFoundError: org/I0Itec/zkclient/exception/ZkNoNodeException
2016-12-18 08:28:07 ContextLoader:358 ERROR - Context initialization failed java.lang.NoClassDefFoun ...
- Java AOP nested exception is java.lang.NoClassDefFoundError: org/aopalliance/aop/Advice || Error creating bean with name 'org.springframework.aop.aspectj.AspectJPointcutAdvisor#0' 两个异常解决办法
贴出applicationContext.xml <?xml version="1.0" encoding="UTF-8"?> <beans ...
随机推荐
- 使用Unity NGUI-InputField组件输入时发现显示为白色就是看不到字体
今天在接入android支付宝 SDK时,打包运行时,发现使用Unity NGUI-InputField组件输入时发现显示为白色就是看不到字体,查找一下发现是与android交互存在的问题, 只需在A ...
- mysql免安装版下载及配置教程
第一步:下载 下载地址:http://dev.mysql.com/downloads/mysql/ 滚动到下方就能看到了,根据自己的需求下载: 我的电脑为64为的所以下载的为 Windows (x86 ...
- jQuery简单笔记
jQuery 是一个 JavaScript 库,简化了 JavaScript 的编程. 语法:$(selector).action() selector 是字符串,表示HTML元素. 对象 符号 例子 ...
- TRIM ,LTRIM ,RTRIM ,空格过滤
- MySQL中UTF8编码的数据在cmd下乱码
MySQL中UTF8编码的数据在cmd下乱,在数据库ide中看到的却是中文. 其实,原因是cmd用gbk的格式来显示数据,那么我们只需要将utf-8存储的数据用gbk的格式输出到cmd即可. 解决方法 ...
- JavaScript数据结构和算法----栈
前言 栈是一种遵循后进先出(LIFO)原则的有序集合,新添加的或待删除的元素都保存在栈的末尾,称作栈顶,另外一端就叫栈底.在栈里,新元素都靠近栈顶,旧元素都接近栈底.可以想象桌上的一叠书,或者厨房里的 ...
- ubuntu部署mipsel64交叉编译环境
最近找到个不错的交叉工具链,据传能够编译mipsel64的程序,决定试试. 首先当然是安装环境: apt install -y gcc libncursesada3-dev 下载,解压,进入 三部曲: ...
- 牛客网编程练习之PAT乙级(Basic Level):1033 害死人不偿命的(3n+1)猜想
3n+1水题.... AC代码: import java.util.Scanner; /** * @author CC11001100 */ public class Main { public st ...
- Node.js 加密
稳定性: 2 - 不稳定; 正在讨论未来版本的 API 改进,会尽量减少重大变化.详见后文. 使用 require('crypto') 来访问这个模块. 加密模块提供了 HTTP 或 HTTPS 连接 ...
- 在web应用中使用Log4j 2
Using Log4j 2 inWeb Applications (在web应用中使用Log4j 2) 来源:http://logging.apache.org/log4j/2.x/manual/we ...