2 Replies Latest reply on Sep 3, 2009 2:35 PM by Stefan Eder

    ClassCastException: java.lang.String

    Stefan Eder Newbie

      Hey all!
      Since this is my first post in a forum like this (never had a problem where Google hadn't the answer right away), forgive me if I forget anything... or violate any rules. But to come to the point, my problem is the following:

      I currently try to integrate JBossESB into an already existing webapplication (or is it vice versa... doesn't matter). The specs are:

      * JBoss AS 4.2.3
      * JBossWS 3.0.4
      * JDK 5 (with update 20 I think)
      * SEAM 2.1.2
      * Hibernate 3
      * and: JBossESB 4.6

      Since I wanted to expose something as a webservice I redesigned the already existing usermanagement (login, add users, and what so ever) and used the "webservice_wsadressing" as a guide for how to configure the JBossESB part. Everything was fine, whereby I mean the testing of the webservice with SoapUI (directly and indirecly over the ESB) and even a standalone test I wrote was successful, but then I started the webapp and tried to login with a user and along came this pretty Exception:

      02:33:01,437 ERROR [LoginBean] javax.xml.ws.WebServiceException: java.io.IOException: Could not transmit message
      javax.xml.ws.WebServiceException: java.io.IOException: Could not transmit message
       at org.jboss.ws.core.jaxws.client.ClientImpl.handleRemoteException(ClientImpl.java:404)
       at org.jboss.ws.core.jaxws.client.ClientImpl.invoke(ClientImpl.java:314)
       at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:172)
       at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:152)
       at $Proxy311.login(Unknown Source)
       at at.fhj.itm.usermanagement.ws.UserManagementFacadeWS.login(UserManagementFacadeWS.java:63)
       at at.fhj.itm.usermanagement.LoginBean.login(LoginBean.java:120)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
       at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
       at java.lang.Thread.run(Thread.java:595)
      Caused by: java.io.IOException: Could not transmit message
       at org.jboss.ws.core.client.HTTPRemotingConnection.invoke(HTTPRemotingConnection.java:255)
       at org.jboss.ws.core.client.SOAPProtocolConnectionHTTP.invoke(SOAPProtocolConnectionHTTP.java:73)
       at org.jboss.ws.core.CommonClient.invoke(CommonClient.java:339)
       at org.jboss.ws.core.jaxws.client.ClientImpl.invoke(ClientImpl.java:302)
       ... 118 more
      Caused by: java.lang.ClassCastException: java.lang.String
       at org.jboss.ws.core.client.HTTPRemotingConnection.invoke(HTTPRemotingConnection.java:233)
       ... 121 more

      Which led me to search the web and some .pdfs for answers and solutions, but til now I haven't found one, which does the trick of vaporizing this bastardous Exception... apologies. I also looked into the source code of the JBossWS (I had to update from 3.0.3 to 3.0.4 to find the exact location (which is line: 242):

      package org.jboss.ws.core.client;
      import org.jboss.remoting.Client;
      public class HTTPRemotingConnection {
       public MessageAbstraction invoke(MessageAbstraction reqMessage, Object endpoint, boolean oneway) throws IOException {
       MessageAbstraction resMessage = null;
       if (oneway == true) {
       client.invokeOneway(reqMessage, metadata, false);
       } else {
       //Here comes the cast of death, line 242:
       resMessage = (MessageAbstraction)client.invoke(reqMessage, metadata);

      So I guess it is some Classpath issue with jboss-remoting... but till now I haven't found out what could possibly interfere. I would appreciate it if anyone could help me out here. I provide more information on demand.

      So long!

      Before I forget:
      When I use the "normal" wdsl link (http://localhost:8080/servicepath/Endpoint?wdsl --> location=http://localhost:8080/servicepath/Endpoint) the webservice works even with the webapp!
      But the "esb" link (http://localhost:8080/contract.jsp?serviceCat=cat&serviceName=name&protocol=http --> location=http://localhost:8765) results in the Exception mentioned above.

        • 1. Re: ClassCastException: java.lang.String
          Tom Fennelly Master

          Did you patch the AS with a newer version of JBossWS, or is v3.0.4 the version bundled with v4.2.3 of the AS?

          • 2. Re: ClassCastException: java.lang.String (Problemo solved...
            Stefan Eder Newbie


            "tfennelly" wrote:
            Did you patch the AS with a newer version of JBossWS, or is v3.0.4 the version bundled with v4.2.3 of the AS?

            Actually the bundled version with the AS 4.2.3 seems to be 3.0.3 (at least the log said this). I updated it to 3.0.4 (there was no source code for 3.0.3 to download). This update - as curious at it sounds - helped indeed, but not with the JDK5.

            I switched to the JDK6 (out of curiosity and... I was desperate too ;) ) and finally the SOAP message was sent to the ESB. At first the ESB crashed with the "setProperty must be overridden by all subclasses of SOAPMessage" Exception, but I smiled because I already knew what to do, thanks to this post which I found earlier: https://jira.jboss.org/jira/browse/JBWS-2418
            This didn't help with JDK6 and the JBossWS 3.0.3, but with 3.0.4 it worked.

            So I solved the problem accidentally... but maybe someone knows a rational answer? I'm curious.

            So long!

            PS: Additionally I found out, that it wasn't the String ClassCastException which caused the problem. I forgot to configure the logging for the JBossWS and JBossESB classes. It was a SOAPMessageImpl ClassCastExecption... stupid me.