我正在尝试将应用程序部署到weblogic服务器,我收到以下错误。
我的classpath中有guava.jar,我尝试了从10岁开始尝试的所有最新版本。有人可以帮我解决这个问题吗?
<Error> <Console> <BEA-240003> <Administration Console encountered the following error: weblogic.application.ModuleException: [HTTP:101216]Servlet: "action" failed to preload on startup in Web application: "...".
java.lang.NoSuchMethodError: com.google.common.util.concurrent.MoreExecutors.sameThreadExecutor()Lcom/google/common/util/concurrent/ListeningExecutorService;
at com.google.common.cache.LocalCache.<clinit>(LocalCache.java:155)
at com.google.common.cache.LocalCache$LocalManualCache.<init>(LocalCache.java:4750)
at com.google.common.cache.LocalCache$LocalLoadingCache.<init>(LocalCache.java:4858)
at com.google.common.cache.CacheBuilder.build(CacheBuilder.java:739)
at com.my.app.servers.UserServer.<clinit>(UserServer.java:42)
at com.my.app.ActionServlet.setAppProperties(DesActionServlet.java:207)
at com.my.app.ActionServlet.init(DesActionServlet.java:167)
at javax.servlet.GenericServlet.init(GenericServlet.java:240)
at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:299)
at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:250)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57)
at weblogic.servlet.internal.StubSecurityHelper.initServletInstance(StubSecurityHelper.java:94)
at weblogic.servlet.internal.StubSecurityHelper.createServlet(StubSecurityHelper.java:82)
at weblogic.servlet.internal.StubLifecycleHelper.createOneInstance(StubLifecycleHelper.java:74)
at weblogic.servlet.internal.StubLifecycleHelper.<init>(StubLifecycleHelper.java:60)
at weblogic.servlet.internal.StubLifecycleHelper.<init>(StubLifecycleHelper.java:34)
at weblogic.servlet.internal.ServletStubImpl.initStubLifecycleHelper(ServletStubImpl.java:624)
at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:565)
at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:1874)
at weblogic.servlet.internal.WebAppServletContext.loadServletsOnStartup(WebAppServletContext.java:1848)
at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1738)
at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:2740)
at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1704)
at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:781)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:213)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:208)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:35)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:70)
at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:212)
at weblogic.application.internal.ExtensibleModuleWrapper.start(ExtensibleModuleWrapper.java:111)
at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:124)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:213)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:208)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:35)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:70)
at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:24)
at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:729)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:35)
at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:258)
at weblogic.application.internal.SingleModuleDeployment.activate(SingleModuleDeployment.java:48)
at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:165)
at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:79)
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate(AbstractOperation.java:582)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.activateDeployment(ActivateOperation.java:148)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCommit(ActivateOperation.java:114)
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(AbstractOperation.java:335)
at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentCommit(DeploymentManager.java:844)
at weblogic.deploy.internal.targetserver.DeploymentManager.activateDeploymentList(DeploymentManager.java:1253)
at weblogic.deploy.internal.targetserver.DeploymentManager.handleCommit(DeploymentManager.java:440)
at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.commit(DeploymentServiceDispatcher.java:163)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doCommitCallback(DeploymentReceiverCallbackDeliverer.java:195)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$100(DeploymentReceiverCallbackDeliverer.java:13)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$2.run(DeploymentReceiverCallbackDeliverer.java:68)
at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:545)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
Caused by: java.lang.NoSuchMethodError: com.google.common.util.concurrent.MoreExecutors.sameThreadExecutor()Lcom/google/common/util/concurrent/ListeningExecutorService;
答案 0 :(得分:11)
看起来你正在运行与你编译的不同版本的Guava。可能你正在对多个版本的Guava运行,你随机得错了。如果您的其他依赖项之一错误地捆绑了Guava,则可能会发生这种情况。
要弄清楚此MoreExecutors
副本的来源,我听说您可以在UserServer
中使用此代码段反思地找到它:
MoreExecutors.class.getProtectionDomain().getCodeSource().getLocation()
答案 1 :(得分:2)
这似乎是一个反复出现的问题([1],[2],[3])。我,我自己也偶然发现了同样的问题。 Weblogic首先加载了自己的(过时的)番石榴lib版本,与你的applcation版本相混淆。
解决方案是将prefer-application-packages
添加到weblogic.xml
或weblogic-application.xml
:
<wls:container-descriptor>
<wls:prefer-application-packages>
<wls:package-name>com.google.common.*</wls:package-name>
</wls:prefer-application-packages>
</wls:container-descriptor>
答案 2 :(得分:1)
这是一个WAR项目吗?或者它只是一个EJB jar?
如果是最新的那个,你有几个选择:
答案 3 :(得分:1)
我遇到了类似的问题。我可以通过向我的EAR添加带有prefer-application-packages的weblogic-application.xml来解决这个问题。
<?xml version="1.0" encoding="UTF-8"?>
<weblogic-application xmlns="http://xmlns.oracle.com/weblogic/weblogic-application"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.oracle.com/weblogic/weblogic-application http://xmlns.oracle.com/weblogic/weblogic-application/1.0/weblogic-application.xsd">
<prefer-application-packages>
<package-name>com.google.common.*</package-name>
</prefer-application-packages>
</weblogic-application>
答案 4 :(得分:0)
我也遇到过这个问题,不幸的是,改变weblogic.xml并不适合我。什么工作,将guava-14.0.1.jar放入$ JAVA_HOME / jre / lib / endorsed(如果它不存在则创建此目录。)
另一个警告:起初我尝试使用更新的guava-18 - 这导致了另一种兼容性问题(MapMaker.makeComputingMap上的IllegalAccessError - 更多细节here)。 Guava 14.0.1对我来说似乎很有吸引力 - MapMaker类已经足够满足WebLogic,而MoreExecutors类足以使Cassandra Java驱动程序工作(这就是我偶然发现这个问题。)
答案 5 :(得分:0)
我设法使用这两个文件解决了这个问题:ear中的weblogic-application.xml和war中的weblogic.xml
这是耳朵中的weblogic-application.xml - &gt;的src /主/应用/ META-INF /
<?xml version="1.0" encoding="UTF-8"?>
<wls:weblogic-application
xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-application"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/javaee_5.xsd http://xmlns.oracle.com/weblogic/weblogic-application http://xmlns.oracle.com/weblogic/weblogic-application/1.4/weblogic-application.xsd">
<wls:prefer-application-packages>
<wls:package-name>com.google.common.*</wls:package-name>
</wls:prefer-application-packages>
</wls:weblogic-application>
这是战争中的weblogic.xml - &gt;的src /主/ web应用/ WEB-INF /
<?xml version="1.0" encoding="UTF-8"?>
<wls:weblogic-application
xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-application"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/javaee_5.xsd http://xmlns.oracle.com/weblogic/weblogic-application http://xmlns.oracle.com/weblogic/weblogic-application/1.4/weblogic-application.xsd">
<wls:prefer-application-packages>
<wls:package-name>com.google.common.*</wls:package-name>
</wls:prefer-application-packages>
</wls:weblogic-application>