【问题标题】:Tomcat web application not workingTomcat Web 应用程序不工作
【发布时间】:2011-11-15 17:33:18
【问题描述】:

我在本地服务器上启动并运行公司 Web 服务测试套件环境时遇到了一些困难。我从他们那里收到了 2 个我已经部署在我的 tomcat 服务器上的 war 文件。

测试套件包含 2 个组件。

  1. xmlvend-server.war
  2. xmlvend-client.war

我可以访问服务器

http://localhost:8080/xmlvend-server

和客户端网络应用程序

http://localhost:8080/xmlvend-client

在服务器网页上,我收到以下消息:

协议测试服务器

这是 xmlvend 场景文件的协议测试服务器 在以下位置存储/读取:
C:\Documents and Settings\LocalService/xmlvend/test-server/ 消息调用可以基于标准的 XMLVend 2.1 WSDL, 通过向以下端点地址发送 POST 请求: http://127.0.0.1:8080/xmlvend-server/service

一切似乎都很好,但是当我点击端点地址(上图)时,我收到以下错误/异常消息:

异常: javax.servlet.ServletException: 获取失败 参考 SOAP 引擎 xmlhttp.framework.MessageReceiverServlet.init(MessageReceiverServlet.java:50)

根本原因: java.lang.Exception: No SOAPProcessor in context xmlhttp.framework.MessageReceiverServlet.init(MessageReceiverServlet.java:45)

如果我尝试访问 Web 服务的 wsdl 文件 (xmlvend-full-2.1.wsdl),我会收到与上述相同的异常。

我也收到了公司的 wsdl,但我应该把它放在哪里? 是不是应该放在tomcat的webapps/test-server文件夹里面?

谁能告诉我如何让 Web 应用程序正常工作? 非常感谢任何帮助,我什至已经轻松配置了服务器 VNC/RDP 远程访问,如果你能帮助我,请联系我。

谢谢

我的设置:

  • Tomcat 服务器 7.0.20
  • Java SDK/SE 7
  • java 版本 1.4.2_03
  • Windows XP SP3

其他信息:

