2017-05-04 74 views
1

我创建了一个样本的Apache CXF SOAP Web服务,该教程here如何部署apachel CXF到WebSphere Application Server

我能够在http://localhost:8080/camel-example-reportincident/webservices/incident?wsdl通过Eclipse霓虹灯和访问它在Tomcat 9运行以下。

我安装并启动它的websphere,但我无法访问它在相同的网址。我还尝试了默认主机别名中列出的所有其他端口。

我的Maven库: enter image description here

这里是我的WSDL:

<?xml version="1.0" encoding="ISO-8859-1"?> <wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://reportincident.example.camel.apache.org" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://reportincident.example.camel.apache.org"> 

    <!-- Type definitions for input- and output parameters for webservice 
-->  <wsdl:types>  <xs:schema targetNamespace="http://reportincident.example.camel.apache.org">   <xs:element name="inputReportIncident"> 
       <xs:complexType> 
        <xs:sequence> 
         <xs:element type="xs:string" name="incidentId" /> 
         <xs:element type="xs:string" name="incidentDate" /> 
         <xs:element type="xs:string" name="givenName" /> 
         <xs:element type="xs:string" name="familyName" /> 
         <xs:element type="xs:string" name="summary" /> 
         <xs:element type="xs:string" name="details" /> 
         <xs:element type="xs:string" name="email" /> 
         <xs:element type="xs:string" name="phone" /> 
        </xs:sequence> 
       </xs:complexType>   </xs:element>   <xs:element name="outputReportIncident"> 
       <xs:complexType> 
        <xs:sequence> 
         <xs:element type="xs:string" name="code" /> 
        </xs:sequence> 
       </xs:complexType>   </xs:element>  </xs:schema> </wsdl:types> 

    <!-- Message definitions for input and output --> <wsdl:message name="inputReportIncident">  <wsdl:part name="parameters" element="tns:inputReportIncident" /> </wsdl:message>  <wsdl:message name="outputReportIncident">  <wsdl:part name="parameters" element="tns:outputReportIncident" /> </wsdl:message> 

    <!-- Port (interface) definitions --> <wsdl:portType name="ReportIncidentEndpoint">  <wsdl:operation name="ReportIncident">   <wsdl:input message="tns:inputReportIncident" />   <wsdl:output message="tns:outputReportIncident" />  </wsdl:operation> </wsdl:portType> 

    <!-- Port bindings to transports and encoding - HTTP, document literal encoding   is used -->  <wsdl:binding name="ReportIncidentBinding" type="tns:ReportIncidentEndpoint">  <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />  <wsdl:operation name="ReportIncident">   <soap:operation 
       soapAction="http://reportincident.example.camel.apache.org/ReportIncident" 
       style="document" />    <wsdl:input> 
       <soap:body parts="parameters" use="literal" />   </wsdl:input>   <wsdl:output> 
       <soap:body parts="parameters" use="literal" />   </wsdl:output>  </wsdl:operation> </wsdl:binding> 

    <!-- Service definition -->  <wsdl:service name="ReportIncidentService">   <wsdl:port name="ReportIncidentPort" binding="tns:ReportIncidentBinding">   <soap:address location="http://reportincident.example.camel.apache.org" />  </wsdl:port> </wsdl:service> 

</wsdl:definitions> 

这里是我的IBM的web-bnd.xml:

<?xml version="1.0" encoding="UTF-8"?> <web-bnd xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://websphere.ibm.com/xml/ns/javaee" 
    xsi:schemaLocation="http://websphere.ibm.com/xml/ns/javaee http://websphere.ibm.com/xml/ns/javaee/ibm-web-bnd_1_0.xsd" version="1.0"> <virtual-host name="default_host"/> </web-bnd> 

这里是我的CXF-配置.xml:

<beans xmlns="http://www.springframework.org/schema/beans" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws" 
    xsi:schemaLocation=" 
      http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd 
      http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd"> 

    <import resource="classpath:META-INF/cxf/cxf.xml" /> 
    <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" /> 
    <import resource="classpath:META-INF/cxf/cxf-servlet.xml" /> 

    <!-- implementation of the webservice --> 
    <bean id="reportIncidentEndpoint" 
     class="org.apache.camel.example.reportincident.impl.ReportIncidentEndpointImpl" /> 

    <!-- export the webservice using jaxws --> 
    <jaxws:endpoint id="reportIncident" implementor="#reportIncidentEndpoint" 
     address="/incident" wsdlLocation="/WEB-INF/wsdl/report_incident.wsdl" 
     endpointName="s:ReportIncidentPort" serviceName="s:ReportIncidentService" 
     xmlns:s="http://reportincident.example.camel.apache.org" /> 

</beans> 

这里是我的web.xml:

