我在一场大战中建立了一系列依赖关系,包括较新版本的番石榴,杰克逊等。为了使其能够在Payara Server 5.183上运行,我在其中添加了一个glassfish-web.xml
文件<class-loader delegate="false"/>
标签到我的战争的WEB-INF文件夹中。在Payara Server中,这似乎工作得很好,而且战争愉快地进行。
我还希望能够与Payara Micro进行战争,以便将其打包并以可复制的方式与团队共享。但是当我使用完全相同的战争并运行时:
java -jar payara-micro-5.183.jar --deploy myapp.war --domainConfig domain-micro.xml --rootDir domain/
我收到以下错误消息,听起来像是类加载器问题(尽管可能不是,但我也很乐意接受其他建议)
java.lang.Exception: java.util.ServiceConfigurationError: com.fasterxml.jackson.databind.Module: Provider com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule not a subtype
有什么建议吗?
编辑1:
Java版本:
java version "1.8.0_191"
Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)
完整的堆栈跟踪:
INFO Jsr330Integration:57 - Starting up JSR 330 integration
[2018-11-26T09:11:15.760+0000] [] [←[1;92mINFO←[0m] [AS-WEB-GLUE-00172] [←[1;94mjavax.enterprise.web←[0m] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1543223475760] [levelValue: 800] Loading application [MyApp] at [/MyApp]
[2018-11-26T09:11:15.761+0000] [] [←[1;93mWARNING←[0m] [AS-EJB-00056] [←[1;94mjavax.enterprise.ejb.container←[0m] [tid: _ThreadID=194 _ThreadName=__ejb-thread-pool2] [timeMillis: 1543223475761] [levelValue: 900] A system exception occurred during an invocation on EJB Jsr330Integration, method: publi
c java.lang.Object com.mypackage.bean.jsr330.Jsr330Integration.getInstance(java.lang.Class)
[2018-11-26T09:11:15.775+0000] [] [←[1;93mWARNING←[0m] [] [←[1;94mjavax.enterprise.ejb.container←[0m] [tid: _ThreadID=194 _ThreadName=__ejb-thread-pool2] [timeMillis: 1543223475775] [levelValue: 900] [[
javax.ejb.EJBException: javax.ejb.CreateException: Initialization failed for Singleton Jsr330Integration
at com.sun.ejb.containers.AbstractSingletonContainer$SingletonContextFactory.create(AbstractSingletonContainer.java:736)
at com.sun.ejb.containers.AbstractSingletonContainer.instantiateSingletonInstance(AbstractSingletonContainer.java:438)
at org.glassfish.ejb.startup.SingletonLifeCycleManager.initializeSingleton(SingletonLifeCycleManager.java:219)
at org.glassfish.ejb.startup.SingletonLifeCycleManager.initializeSingleton(SingletonLifeCycleManager.java:180)
at com.sun.ejb.containers.AbstractSingletonContainer.checkInit(AbstractSingletonContainer.java:410)
at com.sun.ejb.containers.AbstractSingletonContainer._getContext(AbstractSingletonContainer.java:183)
at com.sun.ejb.containers.CMCSingletonContainer._getContext(CMCSingletonContainer.java:116)
at com.sun.ejb.containers.BaseContainer.getContext(BaseContainer.java:2627)
at com.sun.ejb.containers.BaseContainer.preInvoke(BaseContainer.java:2020)
at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:210)
at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:90)
at com.sun.proxy.$Proxy302.getInstance(Unknown Source)
at com.mypackage.bean.jsr330.__EJB31_Generated__Jsr330Integration__Intf____Bean__.getInstance(Unknown Source)
at com.mypackage.manager.impl.VolumeClearingManager.setup(VolumeClearingManager.java:706)
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 com.sun.ejb.containers.interceptors.BeanCallbackInterceptor.intercept(InterceptorManager.java:1047)
at com.sun.ejb.containers.interceptors.CallbackChainImpl.invokeNext(CallbackChainImpl.java:72)
at com.sun.ejb.containers.interceptors.CallbackInvocationContext.proceed(CallbackInvocationContext.java:206)
at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.doCall(SystemInterceptorProxy.java:163)
at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.init(SystemInterceptorProxy.java:125)
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 com.sun.ejb.containers.interceptors.CallbackInterceptor.intercept(InterceptorManager.java:998)
at com.sun.ejb.containers.interceptors.CallbackChainImpl.invokeNext(CallbackChainImpl.java:72)
at com.sun.ejb.containers.interceptors.CallbackInvocationContext.proceed(CallbackInvocationContext.java:206)
at org.jboss.weld.module.ejb.AbstractEJBRequestScopeActivationInterceptor.aroundInvoke(AbstractEJBRequestScopeActivationInterceptor.java:72)
at org.jboss.weld.module.ejb.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:52)
at sun.reflect.GeneratedMethodAccessor86.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.sun.ejb.containers.interceptors.CallbackInterceptor.intercept(InterceptorManager.java:998)
at com.sun.ejb.containers.interceptors.CallbackChainImpl.invokeNext(CallbackChainImpl.java:72)
at com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:417)
at com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:380)
at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:2063)
at com.sun.ejb.containers.StatelessSessionContainer.createStatelessEJB(StatelessSessionContainer.java:518)
at com.sun.ejb.containers.StatelessSessionContainer.access$000(StatelessSessionContainer.java:99)
at com.sun.ejb.containers.StatelessSessionContainer$SessionContextFactory.create(StatelessSessionContainer.java:713)
at com.sun.ejb.containers.util.pool.NonBlockingPool.getObject(NonBlockingPool.java:220)
at com.sun.ejb.containers.StatelessSessionContainer._getContext(StatelessSessionContainer.java:442)
at com.sun.ejb.containers.BaseContainer.getContext(BaseContainer.java:2627)
at com.sun.ejb.containers.BaseContainer.preInvoke(BaseContainer.java:2020)
at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:210)
at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:90)
at com.sun.proxy.$Proxy313.cancelOpenVolumeClearings(Unknown Source)
at com.mypackage.manager.impl.__EJB31_Generated__VolumeClearingManager__Intf____Bean__.cancelOpenVolumeClearings(Unknown Source)
at com.mypackage.bean.timer.event.handler.StartUpEventHandler.cancelOpenVolumeClearingProcesses(StartUpEventHandler.java:247)
at com.mypackage.bean.timer.event.handler.StartUpEventHandler.handle(StartUpEventHandler.java:88)
at com.mypackage.bean.timer.TimerBean.timeout(TimerBean.java:74)
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 org.glassfish.ejb.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:953)
at org.glassfish.ejb.security.application.EJBSecurityManager.invoke(EJBSecurityManager.java:1017)
at com.sun.ejb.containers.BaseContainer.invokeBeanMethod(BaseContainer.java:4867)
at com.sun.ejb.EjbInvocation.invokeBeanMethod(EjbInvocation.java:656)
at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:836)
at com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:608)
at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.doCall(SystemInterceptorProxy.java:163)
at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.aroundTimeout(SystemInterceptorProxy.java:145)
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 com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:895)
at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:835)
at com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:608)
at org.jboss.weld.module.ejb.AbstractEJBRequestScopeActivationInterceptor.aroundInvoke(AbstractEJBRequestScopeActivationInterceptor.java:81)
at org.jboss.weld.module.ejb.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:52)
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 com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:895)
at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:835)
at com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:374)
at com.sun.ejb.containers.BaseContainer.__intercept(BaseContainer.java:4839)
at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:4827)
at com.sun.ejb.containers.BaseContainer.callEJBTimeout(BaseContainer.java:4105)
at com.sun.ejb.containers.EJBTimerService.deliverTimeout(EJBTimerService.java:1229)
at com.sun.ejb.containers.EJBTimerService.access$000(EJBTimerService.java:94)
at com.sun.ejb.containers.EJBTimerService$TaskExpiredWork.run(EJBTimerService.java:1964)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: javax.ejb.CreateException: Initialization failed for Singleton Jsr330Integration
at com.sun.ejb.containers.AbstractSingletonContainer.createSingletonEJB(AbstractSingletonContainer.java:564)
at com.sun.ejb.containers.AbstractSingletonContainer.access$000(AbstractSingletonContainer.java:78)
at com.sun.ejb.containers.AbstractSingletonContainer$SingletonContextFactory.create(AbstractSingletonContainer.java:734)
... 92 more
Caused by: java.lang.NullPointerException
at org.glassfish.web.loader.WebappClassLoader.findResourceInternalFromJars(WebappClassLoader.java:2908)
at org.glassfish.web.loader.WebappClassLoader.findResourceInternal(WebappClassLoader.java:2761)
at org.glassfish.web.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2651)
at org.glassfish.web.loader.WebappClassLoader.findClass(WebappClassLoader.java:1067)
at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1624)
at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1505)
at com.google.inject.internal.Initializer.<init>(Initializer.java:59)
at com.google.inject.internal.InternalInjectorCreator.<init>(InternalInjectorCreator.java:63)
at com.google.inject.Guice.createInjector(Guice.java:87)
at com.google.inject.Guice.createInjector(Guice.java:69)
at com.google.inject.Guice.createInjector(Guice.java:59)
at com.mypackage.bean.jsr330.Jsr330Integration.setup(Jsr330Integration.java:59)
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 com.sun.ejb.containers.interceptors.BeanCallbackInterceptor.intercept(InterceptorManager.java:1047)
at com.sun.ejb.containers.interceptors.CallbackChainImpl.invokeNext(CallbackChainImpl.java:72)
at com.sun.ejb.containers.interceptors.CallbackInvocationContext.proceed(CallbackInvocationContext.java:206)
at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.doCall(SystemInterceptorProxy.java:163)
at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.init(SystemInterceptorProxy.java:125)
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 com.sun.ejb.containers.interceptors.CallbackInterceptor.intercept(InterceptorManager.java:998)
at com.sun.ejb.containers.interceptors.CallbackChainImpl.invokeNext(CallbackChainImpl.java:72)
at com.sun.ejb.containers.interceptors.CallbackInvocationContext.proceed(CallbackInvocationContext.java:206)
at org.jboss.weld.module.ejb.AbstractEJBRequestScopeActivationInterceptor.aroundInvoke(AbstractEJBRequestScopeActivationInterceptor.java:72)
at org.jboss.weld.module.ejb.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:52)
at sun.reflect.GeneratedMethodAccessor86.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.sun.ejb.containers.interceptors.CallbackInterceptor.intercept(InterceptorManager.java:998)
at com.sun.ejb.containers.interceptors.CallbackChainImpl.invokeNext(CallbackChainImpl.java:72)
at com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:417)
at com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:380)
at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:2063)
at com.sun.ejb.containers.AbstractSingletonContainer.createSingletonEJB(AbstractSingletonContainer.java:555)
... 94 more
]]
[2018-11-26T09:11:15.847+0000] [] [←[1;92mINFO←[0m] [] [←[1;94mPayaraMicro←[0m] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1543223475847] [levelValue: 800]
{
"Instance Configuration": {
"Host": "BS-DEV-75438.eu.ad.mycorp.com",
"Http Port(s)": "8080",
"Https Port(s)": "",
"Instance Name": "Frail-Fusilier",
"Instance Group": "MicroShoal",
"Hazelcast Member UUID": "dddef61b-bd0c-4faa-9167-0e1ffee5730a",
"Deployed": [
{
"Name": "MyApp",
"Type": "war",
"Context Root": "/MyApp"
}
]
}
}
[2018-11-26T09:11:15.894+0000] [] [←[1;91mSEVERE←[0m] [] [←[1;94mjavax.enterprise.ejb.container←[0m] [tid: _ThreadID=194 _ThreadName=__ejb-thread-pool2] [timeMillis: 1543223475894] [levelValue: 1000] ejb.stateless_ejbcreate_exception
无法加载的类:
package com.mypackage.bean.jsr330;
import com.mypackage.bean.marketdata.MarketDataHandlerBean;
import com.mypackage.bean.notification.NotificationEngine;
import com.mypackage.bean.rankingdata.LpRankingUpdateHandlerBean;
import com.mypackage.eapi.context.Context;
import com.mypackage.eapi.marketdata.MarketDataHandler;
import com.mypackage.eapi.rankingdata.LpRankingUpdateHandler;
import com.mypackage.interfaces.bgc.integration.IntegrationModule;
import com.mypackage.persistence.dao.DaoHolder;
import com.mypackage.persistence.dao.LegalEntityDao;
import com.mypackage.persistence.dao.StrategyDao;
import com.mypackage.persistence.dao.UserDao;
import com.mypackage.persistence.dao.VolumeClearingDao;
import com.mypackage.persistence.redis.dao.RedisFuturePriceDao;
import com.google.inject.AbstractModule;
import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.Key;
import java.util.concurrent.ExecutorService;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.annotation.Resource;
import javax.ejb.EJB;
import javax.ejb.LocalBean;
import javax.ejb.Singleton;
import javax.enterprise.concurrent.ManagedExecutorService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/*
* A little utility to hide Guice implementation of jsr330 so we don't end up using guice specific
* features
*/
@LocalBean
@Singleton
public class Jsr330Integration {
private static final Logger LOG = LoggerFactory.getLogger(Jsr330Integration.class);
private Injector injector;
@Resource
private ManagedExecutorService executor;
@EJB
private MarketDataHandlerBean marketDataHandler;
@EJB
private LpRankingUpdateHandlerBean marketMakerHandlerBean;
@EJB
private NotificationEngine notificationEngine;
@EJB
private TaskRunnerBean taskRunner;
@PostConstruct
public void setup() {
LOG.info("Starting up JSR 330 integration");
injector =
Guice.createInjector(
new IntegrationModule(),
new AbstractModule() {
@Override
protected void configure() {
bind(ExecutorService.class).toInstance(executor);
bind(MarketDataHandler.class).toInstance(marketDataHandler);
bind(LpRankingUpdateHandler.class).toInstance(marketMakerHandlerBean);
bind(NotificationEngine.class).toInstance(notificationEngine);
final DaoHolder instance = DaoHolder.getInstance();
bind(StrategyDao.class).toInstance(instance.getStrategyDao());
bind(RedisFuturePriceDao.class).toInstance(instance.getRedisFuturePriceDao());
bind(UserDao.class).toInstance(instance.getUserDao());
bind(LegalEntityDao.class).toInstance(instance.getLegalEntityDao());
bind(VolumeClearingDao.class).toInstance(instance.getVolumeClearingDao());
bind(TaskRunnerBean.class).toInstance(taskRunner);
}
});
}
@PreDestroy
public void shutdown() {
LOG.info("Shutting down eapi context and all eapi services");
injector.getInstance(Context.class).shutdownServices();
}
public <T> T getInstance(final Class<T> clazz) {
return injector.getInstance(clazz);
}
public <T> T getInstance(final Key<T> var1) {
return injector.getInstance(var1);
}
}