如何将apachel cxf部署到websphere应用服务器

时间:2017-05-04 10:43:41

标签: cxf websphere-8

我按照教程here

创建了一个示例apache cxf SOAP webservices

我可以通过eclipse neon在tomcat 9上运行并在http://localhost:8080/camel-example-reportincident/webservices/incident?wsdl访问它。

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

我的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-config.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:\ Program Files(x86)\ IBM \ WebSphere \ AppServer \ profiles \ AppSrv01 \ logs \ ffdc中找到了一些日志 日志:

FFDC Exception:org.springframework.beans.factory.BeanCreationException SourceId:com.ibm.ws.webcontainer.webapp.WebApp.notifyServletContextCreated ProbeId:1341 Reporter:com.ibm.ws.webcontainer.webapp.WebAppImpl@bdd2e142
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.

1 个答案:

答案 0 :(得分:0)

UnsupportedClassVersionError意味着该类(在本例中为CamelTransportFactory)是针对比您正在运行的JVM更高级别的Java编译的。如果您的WebSphere版本支持更高的Java规范级别,那么您需要选择更高级别的JDK;如果没有,那么你需要一个支持Java 6的Camel软件包版本。