I'm trying to debug an ugly issue I really don't understand - not sure if it is a bug or not.
I have an application which works fine, using this pattern:
ServiceLocator locator = ServiceLocatorFactory.getInstance().create(serviceLocatorName);
ServiceLocatorUtilities.addClasses(locator, ac.getAnnotatedClasses())
The annotated class list is coming from this utility: https://github.com/VA-CTT/HK2Utilities
Which essentially finds all HK2 annotated classes on the classpath without relying on the inhabitant files.
Then:
locator.getService(RunLevelController.class).proceedTo(runLevel);
Which brings up a bunch of service-style classes in my system.
All of this works fine in a stand-alone app.
Now, I'm trying to deploy within GlassFish, while also using Jersey.
In this environment, the deployment fails with a mess of exceptions along these lines:
org.glassfish.hk2.api.UnsatisfiedDependencyException: There was no object available for injection at SystemInjecteeImpl(requiredType=AsyncRunLevelContext,parent=RunLevelContext,qualifiers={},position=0,optional=false,self=false,unqualified=null,853404053)
at org.jvnet.hk2.internal.ThreeThirtyResolver.resolve(ThreeThirtyResolver.java:75)
at org.jvnet.hk2.internal.ClazzCreator.resolve(ClazzCreator.java:211)
at org.jvnet.hk2.internal.ClazzCreator.resolveAllDependencies(ClazzCreator.java:228)
at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:357)
at org.jvnet.hk2.internal.AutoActiveDescriptor.create(AutoActiveDescriptor.java:150)
at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:463)
at org.jvnet.hk2.internal.SingletonContext$1.compute(SingletonContext.java:83)
at org.jvnet.hk2.internal.SingletonContext$1.compute(SingletonContext.java:71)
at org.glassfish.hk2.utilities.cache.Cache$OriginThreadAwareFuture$1.call(Cache.java:97)
at java.util.concurrent.FutureTask.run(Unknown Source)
at org.glassfish.hk2.utilities.cache.Cache$OriginThreadAwareFuture.run(Cache.java:154)
at org.glassfish.hk2.utilities.cache.Cache.compute(Cache.java:199)
at org.jvnet.hk2.internal.SingletonContext.findOrCreate(SingletonContext.java:122)
at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2072)
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:114)
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:88)
at org.jvnet.hk2.internal.ServiceLocatorImpl._resolveContext(ServiceLocatorImpl.java:2088)
at org.jvnet.hk2.internal.ServiceLocatorImpl.access$000(ServiceLocatorImpl.java:121)
at org.jvnet.hk2.internal.ServiceLocatorImpl$3.compute(ServiceLocatorImpl.java:181)
at org.jvnet.hk2.internal.ServiceLocatorImpl$3.compute(ServiceLocatorImpl.java:177)
at org.glassfish.hk2.utilities.cache.Cache$OriginThreadAwareFuture$1.call(Cache.java:97)
at java.util.concurrent.FutureTask.run(Unknown Source)
at org.glassfish.hk2.utilities.cache.Cache$OriginThreadAwareFuture.run(Cache.java:154)
at org.glassfish.hk2.utilities.cache.Cache.compute(Cache.java:199)
at org.jvnet.hk2.internal.ServiceLocatorImpl.resolveContext(ServiceLocatorImpl.java:2107)
at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2050)
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:114)
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:88)
at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.oneJob(CurrentTaskFuture.java:1213)
at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.run(CurrentTaskFuture.java:1144)
at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$UpOneLevel.run(CurrentTaskFuture.java:762)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
MultiException stack 2 of 5
java.lang.IllegalArgumentException: While attempting to resolve the dependencies of org.glassfish.hk2.runlevel.RunLevelContext errors were found
at org.jvnet.hk2.internal.ClazzCreator.resolveAllDependencies(ClazzCreator.java:246)
at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:357)
at org.jvnet.hk2.internal.AutoActiveDescriptor.create(AutoActiveDescriptor.java:150)
at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:463)
at org.jvnet.hk2.internal.SingletonContext$1.compute(SingletonContext.java:83)
at org.jvnet.hk2.internal.SingletonContext$1.compute(SingletonContext.java:71)
at org.glassfish.hk2.utilities.cache.Cache$OriginThreadAwareFuture$1.call(Cache.java:97)
at java.util.concurrent.FutureTask.run(Unknown Source)
at org.glassfish.hk2.utilities.cache.Cache$OriginThreadAwareFuture.run(Cache.java:154)
at org.glassfish.hk2.utilities.cache.Cache.compute(Cache.java:199)
at org.jvnet.hk2.internal.SingletonContext.findOrCreate(SingletonContext.java:122)
at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2072)
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:114)
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:88)
at org.jvnet.hk2.internal.ServiceLocatorImpl._resolveContext(ServiceLocatorImpl.java:2088)
at org.jvnet.hk2.internal.ServiceLocatorImpl.access$000(ServiceLocatorImpl.java:121)
at org.jvnet.hk2.internal.ServiceLocatorImpl$3.compute(ServiceLocatorImpl.java:181)
at org.jvnet.hk2.internal.ServiceLocatorImpl$3.compute(ServiceLocatorImpl.java:177)
at org.glassfish.hk2.utilities.cache.Cache$OriginThreadAwareFuture$1.call(Cache.java:97)
at java.util.concurrent.FutureTask.run(Unknown Source)
at org.glassfish.hk2.utilities.cache.Cache$OriginThreadAwareFuture.run(Cache.java:154)
at org.glassfish.hk2.utilities.cache.Cache.compute(Cache.java:199)
at org.jvnet.hk2.internal.ServiceLocatorImpl.resolveContext(ServiceLocatorImpl.java:2107)
at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2050)
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:114)
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:88)
at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.oneJob(CurrentTaskFuture.java:1213)
at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.run(CurrentTaskFuture.java:1144)
at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$UpOneLevel.run(CurrentTaskFuture.java:762)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
MultiException stack 3 of 5
java.lang.IllegalStateException: Unable to perform operation: resolve on org.glassfish.hk2.runlevel.RunLevelContext
at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:386)
at org.jvnet.hk2.internal.AutoActiveDescriptor.create(AutoActiveDescriptor.java:150)
at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:463)
at org.jvnet.hk2.internal.SingletonContext$1.compute(SingletonContext.java:83)
at org.jvnet.hk2.internal.SingletonContext$1.compute(SingletonContext.java:71)
at org.glassfish.hk2.utilities.cache.Cache$OriginThreadAwareFuture$1.call(Cache.java:97)
at java.util.concurrent.FutureTask.run(Unknown Source)
at org.glassfish.hk2.utilities.cache.Cache$OriginThreadAwareFuture.run(Cache.java:154)
at org.glassfish.hk2.utilities.cache.Cache.compute(Cache.java:199)
at org.jvnet.hk2.internal.SingletonContext.findOrCreate(SingletonContext.java:122)
at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2072)
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:114)
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:88)
at org.jvnet.hk2.internal.ServiceLocatorImpl._resolveContext(ServiceLocatorImpl.java:2088)
at org.jvnet.hk2.internal.ServiceLocatorImpl.access$000(ServiceLocatorImpl.java:121)
at org.jvnet.hk2.internal.ServiceLocatorImpl$3.compute(ServiceLocatorImpl.java:181)
at org.jvnet.hk2.internal.ServiceLocatorImpl$3.compute(ServiceLocatorImpl.java:177)
at org.glassfish.hk2.utilities.cache.Cache$OriginThreadAwareFuture$1.call(Cache.java:97)
at java.util.concurrent.FutureTask.run(Unknown Source)
at org.glassfish.hk2.utilities.cache.Cache$OriginThreadAwareFuture.run(Cache.java:154)
at org.glassfish.hk2.utilities.cache.Cache.compute(Cache.java:199)
at org.jvnet.hk2.internal.ServiceLocatorImpl.resolveContext(ServiceLocatorImpl.java:2107)
at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2050)
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:114)
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:88)
at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.oneJob(CurrentTaskFuture.java:1213)
at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.run(CurrentTaskFuture.java:1144)
at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$UpOneLevel.run(CurrentTaskFuture.java:762)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
MultiException stack 4 of 5
java.lang.IllegalStateException: While attempting to create a service for SystemDescriptor(
implementation=gov.vha.isaac.ochre.api.util.WorkExecutors
contracts={gov.vha.isaac.ochre.api.util.WorkExecutors}
scope=org.glassfish.hk2.runlevel.RunLevel
qualifiers={}
descriptorType=CLASS
descriptorVisibility=NORMAL
metadata=runLevelValue={-1},runLevelMode={1}
rank=0
loader=null
proxiable=null
proxyForSameScope=null
analysisName=default
id=62
locatorId=8
identityHashCode=1392457865
reified=true) in scope org.glassfish.hk2.runlevel.RunLevel an error occured while locating the context
at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2055)
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:114)
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:88)
at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.oneJob(CurrentTaskFuture.java:1213)
at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.run(CurrentTaskFuture.java:1144)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
MultiException stack 5 of 5
java.lang.IllegalStateException: While attempting to create a service for SystemDescriptor(
implementation=gov.vha.isaac.ochre.api.util.WorkExecutors
contracts={gov.vha.isaac.ochre.api.util.WorkExecutors}
scope=org.glassfish.hk2.runlevel.RunLevel
qualifiers={}
descriptorType=CLASS
descriptorVisibility=NORMAL
metadata=runLevelValue={-1},runLevelMode={1}
rank=0
loader=null
proxiable=null
proxyForSameScope=null
analysisName=default
id=11
locatorId=8
identityHashCode=1088961042
reified=true) in scope org.glassfish.hk2.runlevel.RunLevel an error occured while locating the context
at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2055)
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:114)
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:88)
at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.oneJob(CurrentTaskFuture.java:1213)
at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.run(CurrentTaskFuture.java:1144)
at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$UpOneLevel.run(CurrentTaskFuture.java:762)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
I know that the AsyncRunLevelContext is in the system - I'm printing this out when I add it to my locator:
[2016-02-03T18:35:21.786-0500] [glassfish 4.1] [INFO] [] [] [tid: _ThreadID=97 _ThreadName=Thread-8] [timeMillis: 1454542521786] [levelValue: 800] [[
2016-02-03 18:35:21,786 DEBUG [admin-listener(7)] HK2Utilities.HK2RuntimeInitializer (HK2RuntimeInitializer.java:113) - Added SystemDescriptor(
implementation=org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext
contracts={org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext}
scope=javax.inject.Singleton
qualifiers={}
descriptorType=CLASS
descriptorVisibility=LOCAL
metadata=
rank=0
loader=null
proxiable=null
proxyForSameScope=null
analysisName=default
id=39
locatorId=8
identityHashCode=2097701558
reified=true)]]
So I can't understand why this isn't being found.
I know that there is a potential issue with multiple ServiceLocators, because Jersey has already started one. I have also tried various permutations of setting the ServiceLocator from Jersey as my parent service locator, or calling the bridging methods to try to bridge my service locator to the jersey service locator (and the reverse) but that only seems to result in deeper error traces.
But the two service locators really shouldn't need to interact - it doesn't seem like I should need to care if Jersey is also using a ServiceLocator.
I suppose another thing I haven't investigated is the interaction between glassfish providing HK2 libraries, and my war file also including libraries. Could multiple copies of the HK2 libraries on the classpath lead to this?
Any ideas?
-edit-
Some additional information.
I tried doing this, before changing the runlevel:
looker.getService(AsyncRunLevelContext.class)
And it returns the service, as expected.
Next, I stripped out all of the HK2 jar files from my war file - to ensure that only the HK2 implementation provided by GlassFish was on the classpath.
This made this happen (when I asked for the AsyncRunLevelContext):
[2016-02-03T21:14:30.483-0500] [glassfish 4.1] [SEVERE] [] [javax.enterprise.web] [tid: _ThreadID=46 _ThreadName=admin-listener(1)] [timeMillis: 1454552070483] [levelValue: 1000] [[
WebModule[/isaac-rest-1.0-SNAPSHOT]StandardWrapper.Throwable
java.lang.NoClassDefFoundError: org/glassfish/hk2/runlevel/internal/AsyncRunLevelContext
at gov.vha.isaac.ochre.api.LookupService.get(LookupService.java:114)
at gov.vha.isaac.rest.ApplicationConfig.onStartup(ApplicationConfig.java:55)
at org.glassfish.jersey.server.ApplicationHandler.onStartup(ApplicationHandler.java:1165)
at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:172)
at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:362)
at javax.servlet.GenericServlet.init(GenericServlet.java:244)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1583)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1382)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5732)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:5977)
at com.sun.enterprise.web.WebModule.start(WebModule.java:691)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:1041)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:1024)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:747)
at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:2286)
at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1932)
at com.sun.enterprise.web.WebApplication.start(WebApplication.java:139)
at org.glassfish.internal.data.EngineRef.start(EngineRef.java:122)
at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:291)
at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:352)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:500)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:539)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:535)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Unknown Source)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:534)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:565)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:557)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Unknown Source)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:556)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1464)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:109)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1846)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1722)
at org.glassfish.admin.rest.utils.ResourceUtil.runCommand(ResourceUtil.java:253)
at org.glassfish.admin.rest.utils.ResourceUtil.runCommand(ResourceUtil.java:231)
at org.glassfish.admin.rest.utils.ResourceUtil.runCommand(ResourceUtil.java:275)
at org.glassfish.admin.rest.resources.TemplateListOfResource.createResource(TemplateListOfResource.java:133)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:144)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:161)
at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:160)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:347)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102)
at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:309)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:292)
at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1139)
at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:375)
at org.glassfish.admin.rest.adapter.RestAdapter$2.service(RestAdapter.java:316)
at org.glassfish.admin.rest.adapter.RestAdapter.service(RestAdapter.java:179)
at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:206)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:180)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:283)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:200)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:132)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:111)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:536)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:591)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:571)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext
at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1783)
at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1633)
... 84 more
]]
Is this a GlassFish bug? Why is this class not on the classpath?
The class comes from hk2-runlevel.jar - which sits in the glassfish/modules/ folder - right next to all of the other HK2 jars.
Looking at the class itself, I see it is defined with:
#Service #Visibility(DescriptorVisibility.LOCAL)
public class AsyncRunLevelContext {
The docs say this:
public enum DescriptorVisibility {
/**
* This descriptor may be seen by all the children service locators
* of the service locator in which this descriptor is bound
*/
NORMAL,
/**
* This descriptor may only be seen by the service locator in
* which it is bound, and not by any of that service locators
* children
*/
LOCAL
}
This only talks about whether it is visible to the service locators... not whether it should be on the classpath. Is GlassFish wrongly pulling this class out of the classpath given to my deployment?
If it is not an option to modify glassfish installation, you still may force glassfish to consider the libs in your web app before the global ones. You just need to provide file glassfish-web.xml in your application along standard web.xml in WEB-INF. Set delegate="false" in the class-loader element of the glassfish-web.xml file. For more documentation, see Glassfish Deployment Guide, section C - Elements of the GlassFish Server Deployment Descriptors.
Note I copied this from the answer given elsewhere about a similar problem and have not tried it myself
Related
The issue is related to Struts v2.3.16 and Struts2 jQuery plugin v3.6.1. It seems like Struts project doesn't support third party plugins like Struts2 jQuery plugin. How to fix an incompatibility of above versions? This is an exception thrown on startup
13:33:33 ERROR (org.apache.struts2.dispatcher.Dispatcher:38) - Dispatcher initialization failed
Unable to load configuration. - bean - jar:file:/D:/Workspaces/tests/jspbean/out/artifacts/exploded/WEB-INF/lib/struts2-jquery-plugin-3.6.1.jar!/struts-plugin.xml:27:125
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:70)
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:445)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:489)
at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:57)
at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:281)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:262)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:107)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4656)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5312)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1553)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:301)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(Unknown Source)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(Unknown Source)
at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:622)
at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:569)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:301)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(Unknown Source)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(Unknown Source)
at javax.management.remote.rmi.RMIConnectionImpl.doOperation(Unknown Source)
at javax.management.remote.rmi.RMIConnectionImpl.access$300(Unknown Source)
at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(Unknown Source)
at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(Unknown Source)
at javax.management.remote.rmi.RMIConnectionImpl.invoke(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
at sun.rmi.transport.Transport$1.run(Unknown Source)
at sun.rmi.transport.Transport$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: Unable to load bean: type:org.apache.struts2.views.TagLibrary class:com.jgeppert.struts2.jquery.views.JqueryTagLibrary - bean - jar:file:/D:/Workspaces/tests/jspbean/out/artifacts/exploded/WEB-INF/lib/struts2-jquery-plugin-3.6.1.jar!/struts-plugin.xml:27:125
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:245)
at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:102)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:234)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67)
... 50 more
Caused by: java.lang.NoClassDefFoundError: org/apache/struts2/views/TagLibrary
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2904)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1173)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1681)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
at com.opensymphony.xwork2.util.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:144)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:216)
... 53 more
Caused by: java.lang.ClassNotFoundException: org.apache.struts2.views.TagLibrary
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
... 62 more
Please use latest version 3.7.0 of Struts2 jQuery Plugin. This version is compatible to Struts 2.3.16.
See Struts2 jQuery Plugin Changelog for more details.
As of Struts 2.3.16 there's no more the interface org.apache.struts2.views.TagLibrary.
You should always use latest version of the plugin.
Please see my other question where I added data source information in JNDI of embedded tomcat.
Now I wish to suppress database metadata initialization sql scripts so I add property , spring.batch.initializer.enabled=false in application.properties, please see this.
When I add this property, I start getting below exception. If I remove this property, all works well.
Not sure what I am missing.
ERROR - 2016-09-05 09:44:46.358; org.springframework.batch.core.step.AbstractStep; Encountered an error executing step step1 in job RCMatcher
org.springframework.jndi.JndiLookupFailureException: JndiObjectTargetSource failed to obtain new target object; nested exception is javax.naming.NameNotFoundException: Name [java:comp/env/jdbc/RCMatcherDS] is not bound in this Context. Unable to find [java:comp].
at org.springframework.jndi.JndiObjectTargetSource.getTarget(JndiObjectTargetSource.java:142)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:192)
at com.sun.proxy.$Proxy37.getConnection(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
at com.sun.proxy.$Proxy37.getConnection(Unknown Source)
at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111)
at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:394)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:474)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:484)
at org.springframework.batch.item.database.JdbcPagingItemReader.doReadPage(JdbcPagingItemReader.java:208)
at org.springframework.batch.item.database.AbstractPagingItemReader.doRead(AbstractPagingItemReader.java:108)
at org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader.read(AbstractItemCountingItemStreamItemReader.java:88)
at org.springframework.batch.item.support.SynchronizedItemStreamReader.read(SynchronizedItemStreamReader.java:55)
at org.springframework.batch.core.step.item.SimpleChunkProvider.doRead(SimpleChunkProvider.java:91)
at org.springframework.batch.core.step.item.SimpleChunkProvider.read(SimpleChunkProvider.java:157)
at org.springframework.batch.core.step.item.SimpleChunkProvider$1.doInIteration(SimpleChunkProvider.java:116)
at org.springframework.batch.repeat.support.RepeatTemplate.getNextResult(RepeatTemplate.java:374)
at org.springframework.batch.repeat.support.RepeatTemplate.executeInternal(RepeatTemplate.java:215)
at org.springframework.batch.repeat.support.RepeatTemplate.iterate(RepeatTemplate.java:144)
at org.springframework.batch.core.step.item.SimpleChunkProvider.provide(SimpleChunkProvider.java:110)
at org.springframework.batch.core.step.item.ChunkOrientedTasklet.execute(ChunkOrientedTasklet.java:69)
at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:406)
at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:330)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
at org.springframework.batch.core.step.tasklet.TaskletStep$2.doInChunkContext(TaskletStep.java:271)
at org.springframework.batch.core.scope.context.StepContextRepeatCallback.doInIteration(StepContextRepeatCallback.java:81)
at org.springframework.batch.repeat.support.TaskExecutorRepeatTemplate$ExecutingRunnable.run(TaskExecutorRepeatTemplate.java:262)
at org.springframework.core.task.SimpleAsyncTaskExecutor$ConcurrencyThrottlingRunnable.run(SimpleAsyncTaskExecutor.java:268)
at java.lang.Thread.run(Unknown Source)
Caused by: javax.naming.NameNotFoundException: Name [java:comp/env/jdbc/RCMatcherDS] is not bound in this Context. Unable to find [java:comp].
at org.apache.naming.NamingContext.lookup(NamingContext.java:817)
at org.apache.naming.NamingContext.lookup(NamingContext.java:174)
at javax.naming.InitialContext.lookup(Unknown Source)
at org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:155)
at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:87)
at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:152)
at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:179)
at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:95)
at org.springframework.jndi.JndiObjectLocator.lookup(JndiObjectLocator.java:106)
at org.springframework.jndi.JndiObjectTargetSource.getTarget(JndiObjectTargetSource.java:135)
... 34 more
I am deploying a Java EE app to Bluemix, and when first request arrives I got this error:
2015-05-20T23:11:58.51+0200 [App/0] OUT [INFO ] FFDC1015I: An
FFDC Incident has been created: "java.util.ServiceConfigurationError:
javax.servlet.ServletContainerInitializer: Provider
org.cloudfoundry.reconfiguration.spring.AutoReconfigurationServletContainerInitializer
could not be instantiated
com.ibm.ws.webcontainer.osgi.DynamicVirtualHost startWebApp" at
ffdc_15.05.20_21.11.58.0.log
It is a piece of code from Liberty Buildpack I think.
Here it is the content file ffdc_15.05.20_21.11.58.0.log (it seems a ClassNotFoundException but as it is not part of my app I don't know what to do):
Exception = java.util.ServiceConfigurationError Source =
com.ibm.ws.webcontainer.osgi.DynamicVirtualHost probeid = startWebApp
Stack Dump = java.util.ServiceConfigurationError:
javax.servlet.ServletContainerInitializer: Provider
org.cloudfoundry.reconfiguration.spring.AutoReconfigurationServletContainerInitializer
could not be instantiated at java.util.ServiceLoader.fail(Unknown
Source) at java.util.ServiceLoader.access$100(Unknown Source) at
java.util.ServiceLoader$LazyIterator.next(Unknown Source) at
java.util.ServiceLoader$1.next(Unknown Source) at
com.ibm.ws.webcontainer.webapp.WebApp.initializeServletContainerInitializers(WebApp.java:2454)
at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:1038)
at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:6396)
at
com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.startWebApp(DynamicVirtualHost.java:446)
at
com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.createRunnableHandler(DynamicVirtualHost.java:248)
at
com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.createRunnableHandler(DynamicVirtualHost.java:313)
at
com.ibm.ws.http.internal.VirtualHostImpl.discriminate(VirtualHostImpl.java:251)
at
com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink.ready(HttpDispatcherLink.java:306)
at
com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:449)
at
com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleNewRequest(HttpInboundLink.java:383)
at
com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.processRequest(HttpInboundLink.java:283)
at
com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.ready(HttpInboundLink.java:254)
at
com.ibm.ws.tcpchannel.internal.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:174)
at
com.ibm.ws.tcpchannel.internal.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:83)
at
com.ibm.ws.tcpchannel.internal.WorkQueueManager.requestComplete(WorkQueueManager.java:504)
at
com.ibm.ws.tcpchannel.internal.WorkQueueManager.attemptIO(WorkQueueManager.java:574)
at
com.ibm.ws.tcpchannel.internal.WorkQueueManager.workerRun(WorkQueueManager.java:929)
at
com.ibm.ws.tcpchannel.internal.WorkQueueManager$Worker.run(WorkQueueManager.java:1018)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source) Caused by:
java.lang.NoClassDefFoundError:
org.springframework.context.ApplicationContextInitializer at
java.lang.ClassLoader.defineClassImpl(Native Method) at
java.lang.ClassLoader.defineClass(Unknown Source) at
com.ibm.ws.classloading.internal.AppClassLoader.definePackageAndClass(AppClassLoader.java:297)
at
com.ibm.ws.classloading.internal.AppClassLoader.findClass(AppClassLoader.java:241)
at java.lang.ClassLoader.loadClassHelper(Unknown Source) at
java.lang.ClassLoader.loadClass(Unknown Source) at
com.ibm.ws.classloading.internal.AppClassLoader.findOrDelegateLoadClass(AppClassLoader.java:390)
at
com.ibm.ws.classloading.internal.AppClassLoader.loadClass(AppClassLoader.java:362)
at java.lang.ClassLoader.loadClass(Unknown Source) at
org.cloudfoundry.reconfiguration.spring.AutoReconfigurationServletContainerInitializer.(AutoReconfigurationServletContainerInitializer.java:33)
at java.lang.J9VMInternals.newInstanceImpl(Native Method) at
java.lang.Class.newInstance(Unknown Source) ... 23 more Caused by:
java.lang.ClassNotFoundException:
org.springframework.context.ApplicationContextInitializer at
com.ibm.ws.classloading.internal.AppClassLoader.findClassCommonLibraryClassLoaders(AppClassLoader.java:412)
at
com.ibm.ws.classloading.internal.AppClassLoader.findClass(AppClassLoader.java:246)
at java.lang.ClassLoader.loadClassHelper(Unknown Source) at
java.lang.ClassLoader.loadClass(Unknown Source) at
com.ibm.ws.classloading.internal.AppClassLoader.findOrDelegateLoadClass(AppClassLoader.java:390)
at
com.ibm.ws.classloading.internal.AppClassLoader.loadClass(AppClassLoader.java:362)
at java.lang.ClassLoader.loadClass(Unknown Source) ... 35 more
Thanks!
I suppose your application is using Spring Framework, and this triggers the Spring Auto-Reconfiguration. If you don't need this auto-reconfiguration support, you can disable it by setting the below environment variable for your application and do a restage:
cf set-env <app-name> JBP_CONFIG_SPRINGAUTORECONFIGURATION "enabled: false"
cf restage <app-name>
I need to use custom html attributes inside JSF components, and for this the only solution that i found is use JSF 2.2, in this way:
<f:passThroughAttribute name="data-toggle" value="modal" />
The problem is that i'm using Spring + Tomcat and i can't change this because i don't have time. Every time that i start my server i got the following error :
Informações: CDI #ViewScoped manager unavailable
java.lang.NoClassDefFoundError: javax/enterprise/context/spi/Contextual
I know this happens because i don't use CDI, but as i said i can't change from Spring to CDI because of time.
How can i solve this problem ? I must use JSF 2.2 (Because custom html attributes) and Spring.
SOLVED:
This problem as solved, i downgrade to JSF 2.2.6 and error stops.
Stack trace:
Fev 01, 2015 4:13:57 PM com.sun.faces.application.view.ViewScopeManager <init>
Informações: CDI #ViewScoped manager unavailable
java.lang.NoClassDefFoundError: javax/enterprise/context/spi/Contextual
at com.sun.faces.application.view.ViewScopeManager.<init>(Unknown Source)
at com.sun.faces.application.view.ViewScopeManager.getInstance(Unknown Source)
at com.sun.faces.application.view.ViewScopeEventListener.processEvent(Unknown Source)
at javax.faces.event.SystemEvent.processListener(Unknown Source)
at javax.faces.event.ComponentSystemEvent.processListener(Unknown Source)
at com.sun.faces.application.ApplicationImpl.processListeners(Unknown Source)
at com.sun.faces.application.ApplicationImpl.invokeListenersFor(Unknown Source)
at com.sun.faces.application.ApplicationImpl.publishEvent(Unknown Source)
at javax.faces.component.UIViewRoot.getViewMap(Unknown Source)
at javax.faces.component.UIViewRoot.getViewMap(Unknown Source)
at com.sun.faces.mgbean.BeanManager$ScopeManager$ViewScopeHandler.handle(Unknown Source)
at com.sun.faces.mgbean.BeanManager$ScopeManager.pushToScope(Unknown Source)
at com.sun.faces.mgbean.BeanManager.createAndPush(Unknown Source)
at com.sun.faces.mgbean.BeanManager.create(Unknown Source)
at com.sun.faces.el.ManagedBeanELResolver.resolveBean(Unknown Source)
at com.sun.faces.el.ManagedBeanELResolver.getValue(Unknown Source)
at com.sun.faces.el.DemuxCompositeELResolver._getValue(Unknown Source)
at com.sun.faces.el.DemuxCompositeELResolver.getValue(Unknown Source)
at org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:71)
at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:189)
at com.sun.faces.facelets.el.TagValueExpression.getValue(Unknown Source)
at javax.faces.component.UIComponentBase$AttributesMap.get(Unknown Source)
at com.sun.faces.el.CompositeComponentAttributesELResolver$ExpressionEvalMap.get(Unknown Source)
at javax.el.MapELResolver.getValue(MapELResolver.java:52)
at com.sun.faces.el.DemuxCompositeELResolver._getValue(Unknown Source)
at com.sun.faces.el.DemuxCompositeELResolver.getValue(Unknown Source)
at org.apache.el.parser.AstValue.getValue(AstValue.java:169)
at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:189)
at com.sun.faces.facelets.el.ContextualCompositeValueExpression.getValue(Unknown Source)
at com.sun.faces.facelets.el.TagValueExpression.getValue(Unknown Source)
at com.sun.faces.application.ApplicationImpl.createComponentApplyAnnotations(Unknown Source)
at com.sun.faces.application.ApplicationImpl.createComponent(Unknown Source)
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.createComponent(Unknown Source)
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(Unknown Source)
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(Unknown Source)
at javax.faces.view.facelets.CompositeFaceletHandler.apply(Unknown Source)
at com.sun.faces.facelets.tag.composite.ImplementationHandler.apply(Unknown Source)
at javax.faces.view.facelets.CompositeFaceletHandler.apply(Unknown Source)
at com.sun.faces.facelets.compiler.NamespaceHandler.apply(Unknown Source)
at com.sun.faces.facelets.compiler.EncodingHandler.apply(Unknown Source)
at com.sun.faces.facelets.impl.DefaultFacelet.include(Unknown Source)
at com.sun.faces.facelets.impl.DefaultFacelet.include(Unknown Source)
at com.sun.faces.facelets.impl.DefaultFaceletContext.includeFacelet(Unknown Source)
at com.sun.faces.facelets.tag.jsf.CompositeComponentTagHandler.applyCompositeComponent(Unknown Source)
at com.sun.faces.facelets.tag.jsf.CompositeComponentTagHandler.applyNextHandler(Unknown Source)
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(Unknown Source)
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(Unknown Source)
at javax.faces.view.facelets.CompositeFaceletHandler.apply(Unknown Source)
at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(Unknown Source)
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(Unknown Source)
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(Unknown Source)
at com.sun.faces.facelets.tag.ui.DefineHandler.applyDefinition(Unknown Source)
at com.sun.faces.facelets.tag.ui.CompositionHandler.apply(Unknown Source)
at com.sun.faces.facelets.impl.DefaultFaceletContext$TemplateManager.apply(Unknown Source)
at com.sun.faces.facelets.impl.DefaultFaceletContext.includeDefinition(Unknown Source)
at com.sun.faces.facelets.tag.ui.InsertHandler.apply(Unknown Source)
at javax.faces.view.facelets.CompositeFaceletHandler.apply(Unknown Source)
at com.sun.faces.facelets.compiler.NamespaceHandler.apply(Unknown Source)
at com.sun.faces.facelets.compiler.EncodingHandler.apply(Unknown Source)
at com.sun.faces.facelets.impl.DefaultFacelet.include(Unknown Source)
at com.sun.faces.facelets.impl.DefaultFacelet.include(Unknown Source)
at com.sun.faces.facelets.impl.DefaultFacelet.include(Unknown Source)
at com.sun.faces.facelets.impl.DefaultFaceletContext.includeFacelet(Unknown Source)
at com.sun.faces.facelets.tag.ui.CompositionHandler.apply(Unknown Source)
at com.sun.faces.facelets.compiler.NamespaceHandler.apply(Unknown Source)
at com.sun.faces.facelets.compiler.EncodingHandler.apply(Unknown Source)
at com.sun.faces.facelets.impl.DefaultFacelet.apply(Unknown Source)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.buildView(Unknown Source)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(Unknown Source)
at com.sun.faces.lifecycle.Phase.doPhase(Unknown Source)
at com.sun.faces.lifecycle.LifecycleImpl.render(Unknown Source)
at javax.faces.webapp.FacesServlet.service(Unknown Source)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:72)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at br.com.jwebbuild.filter.LoginFilter.doFilter(LoginFilter.java:73)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:113)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:395)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:250)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.ClassNotFoundException: javax.enterprise.context.spi.Contextual
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1676)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1521)
... 98 more
I have same problem and found your question on google (i use JSF 2.2.9), with the answer from hwellmann, i added these depency on pom.xml of my maven project:
<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
<version>1.2</version>
</dependency>
and problem solved, thanks!
Did you include the cdi-api.jar in your setup?
That doesn't mean you have to use CDI in your application, but the API classes have to be there to satisfy the dependencies of JSF.
Probably you are using the #ViewScoped from javax.faces.bean, it was added in JSF 2.0. Try using the annotation from javax.faces.view, added in JSF 2.2.
use JSF 2.2.8 or change tomcat to Apache TomEE, or configure CDI+JSF-Tomcat.
Best solution using jsf older versions because in the new versions will dependency from CDI
Im trying to access the SOAP webservice. from the client UI. Im getting the below error message while accessing the webservice. Im not sure what needs to be done to fix this issue. When I put debug points in the client code and run, the same code works fine and Im able to access the webservice fine in debug mode. Please Assist.
DEBUG http-8080-3 org.springframework.ws.soap.server.SoapMessageDispatcher - Endpoint invocation resulted in exception - responding with Fault
org.springframework.ws.soap.saaj.SaajSoapEnvelopeException: Could not access envelope: Unable to create envelope from given source: ; nested exception is com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Unable to create envelope from given source:
at org.springframework.ws.soap.saaj.SaajSoapMessage.getEnvelope(SaajSoapMessage.java:90)
at org.springframework.ws.soap.AbstractSoapMessage.getSoapHeader(AbstractSoapMessage.java:41)
at org.springframework.ws.soap.server.SoapMessageDispatcher.handleHeaders(SoapMessageDispatcher.java:102)
at org.springframework.ws.soap.server.SoapMessageDispatcher.handleRequest(SoapMessageDispatcher.java:92)
at org.springframework.ws.server.MessageDispatcher.dispatch(MessageDispatcher.java:205)
at org.springframework.ws.server.MessageDispatcher.receive(MessageDispatcher.java:168)
at org.springframework.ws.transport.support.WebServiceMessageReceiverObjectSupport.handleConnection(WebServiceMessageReceiverObjectSupport.java:88)
at org.springframework.ws.transport.http.WebServiceMessageReceiverHandlerAdapter.handle(WebServiceMessageReceiverHandlerAdapter.java:57)
at org.springframework.ws.transport.http.MessageDispatcherServlet.doService(MessageDispatcherServlet.java:197)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:647)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:563)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Unknown Source)
Caused by: com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Unable to create envelope from given source:
at com.sun.xml.internal.messaging.saaj.soap.EnvelopeFactory.createEnvelope(Unknown Source)
at com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPPart1_1Impl.createEnvelopeFromSource(Unknown Source)
at com.sun.xml.internal.messaging.saaj.soap.SOAPPartImpl.getEnvelope(Unknown Source)
at org.springframework.ws.soap.saaj.Saaj13Implementation.getEnvelope(Saaj13Implementation.java:169)
at org.springframework.ws.soap.saaj.SaajSoapMessage.getEnvelope(SaajSoapMessage.java:86)
... 24 more
Caused by: javax.xml.transform.TransformerException: javax.xml.transform.TransformerException: org.w3c.dom.DOMException: NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect with regard to namespaces.
at com.icl.saxon.IdentityTransformer.transform(IdentityTransformer.java:92)
at com.sun.xml.internal.messaging.saaj.util.transform.EfficientStreamingTransformer.transform(Unknown Source)
... 29 more
Caused by: javax.xml.transform.TransformerException: org.w3c.dom.DOMException: NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect with regard to namespaces.
at com.icl.saxon.ContentEmitter.startElement(ContentEmitter.java:124)
at org.xml.sax.helpers.XMLFilterImpl.startElement(Unknown Source)
at com.sun.xml.internal.messaging.saaj.util.RejectDoctypeSaxFilter.startElement(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootElementHook(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at org.xml.sax.helpers.XMLFilterImpl.parse(Unknown Source)
at com.icl.saxon.IdentityTransformer.transform(IdentityTransformer.java:90)
... 30 more