You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Jack Jack <sm...@yahoo.com> on 2008/10/20 15:53:37 UTC

Re: ServiceMix-3.2.2 - classCast exception after deploying cxf-bc consumer

Freeman,
  Can you please look at the web.xml appended below and suugest what I am doing wrong.
  The main requirement is , avoid starting jetty and use Tomcat for all purposes.
  The web.xml is the one that comes with servicemix-web xip file. I added cxf servlet entry as you mentioned..
    Thanks a lot for your help.
   
Best Regards
Jack



----- Original Message ----
From: Jack Jack <sm...@yahoo..com>
To: freeman.fang@gmail.com
Sent: Saturday, October 18, 2008 12:55:41 PM
Subject: Re: ServiceMix-3.2.2 - not able to access serviceMix web console after deploying cxf-bc consumer


Hi Freeman,
   Thanks a lot for your continuous help to resolve the issues with cxf-bc consumer configuration.
   Here I am appending the servicemix.xml and web.xml
   To recap the problem, the following are the details.
    1)Servicemix-3.2.2 version is being used. And the tomcat-5.5 is the application server
    2) locationUri attribute was set for the cxf-bc consumer and it was configured in leight-weight mode using servicemix.xml
    3) Once I start the tomcat server I am getting  java.lang.ClassCastException: org.apache.cxf.transport.jbi.JBIDestination

     4) I wish to avoid starting the jetty server and resuse the http server provided by tomcat. And also wish to use the servlet transport for cxf-bc
        

    It looks something wrong with the web.xml can you please verfiy the web.xml and servicemix.xml
    currently web.xml has the below entry in addition to the entry for cxf servlet. 
<servlet><servlet-name>servicemix-http</servlet-name><servlet-class>org.apache.servicemix.web.http.HttpManagedServlet</servlet-class></servlet>

 I appreciate your help.

Best Regards
Jack

Here I am appending the web.xml , servicemix.xml and tomcat console log 

web.xml
----------

