首页 > 解决方案 > weblogic.application.ModuleException:将war文件导出到Weblogic 12c R2时出现org.glassfish.jersey.server.model.ModelValidationException

问题描述

当我的 JAX-RS Web 应用程序导出到 Weblogic 12c R2 时出现问题。链接库有问题吗?还是设置错误?

异常日志堆栈跟踪是打击。

java.lang.Exception: Exception received from deployment driver. See Error Log view for more detail.
	at oracle.eclipse.tools.weblogic.server.internal.DeploymentProgressListener.watch(DeploymentProgressListener.java:193)
	at oracle.eclipse.tools.weblogic.server.internal.WlsJ2EEDeploymentHelper.startModule(WlsJ2EEDeploymentHelper.java:1178)
	at oracle.eclipse.tools.weblogic.server.internal.WlsJ2EEDeploymentHelper.deployAutoGenerateEarApplication(WlsJ2EEDeploymentHelper.java:843)
	at oracle.eclipse.tools.weblogic.server.internal.WeblogicServerBehaviour.publishWeblogicModules(WeblogicServerBehaviour.java:1452)
	at oracle.eclipse.tools.weblogic.server.internal.WeblogicServerBehaviour.publishToServer(WeblogicServerBehaviour.java:944)
	at oracle.eclipse.tools.weblogic.server.internal.WeblogicServerBehaviour.publishOnce(WeblogicServerBehaviour.java:735)
	at oracle.eclipse.tools.weblogic.server.internal.WeblogicServerBehaviour.publish(WeblogicServerBehaviour.java:584)
	at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publish(ServerBehaviourDelegate.java:774)
	at org.eclipse.wst.server.core.internal.Server.publishImpl(Server.java:3182)
	at org.eclipse.wst.server.core.internal.Server$PublishJob.run(Server.java:355)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:56)