服务器 - web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app 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/j2ee file:/Users/dawidl/Projects/solms/solmsRoot/externalResources/sun/xml/schemas/j2ee/web-app_2_4.xsd" 
    version="2.4">

    <display-name>XMLVend Server (Web Services Testing Framework)</display-name>
    <description>
        A zero-business-logic web services server to perform protocol testing. All requests
        with a URI of /service/* (and POST method) indicate web services (SOAP/HTTP) requests, the rest 
        are normal XHTML,etc/HTTP
    </description>


    <!-- Decodes any HTTP Requests sent using GZIP compression. Does so transparently,
     so all components in the chain after it are unaware of the compressed request. This
     is why the stupid Osmotic filter that follows prints out the annoying message
     'request not compressed' even though it was originally (and we can't turn off
     the printouts, because osmotic do not make their source available. -->
    <filter>
        <filter-name>HttpRequestCompressionFilter</filter-name>
        <filter-class>xmlhttp.framework.io.HttpCompressionFilter</filter-class>
    </filter>
    <!-- Use off-the-shelf (Osmotic Web) Response Compression Filter (Supposed
    to do two-way, but it's broken, which is why we wrote our own filter.-->
    <filter>
        <filter-name>HttpResponseCompressionFilter</filter-name>
        <filter-class>com.osmoticweb.gzipfilter.GZIP2WayFilter</filter-class>
    </filter>
    <!-- Filter to cater for non-conforming user agents (read: MS Internet Explorer) 
    that do not understand the XHTML MIME type -->
    <filter>
        <filter-name>XHTMLMIMEFilter</filter-name>
        <filter-class>za.co.solms.web.xhtml.MIMEFilter</filter-class>
    </filter>

    <filter-mapping>
        <filter-name>HttpRequestCompressionFilter</filter-name>
        <url-pattern>/service/*</url-pattern>
    </filter-mapping>
    <filter-mapping>
        <filter-name>HttpResponseCompressionFilter</filter-name>
        <url-pattern>/service/*</url-pattern>
    </filter-mapping>
    <filter-mapping>
        <filter-name>XHTMLMIMEFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <servlet>
        <servlet-name>MessageReceiver</servlet-name>
        <servlet-class>xmlhttp.framework.MessageReceiverServlet</servlet-class>
    </servlet>

    <servlet-mapping>
        <servlet-name>MessageReceiver</servlet-name>
        <url-pattern>/service/*</url-pattern>
    </servlet-mapping>

    <welcome-file-list>
        <welcome-file>index.jspx</welcome-file>
        <welcome-file>index.xhtml</welcome-file>
    </welcome-file-list>

    <!-- Sets up the SOAP Engine and Processor(s) -->
    <listener>
        <listener-class>xmlhttp.framework.config.FrameworkSetupListener</listener-class>
    </listener>

</web-app>

客户端 - web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app 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/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" 
     version="2.4">

    <display-name>XMLVend Client (Web Services Testing Framework)</display-name>
    <description>
        A basic web services client to perform protocol testing.
    </description>


    <!-- Global web Service Parameters (Use-Case Centric) -->
    <context-param>
        <!-- Contract (each 'operation' name maps to a 'UseCase') -->
        <param-name>service.wsdl</param-name>
        <param-value>/contract/xmlvend-full-2.1.wsdl</param-value>
    </context-param>
    <context-param>
        <!-- Views (contains files with naming convention: MyUseCase-[in|out].jspx) -->
        <param-name>service.operations.views</param-name>
        <param-value>/useCaseViews</param-value>
    </context-param>

    <!-- FIRST INSTALLATION DEFAULTS (overridden by the config file created in §xmlvend/test-client/configuration.properties) -->
    <!-- TODO: Move this to a separate XML file in the format expected by the ConfigurationServlet -->
    <context-param>
        <param-name>init.xmlvend.transport.service.url</param-name>
        <param-value>http://localhost:8080/xmlvend-server/service/</param-value>
    </context-param>
    <context-param>
        <!-- Compress all requests? -->
        <param-name>init.xmlvend.transport.compression.request</param-name>
        <param-value>false</param-value>
    </context-param>
    <context-param>
        <!-- Explicitly support compressed responses? -->
        <param-name>init.xmlvend.transport.compression.response</param-name>
        <param-value>false</param-value>
    </context-param>
    <context-param>
        <param-name>init.xmlvend.client.clientID</param-name>
        <param-value>6004708001981</param-value>
    </context-param>
    <context-param>
        <param-name>init.xmlvend.client.clientIDType</param-name>
        <!-- NOTE: The namespace prefix presented here *must* match with the prefix
         defined in the message templates -->
        <param-value>b0:EANDeviceID</param-value>
    </context-param>
    <context-param>
        <param-name>init.xmlvend.client.terminalID</param-name>
        <param-value>0000000000001</param-value>
    </context-param>
    <context-param>
        <param-name>init.xmlvend.client.terminalIDType</param-name>
        <!-- NOTE: The namespace prefix presented here *must* match with the prefix
         defined in the message templates -->
        <param-value>b0:EANDeviceID</param-value>
    </context-param>
    <context-param>
        <!-- Automatically perform advice confirmation after each request? -->
        <param-name>init.xmlvend.advice.autoConfirm</param-name>
        <param-value>false</param-value>
    </context-param>
    <context-param>
        <!-- Automatically perform advice reversal in the case of errors? -->
        <param-name>init.xmlvend.advice.autoReversal</param-name>
        <param-value>false</param-value>
    </context-param>


    <!-- Use-case handler (controller) servlet -->
    <servlet>
        <servlet-name>UseCaseServlet</servlet-name>
        <servlet-class>za.co.eskom.nrs.xmlvend.client.UseCaseServlet</servlet-class>
    </servlet>
    <!-- Configuration view/update servlet -->
    <servlet>
        <servlet-name>ConfigurationServlet</servlet-name>
        <servlet-class>za.co.eskom.nrs.xmlvend.client.setup.ConfigurationServlet</servlet-class>
    </servlet>

    <servlet-mapping>
        <servlet-name>UseCaseServlet</servlet-name>
        <url-pattern>/useCase/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>ConfigurationServlet</servlet-name>
        <url-pattern>/admin/configuration</url-pattern>
    </servlet-mapping>


    <!-- Filter to make the global configuration keys available to every
    request as string attributes -->
    <filter>
        <filter-name>ConfigurationProvider</filter-name>
        <filter-class>za.co.eskom.nrs.xmlvend.client.setup.ConfigurationProviderFilter</filter-class>
    </filter>
    <!-- Filter to cater for non-conforming user agents (read: MS Internet Explorer) 
    that do not understand XHTML -->
    <filter>
        <filter-name>XHTMLMIMEFilter</filter-name>
        <filter-class>za.co.solms.web.xhtml.MIMEFilter</filter-class>
    </filter>

    <filter-mapping>
        <filter-name>ConfigurationProvider</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    <filter-mapping>
        <filter-name>XHTMLMIMEFilter</filter-name>
        <url-pattern>/*</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>ERROR</dispatcher>
    </filter-mapping>


    <welcome-file-list>
        <welcome-file>index.jspx</welcome-file>
        <welcome-file>index.xhtml</welcome-file>
    </welcome-file-list>


    <!-- Sets up the client at start-up (configuration, etc) -->
    <listener>
        <listener-class>za.co.eskom.nrs.xmlvend.client.setup.ClientSetupListener</listener-class>
    </listener>


    <!-- SOAP Fault Error Page -->
    <error-page>
        <exception-type>za.co.eskom.nrs.xmlvend.client.SOAPFault</exception-type>
        <location>/useCaseViews/_error-SOAPFault.jspx</location>
    </error-page>
    <!-- Any other (general) server errors -->
    <!-- error-page>
        <error-code>500</error-code>
        <location>/useCaseViews/_error-generic.jspx</location>
    </error-page-->

</web-app>

【问题讨论】:

  • 为什么不联系制作战争文件的公司?
  • 我在安装 xmlvend-server 时遇到了确切的问题。请问你的tomcat安装中缺少什么基本库,你到底做了什么让它成功运行?任何帮助将不胜感激。
  • “基本库”对于使这个问题有用是必不可少的。 @chesney 你为什么不提供这些信息?

标签: java xml web-services tomcat wsdl


【解决方案1】:

在服务器应用程序的 web.xml 中声明的上下文侦听器似乎应该设置为您提供错误的 servlet 所依赖的框架:

<!-- Sets up the SOAP Engine and Processor(s) -->
<listener>
    <listener-class>xmlhttp.framework.config.FrameworkSetupListener</listener-class>
</listener>

查看源代码后,MessageReceiverServlet 无法通过属性“soap.engine”在 servlet 上下文中找到 SoapEngine。这应该由 FrameworkSetupListener 放在那里。

应该有其他异常显示应用服务器日志中失败的原因(检查 tomcat 安装目录/日志中是否有一个名为 catalina.out 的文件)。

推测,我相信这很可能与您关于 WSDL 应该放在哪里的问题有关。通过阅读应用程序期望的源代码(如果不存在,则创建)您的主目录下的文件夹,因此请在您的主目录中查看名为“xmlvend”的文件夹并放置所有 .xsd/.wsdl 文件在该“/test-server/schemas”的子文件夹中。

执行此操作后,重新启动 Tomcat 应该会给您不同的结果。如果这不起作用,请从上面提到的 tomcat 日志中添加一些摘录(异常堆栈跟踪最有用),它们应该会提供更多线索。

【讨论】:

  • 嗨,布赖恩,感谢您的评论。目前没有内部技术/开发支持。 xmlvend 是一个开放标准,库+测试套件软件(二进制文件和源代码)可在 Internet 上免费获得。我已按照他们的说明设置服务器,但仍然收到上面发布的异常。我对Java一点也不熟悉,tomcat的配置似乎足够合理。测试套件的 WAR 文件和源代码可在此处免费获得 - nrs.eskom.co.za/xmlvend/docs/XMLVendConditions.asp 我可以提供更多详细信息,但具体是什么?再次感谢。
  • 嗨,我在查看源代码后更新了答案。希望对您有所帮助。
  • 谢谢布赖恩!我设法让服务器和客户端成功启动并运行。我错过了 Tomcat 安装中的一个基本库。我还听从了您关于复制模式和 wsdl 文件的建议。现在一切正常。赏金是你的!
猜你喜欢
  • 1970-01-01
  • 2017-12-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-02-10
  • 1970-01-01
  • 2021-06-18
相关资源
最近更新 更多