<?xml version="1.0" encoding="UTF-8"?><!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
--><
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"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/j2eeversion="2.4"><description>Apache ServiceMix Console</description><display-name>Apache ServiceMix Console</display-name><context-param><param-name>contextConfigLocation</param-name><param-value>/WEB-INF/applicationContext.xml /WEB-INF/servicemix.xml</param-value></context-param><context-param><param-name>contextClass</param-name><param-value>org.apache.xbean.spring.context.XmlWebApplicationContext</param-value></context-param><!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --><!-- Configuration of the SiteMesh Filter. --><!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 --><filter><filter-name>sitemesh</filter-name><filter-class>com.opensymphony.module.sitemesh.filter.PageFilter</filter-class></filter><filter-mapping><filter-name>sitemesh</filter-name><url-pattern>/*</url-pattern></filter-mapping><!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --><!-- Expose Spring POJOs to JSP . --><!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --><filter><filter-name>spring</filter-name><filter-class>org.apache.servicemix.web.filter.ApplicationContextFilter</filter-class></filter><filter-mapping><filter-name>spring</filter-name><url-pattern>/*</url-pattern></filter-mapping><!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --><!-- ServiceMix servlets --><!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --><servlet><servlet-name>cxf</servlet-name><display-name>cxf</display-name><description>Apache CXF
 Endpoint</description><servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class><load-on-startup>1</load-on-startup></servlet><servlet-mapping><servlet-name>cxf</servlet-name><url-pattern>/services/*</url-pattern></servlet-mapping><!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --><!-- Spring listener. --><!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --><listener><listener-class>org.springframework.web.context.ContextLoaderListener</listener-class></listener><listener><listener-class>org.springframework.web.context.request.RequestContextListener</listener-class></listener><!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --><!-- Configuration of the Spring MVC dispatcher --><!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 --><servlet><servlet-name>dispatcher</servlet-name><servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class><load-on-startup>2</load-on-startup></servlet><servlet><servlet-name>servicemix-http</servlet-name><servlet-class>org.apache.servicemix.web.http.HttpManagedServlet</servlet-class></servlet><servlet-mapping><servlet-name>dispatcher</servlet-name><url-pattern>*.action</url-pattern></servlet-mapping><servlet-mapping><servlet-name>dispatcher</servlet-name><url-pattern>*.svg</url-pattern></servlet-mapping><servlet-mapping><servlet-name>servicemix-http</servlet-name><url-pattern>/jbi/*</url-pattern></servlet-mapping><welcome-file-list><welcome-file>index.html</welcome-file><welcome-file>index.jsp</welcome-file></welcome-file-list><error-page><exception-type>java.lang.Exception</exception-type><location>/error.jsp</location></error-page><!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --><!-- Factor out
 common headers in JSP pages --><!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --><jsp-config><taglib><taglib-uri>http://www..opensymphony.com/sitemesh/decorator</taglib-uri><taglib-location>/WEB-INF/sitemesh-decorator.tld</taglib-location></taglib><taglib><taglib-uri>http://www.opensymphony.com/sitemesh/page</taglib-uri><taglib-location>/WEB-INF/sitemesh-page.tld</taglib-location></taglib><jsp-property-group><url-pattern>*.jsp</url-pattern><include-prelude>/WEB-INF/jspf/headertags.jspf</include-prelude></jsp-property-group></</jsp-config>web-app>

    
servicemix.xml
----------------
<?xml version="1.0" encoding="UTF-8" ?><!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License.. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
--><
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"beans xmlns="http://www.springframework.org/schema/beans"xmlns:sm="http://servicemix.apache.org/config/1.0"xmlns:cxfbc="http://servicemix.apache.org/cxfbc/1.0"xmlns:cxfse="http://servicemix..apache.org/cxfse/1.0"xmlns:ckt="http://circuit.org/order/CircuitSearch" xmlns:audit="http://servicemix.apache.org/audit/1.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://www.springframework.org/schema/beans ><bean id="placeholderConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"><property name="location" value="classpath:servicemix-web-console.properties" /></bean><!-- JMX server --><sm:jmxServer id="server" locateExistingServerIfPossible="true" /><!-- the JBI container --><sm:container id="jbi" rootDir="./data/smx"
 MBeanServer="#server"monitorInstallationDirectory="false"monitorDeploymentDirectory="false"createJmxConnector="false"><sm:activationSpecs><sm:activationSpec><sm:component><cxfbc:component><cxfbc:endpoints><cxfbc:consumer wsdl="/WEB-INF/wsdl/CircuitIR.wsdl"locationURI="http://localhost:8080/apache-servicemix-web-3.2.2/services/circuit"service="ckt:FrameRelayCircuit"interfaceName="ckt:FrameRelayCircuitPortType"targetEndpoint="CircuitPort"targetService="ckt:FrameRelayCircuit"targetInterface="ckt:FrameRelayCircuitPortType" /></cxfbc:endpoints></cxfbc:component></sm:component></sm:activationSpec><sm:activationSpec><sm:component><cxfse:component><cxfse:endpoints><cxfse:endpoint><cxfse:pojo><bean class="org.circuit.order.circuitsearch.FrameRelayCircuitPortTypeImpl"/></cxfse:pojo></cxfse:endpoint></cxfse:endpoints></cxfse:component></sm:component></sm:activationSpec></sm:activationSpecs><sm:listeners><bean
 class="org.apache.servicemix.web.http.HttpComponentListener" /></sm:listeners><sm:services><sm:statistics statsInterval="10" dumpStats="true" /></sm:services></sm:container><bean id="servletContext" class="org.springframework.web.context.support.ServletContextFactoryBean" /><bean id="rootDir" class="org.springframework.web.util.WebUtils" factory-method="getRealPath"><constructor-arg ref="servletContext" /><constructor-arg value="/data/smx" /></bean><sm:dotViewService container="#jbi" autoStart="true" /></
 
 
 beans>
Tomcat console logs:
---------------------
C:\software\apache-tomcat-5.5.26\bin>catalina.bat run
Using CATALINA_BASE:   C:\software\apache-tomcat-5.5.26
Using CATALINA_HOME:   C:\software\apache-tomcat-5.5.26
Using CATALINA_TMPDIR: C:\software\apache-tomcat-5.5.26\temp
Using JRE_HOME:        C:\software\jdk1.5.0_12
Oct 18, 2008 11:14:20 AM org.apache.coyote.http11.Http11BaseProtocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Oct 18, 2008 11:14:20 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1516 ms
Oct 18, 2008 11:14:20 AM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Oct 18, 2008 11:14:20 AM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.5.26
Oct 18, 2008 11:14:20 AM org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
Oct 18, 2008 11:14:28 AM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(C:\software\apache-tomcat-5.5.26\webapps\apache-servicemix-web-3.2.2\WEB-INF\l
ib\geronimo-servlet_2.5_spec-1.2.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offendi
ng class: javax/servlet/Servlet.class
Oct 18, 2008 11:14:28 AM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(C:\software\apache-tomcat-5.5.26\webapps\apache-servicemix-web-3.2.2\WEB-INF\l
ib\servlet-api-2.5-6.1.6.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2.. Offending class
: javax/servlet/Servlet.class
INFO  - JBIContainer                   - ServiceMix 3.2.2 JBI Container (ServiceMix) is starting
INFO  - JBIContainer                   - For help or more information please see: http://servicemix.
apache.org/
INFO  - ComponentMBeanImpl             - Initializing component: #SubscriptionManager#
INFO  - jetty                          - Logging to org.apache.servicemix.http.jetty.JCLLogger@2c17f
7 via org.apache.servicemix.http.jetty.JCLLogger
INFO  - DeploymentService              - Restoring service assemblies
INFO  - ComponentMBeanImpl             - Initializing component: ID:192.168.0.4-11d1085a375-0:0
Oct 18, 2008 11:14:45 AM org.apache.cxf.bus.spring.BusApplicationContext getConfigResources
INFO: No cxf.xml configuration file detected, relying on defaults.
Oct 18, 2008 11:14:49 AM org.apache.cxf.endpoint.ServerImpl initDestination
INFO: Setting the server's publish address to be http://localhost:8080/apache-servicemix-web-3.2.2/s
ervices/circuit
INFO  - ComponentMBeanImpl             - Initializing component: ID:192.168.0.4-11d1085a375-0:1
WARN  - ClientFactory                  - Cound not start ClientFactory: javax.naming.NamingException
: Context is read only
INFO  - ComponentMBeanImpl             - Setting running state for Component: servicemix-cxf-bc to S
tarted
INFO  - ComponentMBeanImpl             - Initializing component: servicemix-cxf-bc
INFO  - ComponentMBeanImpl             - Setting running state for Component: servicemix-cxf-se to S
tarted
INFO  - ComponentMBeanImpl             - Initializing component: servicemix-cxf-se
INFO  - ComponentMBeanImpl             - Setting running state for Component: servicemix-http to Sta
rted
INFO  - ComponentMBeanImpl             - Initializing component: servicemix-http
INFO  - HttpComponentListener          - Component servicemix-http configured.
INFO  - jetty                          - jetty-6.1.6
INFO  - jetty                          - Started SelectChannelConnector@0.0.0.0:8080
Oct 18, 2008 11:14:51 AM org.apache.cxf.service.factory.ReflectionServiceFactoryBean buildServiceFro
mClass
INFO: Creating Service {http://circuit.org/order/CircuitSearch}FrameRelayCircuit from class org.circ
uit.order.circuitsearch.FrameRelayCircuitPortTypeImpl
Oct 18, 2008 11:14:52 AM org.apache.cxf.configuration.spring.ConfigurerImpl getBeanName
INFO: Could not determine bean name for instance of class org.apache.cxf..transport.jbi.JBIDestinatio
n.
Oct 18, 2008 11:14:52 AM org.apache.cxf..endpoint.ServerImpl initDestination
INFO: Setting the server's publish address to be jbi://ID-192-168-0-4-11d1085a375-1-0
INFO  - JBIContainer                   - ServiceMix JBI Container (ServiceMix) started
Oct 18, 2008 11:14:53 AM org.apache.cxf.transport.servlet.CXFServlet loadSpringBus
INFO: Load the bus with application context
Oct 18, 2008 11:14:53 AM org.apache.cxf.bus.spring.BusApplicationContext getConfigResources
INFO: No cxf.xml configuration file detected, relying on defaults.
Oct 18, 2008 11:14:53 AM org.apache.cxf.transport.servlet.AbstractCXFServlet replaceDestinationFacto
ry
INFO: Replaced the http destionFactory with servlet transport factory
Oct 18, 2008 11:14:56 AM org.apache.coyote.http11.Http11BaseProtocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Oct 18, 2008 11:14:56 AM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Oct 18, 2008 11:14:56 AM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/31  config=null
Oct 18, 2008 11:14:56 AM org.apache.catalina.storeconfig.StoreLoader load
INFO: Find registry server-registry.xml at classpath resource
Oct 18, 2008 11:14:56 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 36435 ms
WARN  - jetty                          - EXCEPTION
java.lang.ClassCastException: org.apache.cxf.transport.jbi.JBIDestination
        at org.apache.servicemix.cxfbc.ListServiceHandler.handle(ListServiceHandler.java:80)
        at org.mortbay.jetty.handler.HandlerList.handle(HandlerList.java:49)
        at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
        at org.mortbay.jetty.Server.handle(Server.java:324)
        at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
        at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:828)
        at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514)
        at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
        at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
        at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
        at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:450)


----- Original Message ----
From: Freeman Fang <fr...@gmail.com>
To: users@servicemix.apache.org
Sent: Sunday, August 24, 2008 9:26:57 PM
Subject: Re: ServiceMix-3.2.2 - not able to access serviceMix web console after deploying cxf-bc consumer

Hi,

Would you please append the web.xml and servicemix.xml you are using? 
And the procedure how you deploy and start your tomcat?

Thanks

Freeman

Jack Jack wrote:
> Hi Freeman,
>  I already added the cxf servlet as you mentioned and still getting the ClassCastException..
>  Please see below the complete tomcat console log, especially the highlighted traces.
>  
> Please let me know whether  I need to make any changes to servicemix.xml or web.xml
>  I appreciate your help in this issue. 
>  
> Thanks
> Babu
>  
>
>
> --- On Sat, 8/16/08, Freeman Fang <fr...@gmail.com> wrote:
>
> From: Freeman Fang <fr...@gmail.com>
> Subject: Re: ServiceMix-3.2.2 - not able to access serviceMix web console after deploying cxf-bc consumer
> To: users@servicemix.apache.org
> Date: Saturday, August 16, 2008, 11:59 AM
>
>
> Hi Jack,  Looks like you didn't reuse servlet transport instead of http transport  for cxf bc when you deploy smx into servlet container such as tomcat in  your case.  The error shows that your cxf bc use port 8080 which is started by jetty  underlying and your tomcat can't start at 8080 at all  You need add  <servlet>        <servlet-name>cxf</servlet-name>        <display-name>cxf</display-name>        <description>Apache CXF Endpoint</description>          <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>        <load-on-startup>1</load-on-startup>    </servlet>    <servlet-mapping>        <servlet-name>cxf</servlet-name>        <url-pattern>/services/*</url-pattern>    </servlet-mapping>  to the /webapps/apache-servicemix-web-3.2.2/WEB-INF/web.xml  this servlet just replace http transport with servlet transport, so that  you can avoid starting jetty server when start cxf bc
 consumer, just  reuse the http server provided
>  by your servlet container,  Also, you need add  locationURI="/whateveryouwant"  for your cxf bc consumer configuration  then you can access the wsdl by  http://localhost:8080/apache-servicemix-web-3.2.2/services/whateveryouwant?wsdl        Regards  Freeman    Jack Jack wrote:  > Hi ,  >  I am using tomcat-5.5, serviceMix3.2.2 version and working on  servicemix-cxf-bc. In servicemix.xml CXF-BC consumer was configured with  locationURI.  >  I defined the cxf-bc and cxf-se components in the srevicemix.xml  > At fisrt I specified mistakenly the wrong locationURI where no service is  running as below  >  locationURI=http://circuitdev:8080/circuit/services/circuitSearch  > And I got the below exeception. Realized that locationURI is wrong, set  the URI as below and restarted the tomcat.  >  locationURI=http://localhost:8080/apache-servicemix-web-3.2.2/services/circuitSearch  > Tomcat is running on 8080 port.  After restart
 the  following are the  facts  >  
>  1) Not able to access Tomcat console using http://localhost:8080  >  2) Not able to access servicemix-web console  http://localhost:8080/apache-servicemix-web-3.2.2  >  3) Able to view the WSDL file using the link  http://localhost:8080/apache-servicemix-web-3.2.2/services/circuitSearch?wsdl  >  4) And also found the same exception as shown below  on system console  >  5) Tested the web service and it is working fine.  > Stack from system console is as below  > SEVERE: EXCEPTION  > java.lang.ClassCastException: org...apache.cxf.transport.jbi.JBIDestination  >        at  org.apache.servicemix.cxfbc.ListServiceHandler.handle(ListServiceHandler.java:80)  >        at  org.mortbay.jetty.handler.HandlerList.handle(HandlerList.java:49)  >        at  org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)  >        at org.mortbay.jetty.Server.handle(Server.java:324)  >        at 
>  org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)  >        at  org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:828)  >        at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514)  >        at  org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)  >        at  org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)  >        at  org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)  >        at  org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:450)  > Aug 12, 2008 8:58:34 AM sun.reflect.NativeMethodAccessorImpl invoke0  > Can you please help on why I am not able to access the ServiceMix-web  console? When tried I am getting the below on the screen  > HTTP ERROR: 404  > NOT_FOUND  > RequestURI=/apache-servicemix-web-3.2.2  > Powered by jetty://  > Thanks  > Babu  >  > 
 >        >        
>
>
>      
>  



__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com