Caused by: weblogic.application.ModuleException: org.glassfish.jersey.server.model.ModelValidationException: Validation of the application resource model has failed during application initialization.
[[WARNING] Parameter 1 of type java.lang.Class<?>[] from public void org.apache.cxf.jaxrs.provider.AbstractJAXBProvider.setExtraClass(java.lang.Class<?>[]) is not resolvable to a concrete type.; source='public void org.apache.cxf.jaxrs.provider.AbstractJAXBProvider.setExtraClass(java.lang.Class[])', [WARNING] Parameter 1 of type java.lang.Class<?>[] from public void org.apache.cxf.jaxrs.provider.AbstractJAXBProvider.setExtraClass(java.lang.Class<?>[]) is not resolvable to a concrete type.; source='public void org.apache.cxf.jaxrs.provider.AbstractJAXBProvider.setExtraClass(java.lang.Class[])', [WARNING] Parameter 1 of type java.util.Map<java.lang.String, org.apache.cxf.jaxrs.provider.atom.AtomElementWriter<?, ?>> from public void org.apache.cxf.jaxrs.provider.atom.AtomPojoProvider.setAtomWriters(java.util.Map<java.lang.String, org.apache.cxf.jaxrs.provider.atom.AtomElementWriter<?, ?>>) is not resolvable to a concrete type.; source='public void org.apache.cxf.jaxrs.provider.atom.AtomPojoProvider.setAtomWriters(java.util.Map)', [WARNING] Parameter 1 of type java.util.Map<java.lang.String, org.apache.cxf.jaxrs.provider.atom.AtomElementReader<?, ?>> from public void org.apache.cxf.jaxrs.provider.atom.AtomPojoProvider.setAtomReaders(java.util.Map<java.lang.String, org.apache.cxf.jaxrs.provider.atom.AtomElementReader<?, ?>>) is not resolvable to a concrete type.; source='public void org.apache.cxf.jaxrs.provider.atom.AtomPojoProvider.setAtomReaders(java.util.Map)', [WARNING] Parameter 1 of type java.util.Map<java.lang.String, org.apache.cxf.jaxrs.provider.atom.AbstractAtomElementBuilder<?>> from public void org.apache.cxf.jaxrs.provider.atom.AtomPojoProvider.setAtomBuilders(java.util.Map<java.lang.String, org.apache.cxf.jaxrs.provider.atom.AbstractAtomElementBuilder<?>>) is not resolvable to a concrete type.; source='public void org.apache.cxf.jaxrs.provider.atom.AtomPojoProvider.setAtomBuilders(java.util.Map)', [WARNING] Parameter 1 of type java.lang.Class<?>[] from public void org.apache.cxf.jaxrs.provider.AbstractJAXBProvider.setExtraClass(java.lang.Class<?>[]) is not resolvable to a concrete type.; source='public void org.apache.cxf.jaxrs.provider.AbstractJAXBProvider.setExtraClass(java.lang.Class[])', [FATAL] A resource model has ambiguous (sub-)resource method for HTTP method GET and input mime-types as defined by"@Consumes" and "@Produces" annotations at Java methods public javax.ws.rs.core.Response org.apache.cxf.rs.security.oauth.services.AuthorizationRequestService.authorize() and public javax.ws.rs.core.Response org.apache.cxf.rs.security.oauth2.services.RedirectionBasedGrantService.authorize() at matching regular expression /authorize. These two methods produces and consumes exactly the same mime-types and therefore their invocation as a resource methods will always fail.; source='org.glassfish.jersey.server.model.RuntimeResource@714635c8', [FATAL] A resource model has ambiguous (sub-)resource method for HTTP method GET and input mime-types as defined by"@Consumes" and "@Produces" annotations at Java methods public javax.ws.rs.core.Response org.apache.cxf.rs.security.oauth.services.AuthorizationRequestService.authorizeDecision() and public javax.ws.rs.core.Response org.apache.cxf.rs.security.oauth2.services.RedirectionBasedGrantService.authorizeDecision() at matching regular expression /decision. These two methods produces and consumes exactly the same mime-types and therefore their invocation as a resource methods will always fail.; source='org.glassfish.jersey.server.model.RuntimeResource@2a133e40', [FATAL] A resource model has ambiguous (sub-)resource method for HTTP method POST and input mime-types as defined by"@Consumes" and "@Produces" annotations at Java methods public javax.ws.rs.core.Response org.apache.cxf.rs.security.oauth.services.AuthorizationRequestService.authorizeDecisionForm() and public javax.ws.rs.core.Response org.apache.cxf.rs.security.oauth2.services.RedirectionBasedGrantService.authorizeDecisionForm(javax.ws.rs.core.MultivaluedMap) at matching regular expression /decision. These two methods produces and consumes exactly the same mime-types and therefore their invocation as a resource methods will always fail.; source='org.glassfish.jersey.server.model.RuntimeResource@2a133e40']:org.glassfish.jersey.server.model.ModelValidationException:Validation of the application resource model has failed during application initialization.
[[WARNING] Parameter 1 of type java.lang.Class<?>[] from public void org.apache.cxf.jaxrs.provider.AbstractJAXBProvider.setExtraClass(java.lang.Class<?>[]) is not resolvable to a concrete type.; source='public void org.apache.cxf.jaxrs.provider.AbstractJAXBProvider.setExtraClass(java.lang.Class[])', [WARNING] Parameter 1 of type java.lang.Class<?>[] from public void org.apache.cxf.jaxrs.provider.AbstractJAXBProvider.setExtraClass(java.lang.Class<?>[]) is not resolvable to a concrete type.; source='public void org.apache.cxf.jaxrs.provider.AbstractJAXBProvider.setExtraClass(java.lang.Class[])', [WARNING] Parameter 1 of type java.util.Map<java.lang.String, org.apache.cxf.jaxrs.provider.atom.AtomElementWriter<?, ?>> from public void org.apache.cxf.jaxrs.provider.atom.AtomPojoProvider.setAtomWriters(java.util.Map<java.lang.String, org.apache.cxf.jaxrs.provider.atom.AtomElementWriter<?, ?>>) is not resolvable to a concrete type.; source='public void org.apache.cxf.jaxrs.provider.atom.AtomPojoProvider.setAtomWriters(java.util.Map)', [WARNING] Parameter 1 of type java.util.Map<java.lang.String, org.apache.cxf.jaxrs.provider.atom.AtomElementReader<?, ?>> from public void org.apache.cxf.jaxrs.provider.atom.AtomPojoProvider.setAtomReaders(java.util.Map<java.lang.String, org.apache.cxf.jaxrs.provider.atom.AtomElementReader<?, ?>>) is not resolvable to a concrete type.; source='public void org.apache.cxf.jaxrs.provider.atom.AtomPojoProvider.setAtomReaders(java.util.Map)', [WARNING] Parameter 1 of type java.util.Map<java.lang.String, org.apache.cxf.jaxrs.provider.atom.AbstractAtomElementBuilder<?>> from public void org.apache.cxf.jaxrs.provider.atom.AtomPojoProvider.setAtomBuilders(java.util.Map<java.lang.String, org.apache.cxf.jaxrs.provider.atom.AbstractAtomElementBuilder<?>>) is not resolvable to a concrete type.; source='public void org.apache.cxf.jaxrs.provider.atom.AtomPojoProvider.setAtomBuilders(java.util.Map)', [WARNING] Parameter 1 of type java.lang.Class<?>[] from public void org.apache.cxf.jaxrs.provider.AbstractJAXBProvider.setExtraClass(java.lang.Class<?>[]) is not resolvable to a concrete type.; source='public void org.apache.cxf.jaxrs.provider.AbstractJAXBProvider.setExtraClass(java.lang.Class[])', [FATAL] A resource model has ambiguous (sub-)resource method for HTTP method GET and input mime-types as defined by"@Consumes" and "@Produces" annotations at Java methods public javax.ws.rs.core.Response org.apache.cxf.rs.security.oauth.services.AuthorizationRequestService.authorize() and public javax.ws.rs.core.Response org.apache.cxf.rs.security.oauth2.services.RedirectionBasedGrantService.authorize() at matching regular expression /authorize. These two methods produces and consumes exactly the same mime-types and therefore their invocation as a resource methods will always fail.; source='org.glassfish.jersey.server.model.RuntimeResource@714635c8', [FATAL] A resource model has ambiguous (sub-)resource method for HTTP method GET and input mime-types as defined by"@Consumes" and "@Produces" annotations at Java methods public javax.ws.rs.core.Response org.apache.cxf.rs.security.oauth.services.AuthorizationRequestService.authorizeDecision() and public javax.ws.rs.core.Response org.apache.cxf.rs.security.oauth2.services.RedirectionBasedGrantService.authorizeDecision() at matching regular expression /decision. These two methods produces and consumes exactly the same mime-types and therefore their invocation as a resource methods will always fail.; source='org.glassfish.jersey.server.model.RuntimeResource@2a133e40', [FATAL] A resource model has ambiguous (sub-)resource method for HTTP method POST and input mime-types as defined by"@Consumes" and "@Produces" annotations at Java methods public javax.ws.rs.core.Response org.apache.cxf.rs.security.oauth.services.AuthorizationRequestService.authorizeDecisionForm() and public javax.ws.rs.core.Response org.apache.cxf.rs.security.oauth2.services.RedirectionBasedGrantService.authorizeDecisionForm(javax.ws.rs.core.MultivaluedMap) at matching regular expression /decision. These two methods produces and consumes exactly the same mime-types and therefore their invocation as a resource methods will always fail.; source='org.glassfish.jersey.server.model.RuntimeResource@2a133e40']
	at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:555)
	at org.glassfish.jersey.server.ApplicationHandler.access$500(ApplicationHandler.java:184)
	at org.glassfish.jersey.server.ApplicationHandler$3.call(ApplicationHandler.java:350)
	at org.glassfish.jersey.server.ApplicationHandler$3.call(ApplicationHandler.java:347)
	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.processWithException(Errors.java:255)
	at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:347)
	at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:392)
	at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:177)
	at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:369)
	at javax.servlet.GenericServlet.init(GenericServlet.java:244)
	at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:343)
	at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:294)
	at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:326)
	at weblogic.security.service.SecurityManager.runAsForUserCode(SecurityManager.java:197)
	at weblogic.servlet.provider.WlsSecurityProvider.runAsForUserCode(WlsSecurityProvider.java:203)
	at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:71)
	at weblogic.servlet.internal.StubSecurityHelper.initServletInstance(StubSecurityHelper.java:99)
	at weblogic.servlet.internal.StubSecurityHelper.createServlet(StubSecurityHelper.java:87)
	at weblogic.servlet.internal.StubLifecycleHelper.createOneInstance(StubLifecycleHelper.java:71)
	at weblogic.servlet.internal.StubLifecycleHelper.<init>(StubLifecycleHelper.java:57)
	at weblogic.servlet.internal.StubLifecycleHelper.<init>(StubLifecycleHelper.java:31)
	at weblogic.servlet.internal.ServletStubImpl.initStubLifecycleHelper(ServletStubImpl.java:673)
	at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:612)
	at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:2064)
	at weblogic.servlet.internal.WebAppServletContext.loadServletsOnStartup(WebAppServletContext.java:2041)
	at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1930)
	at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:3101)
	at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1843)
	at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:884)
	at weblogic.application.internal.ExtensibleModuleWrapper$StartStateChange.next(ExtensibleModuleWrapper.java:360)
	at weblogic.application.internal.ExtensibleModuleWrapper$StartStateChange.next(ExtensibleModuleWrapper.java:356)
	at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:45)
	at weblogic.application.internal.ExtensibleModuleWrapper.start(ExtensibleModuleWrapper.java:138)
	at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:124)
	at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:233)
	at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:228)
	at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:45)
	at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:78)
	at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:52)
	at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:752)
	at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:45)
	at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:262)
	at weblogic.application.internal.EarDeployment.activate(EarDeployment.java:66)
	at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:165)
	at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:90)
	at weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate(AbstractOperation.java:631)
	at weblogic.deploy.internal.targetserver.operations.ActivateOperation.activateDeployment(ActivateOperation.java:171)
	at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCommit(ActivateOperation.java:121)
	at weblogic.deploy.internal.targetserver.operations.StartOperation.doCommit(StartOperation.java:151)
	at weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(AbstractOperation.java:348)
	at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentCommit(DeploymentManager.java:907)
	at weblogic.deploy.internal.targetserver.DeploymentManager.activateDeploymentList(DeploymentManager.java:1468)
	at weblogic.deploy.internal.targetserver.DeploymentManager.handleCommit(DeploymentManager.java:459)
	at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.commit(DeploymentServiceDispatcher.java:181)
	at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doCommitCallback(DeploymentReceiverCallbackDeliverer.java:217)
	at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$100(DeploymentReceiverCallbackDeliverer.java:14)
	at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$2.run(DeploymentReceiverCallbackDeliverer.java:69)
	at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:670)
	at weblogic.invocation.ComponentInvocationContextManager._runAs(ComponentInvocationContextManager.java:352)
	at weblogic.invocation.ComponentInvocationContextManager.runAs(ComponentInvocationContextManager.java:337)
	at weblogic.work.LivePartitionUtility.doRunWorkUnderContext(LivePartitionUtility.java:57)
	at weblogic.work.PartitionUtility.runWorkUnderContext(PartitionUtility.java:41)
	at weblogic.work.SelfTuningWorkManagerImpl.runWorkUnderContext(SelfTuningWorkManagerImpl.java:644)
	at weblogic.work.ExecuteThread.execute(ExecuteThread.java:415)
	at weblogic.work.ExecuteThread.run(ExecuteThread.java:355)

