Spring Jersey:如何摆脱web.xml?

时间:2014-05-03 22:19:24

标签: java spring maven tomcat maven-cargo

我正在创建我的应用程序(link

public class InventoryApplication extends ResourceConfig {
    public InventoryApplication() {
        packages("com.org.my_services.inventory.services");
    }
}

我有空白web.xml,我想摆脱

当我使用货物在tomcat mvn cargo:run中部署我的战争时,它失败了

[INFO] [talledLocalContainer] May 03, 2014 3:16:08 PM org.apache.tomcat.util.digester.Digester fatalError
[INFO] [talledLocalContainer] SEVERE: Parse Fatal Error at line 1 column 1: Premature end of file.
[INFO] [talledLocalContainer] org.xml.sax.SAXParseException; systemId: jndi:/localhost/services/WEB-INF/web.xml; lineNumber: 1; columnNumber: 1; Premature end of file.
[INFO] [talledLocalContainer]   at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198)
[INFO] [talledLocalContainer]   at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177)
[INFO] [talledLocalContainer]   at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:441)
[INFO] [talledLocalContainer]   at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:368)
[INFO] [talledLocalContainer]   at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1436)
[INFO] [talledLocalContainer]   at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:1019)
[INFO] [talledLocalContainer]   at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
[INFO] [talledLocalContainer]   at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
[INFO] [talledLocalContainer]   at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
[INFO] [talledLocalContainer]   at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
[INFO] [talledLocalContainer]   at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
[INFO] [talledLocalContainer]   at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
[INFO] [talledLocalContainer]   at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:649)
[INFO] [talledLocalContainer]   at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1561)
[INFO] [talledLocalContainer]   at org.apache.catalina.startup.ContextConfig.parseWebXml(ContextConfig.java:1809)
[INFO] [talledLocalContainer]   at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1247)
[INFO] [talledLocalContainer]   at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:873)
[INFO] [talledLocalContainer]   at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:371)
[INFO] [talledLocalContainer]   at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
[INFO] [talledLocalContainer]   at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
[INFO] [talledLocalContainer]   at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5355)
[INFO] [talledLocalContainer]   at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
[INFO] [talledLocalContainer]   at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
[INFO] [talledLocalContainer]   at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
[INFO] [talledLocalContainer]   at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632)
[INFO] [talledLocalContainer]   at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1073)
[INFO] [talledLocalContainer]   at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1857)
[INFO] [talledLocalContainer]   at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
[INFO] [talledLocalContainer]   at java.util.concurrent.FutureTask.run(FutureTask.java:262)
[INFO] [talledLocalContainer]   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
[INFO] [talledLocalContainer]   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
[INFO] [talledLocalContainer]   at java.lang.Thread.run(Thread.java:745)
[INFO] [talledLocalContainer] 
[INFO] [talledLocalContainer] May 03, 2014 3:16:08 PM org.apache.catalina.startup.ContextConfig parseWebXml
[INFO] [talledLocalContainer] SEVERE: Parse error in application web.xml file at jndi:/localhost/services/WEB-INF/web.xml
[INFO] [talledLocalContainer] org.xml.sax.SAXParseException; systemId: jndi:/localhost/services/WEB-INF/web.xml; lineNumber: 1; columnNumber: 1; Premature end of file.
[INFO] [talledLocalContainer]   at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198)
[INFO] [talledLocalContainer]   at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177)
[INFO] [talledLocalContainer]   at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:441)
[INFO] [talledLocalContainer]   at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:368)
[INFO] [talledLocalContainer]   at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1436)
[INFO] [talledLocalContainer]   at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:1019)
[INFO] [talledLocalContainer]   at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
[INFO] [talledLocalContainer]   at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
[INFO] [talledLocalContainer]   at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
[INFO] [talledLocalContainer]   at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
[INFO] [talledLocalContainer]   at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
[INFO] [talledLocalContainer]   at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
[INFO] [talledLocalContainer]   at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:649)
[INFO] [talledLocalContainer]   at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1561)
[INFO] [talledLocalContainer]   at org.apache.catalina.startup.ContextConfig.parseWebXml(ContextConfig.java:1809)
[INFO] [talledLocalContainer]   at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1247)
[INFO] [talledLocalContainer]   at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:873)
[INFO] [talledLocalContainer]   at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:371)
[INFO] [talledLocalContainer]   at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
[INFO] [talledLocalContainer]   at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
[INFO] [talledLocalContainer]   at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5355)
[INFO] [talledLocalContainer]   at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
[INFO] [talledLocalContainer]   at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
[INFO] [talledLocalContainer]   at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
[INFO] [talledLocalContainer]   at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632)
[INFO] [talledLocalContainer]   at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1073)
[INFO] [talledLocalContainer]   at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1857)
[INFO] [talledLocalContainer]   at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
[INFO] [talledLocalContainer]   at java.util.concurrent.FutureTask.run(FutureTask.java:262)
[INFO] [talledLocalContainer]   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
[INFO] [talledLocalContainer]   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
[INFO] [talledLocalContainer]   at java.lang.Thread.run(Thread.java:745)
[INFO] [talledLocalContainer] 
[INFO] [talledLocalContainer] May 03, 2014 3:16:08 PM org.apache.catalina.startup.ContextConfig parseWebXml
[INFO] [talledLocalContainer] SEVERE: Occurred at line 1 column 1
[INFO] [talledLocalContainer] May 03, 2014 3:16:08 PM org.apache.catalina.startup.ContextConfig configureStart
[INFO] [talledLocalContainer] SEVERE: Marking this application unavailable due to previous error(s)
[INFO] [talledLocalContainer] May 03, 2014 3:16:08 PM org.apache.catalina.core.StandardContext startInternal
[INFO] [talledLocalContainer] SEVERE: Error getConfigured
[INFO] [talledLocalContainer] May 03, 2014 3:16:08 PM org.apache.catalina.core.StandardContext startInternal
[INFO] [talledLocalContainer] SEVERE: Context [/services] startup failed due to previous errors
[INFO] [talledLocalContainer] May 03, 2014 3:16:08 PM org.apache.catalina.startup.HostConfig deployDirectory
[INFO] [talledLocalContainer] INFO: Deploying web application directory /Users/harith/IdeaProjects/pryme_services/inventory/integration/target/cargo/configurations/tomcat7x/webapps/host-manager
[INFO] [talledLocalContainer] May 03, 2014 3:16:08 PM org.apache.catalina.startup.HostConfig deployDirectory
[INFO] [talledLocalContainer] INFO: Deploying web application directory /Users/harith/IdeaProjects/pryme_services/inventory/integration/target/cargo/configurations/tomcat7x/webapps/manager
[INFO] [talledLocalContainer] May 03, 2014 3:16:08 PM org.apache.coyote.AbstractProtocol start
[INFO] [talledLocalContainer] INFO: Starting ProtocolHandler ["http-bio-8080"]
[INFO] [talledLocalContainer] May 03, 2014 3:16:08 PM org.apache.coyote.AbstractProtocol start
[INFO] [talledLocalContainer] INFO: Starting ProtocolHandler ["ajp-bio-8009"]
[INFO] [talledLocalContainer] May 03, 2014 3:16:08 PM org.apache.catalina.startup.Catalina start
[INFO] [talledLocalContainer] INFO: Server startup in 787 ms
[INFO] [talledLocalContainer] Tomcat 7.x started on port [8080]

如何告诉我的容器查找InventoryApplication

1 个答案:

答案 0 :(得分:0)