0

我刚刚基于 activeweb -simple示例启动了一个新的 ActiveWeb/ActiveJDBC 项目。当我按照自述文件中的描述使用 Jetty 构建和运行它时,一切正常,但我无法让它与 TomEE plus (7.0.2/1.7.5) 一起使用,我想寻求帮助。

我尝试了几件事,所以我将把它分成三个部分。

1) 不在 Jetty 上运行,JSR-356 支持不可用

在构建和部署战争时,无论我将战争文件复制到 webapps 文件夹还是使用 tomee-maven-plugin,都会发生错误:

FATAL: Error during ServletContainerInitializer processing
javax.servlet.ServletException: Not running on Jetty, JSR-356 support unavailable
    at org.eclipse.jetty.websocket.jsr356.server.deploy.WebSocketServerContainerInitializer.onStartup(WebSocketServerContainerInitializer.java:183)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5622)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:1009)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:985)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1127)
    at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:2020)
    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)

tomee-maven-plugin 定义如下:

<plugin>
  <groupId>org.apache.openejb.maven</groupId>
  <artifactId>tomee-maven-plugin</artifactId>
  <version>1.7.5</version>
  <configuration>
    <tomeeClassifier>plus</tomeeClassifier>
    <systemVariables>
      <activejdbc.log />
      <active_reload>true</active_reload>
      <activeweb.log.request>true</activeweb.log.request>
    </systemVariables>
  </configuration>
</plugin>

搜索错误本身并没有让我找到解决方案。

2)“修复”上面的错误,仍然没有服务器

我注释掉了所有与 Jetty 相关的代码和依赖项,然后重新部署。这次没有发生错误,但不幸的是在 localhost 下也没有可用的服务器。

3) 致命错误意外元素

在此之后,我添加了“tomcat-websocket”依赖项来替代“javax-websocket-server-impl”依赖项

<!-- <dependency>
       <groupId>org.eclipse.jetty.websocket</groupId>
       <artifactId>javax-websocket-server-impl</artifactId>
       <version>9.4.1.v20170120</version>
     </dependency>-->

    <dependency>
      <groupId>org.apache.tomcat</groupId>
      <artifactId>tomcat-websocket</artifactId>
      <version>9.0.10</version>
    </dependency>

这导致以下错误:

INFORMATION: Configuring enterprise application: 
C:\Users\...\activeweb-simple-master\target\apache-tomee\webapps\activeweb-simple-1.1-SNAPSHOT
[severity=FATAL_ERROR, message=unexpected element (URI:"http://xmlns.jcp.org/xml/ns/javaee", lokal:"web-fragment"). Expected elements are <{http://java.sun.com/xml/ns/javaee}handler-chains>,<{http://java.sun.com/xml/ns/javaee}web-fragment>, locator=[node=null, object=null, url=null, line=23,col=28,offset=-1]]
Jun 27, 2018 7:57:26 AM org.apache.openejb.config.ReadDescriptors mergeWebFragments
WARNING: can't read org.apache.openejb.config.ReadDescriptors$UrlSource@3d1db871
javax.xml.bind.UnmarshalException: unexpected element (URI:"http://xmlns.jcp.org/xml/ns/javaee", lokal:"web-fragment"). Expected elements are <{http://java.sun.com/xml/ns/javaee}handler-chains>,<{http://java.sun.com/xml/ns/javaee}web-fragment>
    at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:662)
    at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:258)
    at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:253)
    at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportUnexpectedChildElement(Loader.java:120)
    at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext$DefaultRootLoader.childElement(UnmarshallingContext.java:1063)
    at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:498)
    at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:480)
    at com.sun.xml.bind.v2.runtime.unmarshaller.SAXConnector.startElement(SAXConnector.java:150)
    at org.xml.sax.helpers.XMLFilterImpl.startElement(XMLFilterImpl.java:551)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:509)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:374)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootElementHook(XMLNSDocumentScannerImpl.java:613)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3132)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:852)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:841)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:770)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
    at org.xml.sax.helpers.XMLFilterImpl.parse(XMLFilterImpl.java:357)
    at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:258)
    at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:229)
    at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:214)
    at org.apache.openejb.jee.JaxbJavaee.unmarshal(JaxbJavaee.java:174)
    at org.apache.openejb.config.ReadDescriptors.mergeWebFragments(ReadDescriptors.java:578)
    at org.apache.openejb.config.ReadDescriptors.readWebApp(ReadDescriptors.java:551)
    at org.apache.openejb.config.ReadDescriptors.deploy(ReadDescriptors.java:129)
    at org.apache.openejb.config.ConfigurationFactory$Chain.deploy(ConfigurationFactory.java:403)
    at org.apache.openejb.config.ConfigurationFactory.configureApplication(ConfigurationFactory.java:971)
    at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1227)
    at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1100)
    at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:130)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5519)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:1009)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:985)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1127)
    at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:2020)
    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)

以上所有错误都发生在 ActiveWeb/ActiveJDBC 的 2.0 和 2.1-SNAPSHOT 版本中。

那么,有没有办法让 ActiveWeb 与 TomEE plus 一起工作?

4

0 回答 0