我的 weblogic.xml 代码也遵循这个。

更新了我在 weblogic.xml 上添加了 prefer-web-inf-classes 元素

<?xml version="1.0" encoding="UTF-8"?>
<wls:weblogic-web-app xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app" 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/web-app_2_5.xsd http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.4/weblogic-web-app.xsd">
    <wls:context-root>myAppMain</wls:context-root>
    <wls:jsp-descriptor>
    	<wls:encoding>UTF-8</wls:encoding>
    </wls:jsp-descriptor>
    <wls:container-descriptor>
        <wls:prefer-web-inf-classes>true</wls:prefer-web-inf-classes>
        <wls:show-archived-real-path-enabled>true</wls:show-archived-real-path-enabled>
    </wls:container-descriptor>
    <wls:charset-params>
    	<wls:input-charset>
    		<wls:resource-path>/*</wls:resource-path>
    		<wls:java-charset-name>UTF-8</wls:java-charset-name>
    	</wls:input-charset>
    </wls:charset-params>
</wls:weblogic-web-app>

这是我的网络应用程序库。

在此处输入图像描述

在此处输入图像描述

在此处输入图像描述

在此处输入图像描述

标签: javajax-rsweblogic

解决方案


WebLogic 带有它自己的 JAX-RS 库,以及许多其他 API 库,这些 API 库很漂亮,有时与企业应用服务器无关。所以基本上你的 Jersey 图书馆正在与服务器提供的图书馆崩溃,所以你可以做以下两种选择之一。

  1. 使用服务器中已经提供的库。您可以使用开箱即用的 JAX-RS 库。

  2. 转至 WebLogic 文档以将服务器配置为不使用自己的库并使用 Jersey 库。

我个人更喜欢第一种选择。


推荐阅读