有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java tomcat 7.0 embedded+jaxws:找不到sunjaxws。xml

我正在尝试让JAX-WS与嵌入式Tomcat7.0一起工作
我学习了一些关于标准Tomcat的教程(例如http://www.mkyong.com/webservices/jax-ws/deploy-jax-ws-web-services-on-tomcat/),但是我没有找到一个专门针对Tomcat的教程

我确实成功地在服务器上运行了我自己的servlet,但当尝试使用包含所有JAX-WS注释(以及所有其他注释:WSServletContextListener+WSServlet in web.xml,sun-jaxws.xml in web-INF)的类启动它时,我遇到了以下错误:

INFO: Initializing ProtocolHandler ["http-bio-80"]
2 oct. 2012 14:48:20 org.apache.catalina.core.StandardService startInternal
INFO: Starting service Tomcat
2 oct. 2012 14:48:20 org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.27
2 oct. 2012 14:48:21 org.apache.catalina.startup.ContextConfig getDefaultWebXmlFragment
INFO: No global web.xml found
2 oct. 2012 14:48:28 com.sun.xml.ws.transport.http.servlet.WSServletContextListener contextInitialized
INFO: WSSERVLET12 : initialisation du processus découte de contexte JAX-WS
2 oct. 2012 14:48:28 com.sun.xml.ws.transport.http.servlet.WSServletContextListener parseAdaptersAndCreateDelegate
SEVERE: WSSERVLET11 : fail analyzing descriptor : javax.xml.ws.WebServiceException: execution descriptor  "/WEB-INF/sun-jaxws.xml" is missing
javax.xml.ws.WebServiceException: Le descripteur d'exécution "/WEB-INF/sun-jaxws.xml" is missing
at com.sun.xml.ws.transport.http.servlet.WSServletContextListener.parseAdaptersAndCreateDelegate(WSServletContextListener.java:125)
at com.sun.xml.ws.transport.http.servlet.WSServletContextListener.contextInitialized(WSServletContextListener.java:152)

这看起来像是一个路径问题,但我不明白缺少了什么,因为网络。同一文件夹WEB-INF文件夹中的xml已正确加载。。。 以下是我的应用程序的启动代码: 试一试{

        Tomcat tomcat = new Tomcat();
        tomcat.setBaseDir(".");
        tomcat.setPort(80);

        tomcat.getHost().setAppBase("src/main/webapp");
        Context context = tomcat.addWebapp("/Test", ".");
        File configFile = new File(tomcat.getHost().getAppBase() + "/META-INF/context.xml");
        context.setConfigFile(configFile.toURI().toURL());

        tomcat.enableNaming();

        StandardServer server = (StandardServer)tomcat.getServer();
        AprLifecycleListener listener = new AprLifecycleListener();
        server.addLifecycleListener(listener);

        tomcat.start();
        tomcat.getServer().await();

    } catch (Exception e) {

        e.printStackTrace();
    }

谢谢你的帮助或建议


共 (0) 个答案