Exception 'java.lang.ClassNotFoundException: com.google.inject.servlet.ServletModuleTargetVisitor' happens when deploying REST application

Solution Unverified - Updated -

Issue

We are developing REST application which is using spring-boot and Rule Engine.
When deploying the application, the following exception happens.

15:08:26,257 WARN  [org.jboss.modules] (ServerService Thread Pool -- 60) Failed to define class org.eclipse.sisu.inject.DefaultRankingFunction$ServletVisitor in Module "deployment.spring-boot-sample-0.0.1-SNAPSHOT.war:main" from Service Module Loader: java.lang.LinkageError: Failed to link org/eclipse/sisu/inject/DefaultRankingFunction$ServletVisitor (Module "deployment.spring-boot-sample-0.0.1-SNAPSHOT.war:main" from Service Module Loader)
 ...
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) [spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) [spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) [spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE]
    at org.springframework.boot.web.support.SpringBootServletInitializer.run(SpringBootServletInitializer.java:151) [spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE]
    at org.springframework.boot.web.support.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:131) [spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE]
    at org.springframework.boot.web.support.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:86) [spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE]
    at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:169) [spring-web-4.3.9.RELEASE.jar:4.3.9.RELEASE]
    at org.jboss.as.web.deployment.JBossContextConfig.lifecycleEvent(JBossContextConfig.java:187) [jboss-as-web-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:115) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:3775) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
    at org.jboss.as.web.deployment.WebDeploymentService.doStart(WebDeploymentService.java:163) [jboss-as-web-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
    at org.jboss.as.web.deployment.WebDeploymentService.access$000(WebDeploymentService.java:61) [jboss-as-web-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
    at org.jboss.as.web.deployment.WebDeploymentService$1.run(WebDeploymentService.java:96) [jboss-as-web-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [rt.jar:1.8.0_91]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) [rt.jar:1.8.0_91]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_91]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_91]
    at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_91]
    at org.jboss.threads.JBossThread.run(JBossThread.java:122)
Caused by: java.lang.NoClassDefFoundError: com/google/inject/servlet/ServletModuleTargetVisitor
    at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.8.0_91]
    at java.lang.ClassLoader.defineClass(ClassLoader.java:763) [rt.jar:1.8.0_91]
    at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:361) [jboss-modules.jar:1.3.6.Final-redhat-1]
    at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:482) [jboss-modules.jar:1.3.6.Final-redhat-1]
    ... 89 more
Caused by: java.lang.ClassNotFoundException: com.google.inject.servlet.ServletModuleTargetVisitor from [Module "deployment.spring-boot-sample-0.0.1-SNAPSHOT.war:main" from Service Module Loader]
    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:213) [jboss-modules.jar:1.3.6.Final-redhat-1]
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:459) [jboss-modules.jar:1.3.6.Final-redhat-1]
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:408) [jboss-modules.jar:1.3.6.Final-redhat-1]
    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:389) [jboss-modules.jar:1.3.6.Final-redhat-1]
    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:134) [jboss-modules.jar:1.3.6.Final-redhat-1]
    ... 93 more

How can we avoid this?

Environment

  • Red Hat JBoss BRMS
    • 6.4.0
  • Red Hat JBoss EAP
    • 6.4.x
  • spring-boot

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content