2017-05-04 72 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

相關問題