<?xml version="1.0" encoding="UTF-8"?> 
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns="http://java.sun.com/xml/ns/javaee" 
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 
    version="2.5"> 

    <display-name>Archetype Created Web Application</display-name> 

    <!-- the listener that kick-starts Spring --> 
    <listener> 
     <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> 
    </listener> 

    <!-- CXF servlet --> 
    <servlet> 
     <servlet-name>CXFServlet</servlet-name> 
     <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class> 
     <load-on-startup>1</load-on-startup> 
    </servlet> 

    <!-- all our webservices are mapped under this URI pattern --> 
    <servlet-mapping> 
     <servlet-name>CXFServlet</servlet-name> 
     <url-pattern>/webservices/*</url-pattern> 
    </servlet-mapping> 

    <!-- location of spring xml files --> 
    <context-param> 
     <param-name>contextConfigLocation</param-name> 
     <param-value>classpath:cxf-config.xml</param-value> 
    </context-param> 

</web-app> 

====================

更新

奇怪的是,最后更新对于SystemOut.log和SystemErr.log两天前。我发现了一些日志在C:\程序文件(x86)\ IBM \的WebSphere \ AppServer的\型材\ AppSrv01 \日志\ FFDC 日志:

FFDC Exception:org.springframework.beans.factory.BeanCreationException SourceId:com.ibm.ws.webcontainer.webapp.WebApp.notifyServletContextCreated ProbeId:1341 Reporter:[email protected] 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cxf' defined in class path resource [META-INF/cxf/cxf.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.apache.cxf.bus.spring.SpringBus]: Constructor threw exception; nested exception is org.apache.cxf.bus.extension.ExtensionException 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1039) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:985) 
..... 


Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.apache.cxf.bus.spring.SpringBus]: Constructor threw exception; nested exception is org.apache.cxf.bus.extension.ExtensionException 
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:163) 
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:87) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1032) 


Caused by: java.lang.UnsupportedClassVersionError: JVMCFRE003 bad major version; class=org/apache/camel/component/cxf/transport/CamelTransportFactory, offset=6 
    at java.lang.ClassLoader.defineClassImpl(Native Method) 
    at java.lang.ClassLoader.defineClass(ClassLoader.java:273) 
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:74) 


com.ibm.ws.ffdc.impl.FfdcProvider logIncident FFDC1003I: FFDC Incident emitted on C:\Program Files (x86)\IBM\WebSphere\AppServer\profiles\AppSrv01\logs\ffdc\server1_24638c34_17.05.05_01.11.23.0597458986526819616127.txt com.ibm.ws.webcontainer.servlet.ServletInstance.init 181 

    com.ibm.ws.webcontainer.VirtualHostImpl addWebApplication SRVE0250I: Web Module Archetype Created Web Application has been bound to default_host[*:9080,*:80,*:9443,*:5060,*:5061,*:443]. 

WSVR0221I: Application started: camel-example-reportincident_war 

WSVR0191I: Composition unit WebSphere:cuname=camel-example-reportincident_war in BLA WebSphere:blaname=camel-example-reportincident_war started. 
+0

您需要检查WebSphere服务器日志(特别是SystemOut.log和SystemErr.log),以查看是否有错误可能会导致应用程序无法启动。另外,如果您还没有这样做,请确保您遵循第三方Web服务文档中的步骤,因为这需要进行一些额外配置:https://www.ibm.com/support/knowledgecenter/ SS7JFU_7.0.0/com.ibm.websphere.express.doc/info/exp/ae/twbs_thirdparty.html – Jarid

+0

请提供服务器日志。您是否检查过CXF指南http://cxf.apache.org/docs/application-server-specific-configuration-guide.html#ApplicationServerSpecificConfigurationGuide-ForWebSphere6.1.0.29+,V7和V8 –

+0

更新日志 – nuttynibbles

回答

0

的UnsupportedClassVersionError指类(在这种情况下,CamelTransportFactory)是针对比您运行的JVM更高级别的Java进行编译的。如果您拥有支持更高Java规范级别的WebSphere版本,则需要选择更高级别的JDK;如果不是,那么您将需要一个支持Java 6的Camel软件包版本。

+0

嗨,tks。我用1.6 jdk重新编译,现在它是一个不同的错误。 “javax.ws.rs.QueryParam注释类不会被识别,因为它是从文件加载的:/ C:/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/DESKTOP-8TUH2K0Node01Cell/camel-example-reportincident_war.ear/ camel-example-reportincident.war/WEB-INF/lib/jsr311-api-1.1.1.jar位置,而不是来自产品类加载器。“这与最后一次设置装载父项有关吗? – nuttynibbles

+0

是的。我不知道这是明确的错误,但只是一条信息性消息。 – Jarid

+0

好的,我会检查。但是我怎么知道终点呢?我在websphere上设置了contextRoot作为测试。在tomcat上,我的URL是http:// localhost:8080/camel-example-reportincident/webservice/incident?wsdl。我试过http:// localhost:8080/test/camel-example-reportincident/webservice/incident?wsdl,但它会抛出一个404 – nuttynibbles

相关问题