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的更多相关文章

  1. exception java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11GraphicsEnvironment

      exception java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11GraphicsEnvironmen ...

  2. Error:java: Internal compiler error: java.lang.Exception: java.lang.NoClassDefFoundError解决

    场景:将Eclipse的可以运行的项目转到IDEA发现一个奇怪的错误 今天用IDEA2018.1运行SpringBoot项目报错如下: Error:java: Internal compiler er ...

  3. 错误处理:java.lang.NoClassDefFoundError: org/apache/taglibs/standard/tag/rt/core/ForEachTag

    在使用JSP.Servlet进行开发时,遇到java.lang.NoClassDefFoundError: org/apache/taglibs/standard/tag/rt/core/ForEac ...

  4. java.lang.NoClassDefFoundError: org/apache/commons/io/output/DeferredFileOutputStream(转)

    java.lang.NoClassDefFoundError: org/apache/commons/io/output/DeferredFileOutputStream 使用Tomcat的Manag ...

  5. java.lang.NoClassDefFoundError: org/apache/jsp/jsp/Container_jsp

    1.错误描述 八月 20, 2014 7:10:18 下午 org.apache.catalina.core.StandardWrapperValve invoke 严重: Servlet.servi ...

  6. spring boot 启动报 java.lang.NoClassDefFoundError: ch/qos/logback/core/spi/LifeCycle 错误

    Failed to instantiate SLF4J LoggerFactory Reported exception: java.lang.NoClassDefFoundError: ch/qos ...

  7. 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" ...

  8. 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 ...

  9. 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 ...

随机推荐

  1. 非Unicode编码的软件如何在Windows系统上运行

    我们常常会遇到这样一种情况:点开某些日文软件(我不会说就是galgame( ╯□╰ ))会出现乱码或者直接无法运行. 出现乱码的原因很简单:编码与译码的方式不一致!!!!!!!!!!! 首先大家需要知 ...

  2. 解决 APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tas

    报错信息:APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks! 在网上查了一下,大部分网友分析是c ...

  3. 最新版-MySQL8.0 安装 - 改密码 之坑

    1. 需求背景 最近需要在一台性能一般的电脑上使用数据库,所以决定安装MySQL数据库,以前安装都是使用WorkBench自动化安装,但安装过程太慢占用空间过大,于是下载zip压缩包.之所以选择选择M ...

  4. OpenCv error :unresolved external symbol(链接库没有加上)

    Error 如下:Linking...: error LNK2001: unresolved external symbol _cvDestroyWindow: error LNK2001: unre ...

  5. python基础学习(一)

    python简介 python的创始人为吉多·范罗苏姆(Guido van Rossum),诞生时间1989年圣诞 一.变量的命令规则 1.变量只能由大小写字母.数字和下划线三部分组成,并且不能以数字 ...

  6. Web缓存(一) - HTTP协议缓存

    为什么要使用 Web 缓存 Web缓存一般分为浏览器缓存.代理服务器缓存以及网关缓存,本文主要讲的是 浏览器缓存,其它两种缓存大家自行去了解下. Web 缓存游走于服务器和客户端之间.这个服务器可能是 ...

  7. C实战:强大的程序调试工具GDB

    C实战:强大的程序调试工具GDB 1.基本调试 这里只列举最最常用的GDB命令. 1.1 启动GDB gdb program:准备调试程序.也可以直接进入gdb,再通过file命令加载. 1.2 添加 ...

  8. Shell脚本了解

    一.什么是Shell Shell 是一个用C语言编写的程序,它是用户使用Linux的桥梁.Shell既是一种命令语言,又是一种程序设计语言. Shell 是指一种应用程序,这个应用程序提供了一个界面, ...

  9. OSTC 2015

    上周六去北京参加了OSTC 2015开源技术大会,并分享了<Spark技术内幕>,主要涵盖了Spark Core的核心实现.我主要以WordCount为例,讲解了任务调度的具体实现,资源分 ...

  10. Android Studio精彩案例(二)《仿微信动态点击底部tab切换Fragment》

    转载本专栏文章,请注明出处,尊重原创 .文章博客地址:道龙的博客 现在很多的App要么顶部带有tab,要么就底部带有tab.用户通过点击tab从而切换不同的页面(大部分情况时去切换fragment). ...