gpt4 book ai didi

java - Websphere 85 ejb 3 部署问题

转载 作者:行者123 更新时间:2023-12-01 10:25:34 31 4
gpt4 key购买 nike

我正在尝试在 websphere 8 上部署一个 ejb 3 的 bean。Bean 实现位于 src/main/java 中,ejb-jar.xml 位于 src/main/resources/META-INF 中。它被打包在一个 jar 中,并且该 jar 包含在 Ear 中,ear 中还有其他带有 ejb 2 的 ejb jar。所以 Ear 包含 ejb 2 和 ejb 3 jar。在 websphere 中部署此 Ear 期间,我收到以下错误:

org.eclipse.emf.common.util.WrappedException: org.xml.sax.SAXParseException: cvc-elt.1: 找不到元素“ejb-jar”的声明。

如果我从 ejb 3 jar 中删除 ejb-jar.xml,则部署成功。如果我部署只包含 ejb 3 jar 的 Ear,则成功。如果我直接从 ibm 控制台部署 ejb 3 jar,它就会成功部署。

但是尝试部署包含 ejb 2 和 ejb 3 jar 的 Ear 失败了。以下是完整的堆栈跟踪:

 [echo] Error executing deployment: org.eclipse.emf.common.util.WrappedException. Error is org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'ejb-jar'..
[echo] org.eclipse.emf.common.util.WrappedException: org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'ejb-jar'.
[echo] at org.eclipse.wst.common.internal.emf.resource.EMF2DOMRenderer.loadDocument(EMF2DOMRenderer.java:81)
[echo] at org.eclipse.wst.common.internal.emf.resource.EMF2DOMRenderer.doLoad(EMF2DOMRenderer.java:62)
[echo] at org.eclipse.wst.common.internal.emf.resource.TranslatorResourceImpl.basicDoLoad(TranslatorResourceImpl.java:153)
[echo] at org.eclipse.wst.common.internal.emf.resource.CompatibilityXMIResourceImpl.doLoad(CompatibilityXMIResourceImpl.java:182)
[echo] at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1494)
[echo] at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1282)
[echo] at org.eclipse.wst.common.internal.emf.resource.CompatibilityXMIResourceImpl.load(CompatibilityXMIResourceImpl.java:272)
[echo] at org.eclipse.wst.common.internal.emf.resource.TranslatorResourceImpl.load(TranslatorResourceImpl.java:423)
[echo] at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoad(ResourceSetImpl.java:255)
[echo] at org.eclipse.jem.internal.util.emf.workbench.ProjectResourceSetImpl.demandLoad(ProjectResourceSetImpl.java:815)
[echo] at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:270)
[echo] at org.eclipse.jem.internal.util.emf.workbench.ProjectResourceSetImpl.getResource(ProjectResourceSetImpl.java:1068)
[echo] at org.eclipse.wst.common.internal.emfworkbench.WorkbenchResourceHelper.getOrCreateResource(WorkbenchResourceHelper.java:380)
[echo] at org.eclipse.wst.common.internal.emfworkbench.integration.EditModel.getResource(EditModel.java:685)
[echo] at org.eclipse.wst.common.componentcore.internal.ArtifactEditModel.getResource(ArtifactEditModel.java:199)
[echo] at org.eclipse.jst.j2ee.ejb.componentcore.util.EJBArtifactEdit.getDeploymentDescriptorResource(EJBArtifactEdit.java:296)
[echo] at org.eclipse.jst.j2ee.ejb.componentcore.util.EJBArtifactEdit.getDeploymentDescriptorRoot(EJBArtifactEdit.java:322)
[echo] at org.eclipse.jst.j2ee.ejb.componentcore.util.EJBArtifactEdit.getEJBJar(EJBArtifactEdit.java:306)
[echo] at org.eclipse.jst.j2ee.ejb.componentcore.util.EJBArtifactEdit.getEJBClientJarModule(EJBArtifactEdit.java:252)
[echo] at org.eclipse.jst.j2ee.ejb.internal.plugin.EjbModuleExtensionImpl.getDefinedEJBClientJARProject(EjbModuleExtensionImpl.java:91)
[echo] at com.ibm.etools.ejbdeploy.batch.plugin.BatchExtension.runEarDeploy(BatchExtension.java:482)
[echo] at com.ibm.etools.ejbdeploy.batch.plugin.BatchExtension$RunDeploy.run(BatchExtension.java:356)
[echo] at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1975)
[echo] at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1957)
[echo] at com.ibm.etools.ejbdeploy.batch.plugin.BatchExtension$RunDeploy.execute(BatchExtension.java:321)
[echo] at com.ibm.etools.ejbdeploy.batch.plugin.BatchExtension.run(BatchExtension.java:284)
[echo] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[echo] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
[echo] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
[echo] at java.lang.reflect.Method.invoke(Method.java:611)
[echo] at org.eclipse.equinox.internal.app.EclipseAppContainer.callMethodWithException(EclipseAppContainer.java:587)
[echo] at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:198)
[echo] at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
[echo] at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
[echo] at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
[echo] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[echo] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
[echo] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
[echo] at java.lang.reflect.Method.invoke(Method.java:611)
[echo] at com.ibm.etools.ejbdeploy.batch.impl.BootLoaderLoader.run(BootLoaderLoader.java:494)
[echo] at com.ibm.etools.ejbdeploy.batch.impl.BatchDeploy.execute(BatchDeploy.java:114)
[echo] at com.ibm.etools.ejbdeploy.EJBDeploy.execute(EJBDeploy.java:106)
[echo] at com.ibm.etools.ejbdeploy.EJBDeploy.deploy(EJBDeploy.java:348)
[echo] at com.ibm.etools.ejbdeploy.EJBDeploy.main(EJBDeploy.java:309)
[echo] Caused by: org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'ejb-jar'.
[echo] at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
[echo] at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
[echo] at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
[echo] at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
[echo] at org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(Unknown Source)
[echo] at org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(Unknown Source)
[echo] at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
[echo] at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown Source)
[echo] at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
[echo] at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
[echo] at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
[echo] at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
[echo] at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
[echo] at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
[echo] at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
[echo] at javax.xml.parsers.DocumentBuilder.parse(Unknown Source)
[echo] at org.eclipse.wst.common.internal.emf.utilities.DOMUtilities.loadDocument(DOMUtilities.java:554)
[echo] at org.eclipse.wst.common.internal.emf.resource.EMF2DOMRenderer.loadDocument(EMF2DOMRenderer.java:74)
[echo] ... 43 more
[echo] EJBDeploy level: @build@

ejb-jar.xml <ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee" 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/ejb-jar_3_0.xsd" version="3.0">
<description><![CDATA[]]></description>
<display-name></display-name>
<enterprise-beans>
<session id="">
<description><![CDATA[]]></description>
<ejb-name></ejb-name>
<env-entry>
<env-entry-name></env-entry-name>
<env-entry-type></env-entry-type>
<env-entry-value><![CDATA[]]></env-entry-value>
</env-entry>

我认为部署失败是因为 Ear 同时具有 ejb 2 和 ejb 2 jar。

关于如何解决这个问题有什么建议吗?

最佳答案

您的 XML header 使用了不兼容的 xmlnsversion 属性。试试这个:

<ejb-jar version="3.0"
xmlns="http://java.sun.com/xml/ns/javaee"
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/ejb-jar_3_0.xsd">

(您的 EJB 2.x ejb-jar.xml 也可能不匹配,因此显示这一点也可能有用。)

关于java - Websphere 85 ejb 3 部署问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35372564/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com