1 Reply Latest reply on Nov 13, 2010 10:09 AM by Douglas Oviche

    JBoss EJB unable to invoke webservices by using their class implementation

    Douglas Oviche Newbie
      Hi there guys,
      I am a JEE Architect in Rome Italy and I was engaged to design, architect and deploy a distributed enterprise system based on EJB, JPA and Webservices.
      The webservice architecture is based on CXF WS and the entire system must be must be deployed on jboss-5.1.0.GA.
      I've used Maven to generate my webservices and they have been created properly by using "wsdl2java".
      All webservice endpoints are deployed on different providers machines so that if one wants to make use of these services
      that one has to implement its own package by using the WSDLs made available by these different providers.
      So, as I mentioned already we've decide to generate the whole services by using "wsdl2java" in our pom.xml configuration and pointing at
      the WSDL files location. Every single service has been created perfectly.
      We've also been able to deploy the whole WS package onto apache-tomcat-6.0.18 to test services endpoints, everything is pretty working.
      Then, we have created a package of EJB3 where they are just SessionFacade components and each of these ejb provides its own public service(Method)
      and within their public services they use the webservice implementation obtained from the maven generation process.
      All these enterprise beans have been deployed and made available, they are properly invoked by servlets that we are using as test
      to simultate the real clients making request onto the jboss platform to request for these services.
      The whole picture is:
      1- Webservices CXF package have been created and deployed on tomcat.
         (Spring configuration has displayed the correct webservice creation on tomcat web server)
      2- Enterprise Java Beans have been deployed on jboss-5.1.0.GA
         (They are supposed to invoked webservices implementation by using the generated class representing the webservice implementation
          @javax.jws.WebService)
      3- A testing servlet(Invokes ejb on jboss as)
      The problem we are facing now is that when servlets invoke a specific enterprise javabeans from apache-tomcat-6.0.18 to jboss-5.1.0.GA
      we get the following error:
      com.sun.xml.ws.server.UnsupportedMediaException: Unsupported Content-Type: text/plain Supported ones are: [text/xml]
      Honestly, I would see a better design, deploying these webservices(CXF) on jboss to cut off one of the artifacts or partipants
      in terms of number of servers making part of the whole design.
      My view is:
      1- WebService(CXF) package to be deployed on Jboss.
      2- Enterprise Java Beans which use the webserives implementations to provide these services onto our clients.
      3- Servlets to provide testing units in order to mock and simulate future clients requests and traffic.
      This is it!!  this is how I see things in a proper design solution
      We sadly stuck on this and it's frustating the way things are turning.
      We do really appreciate any kind of help by any one of you to tackle this problem.
      Sincerely
      Douglas

      Hi there guys,

      I am a JEE Architect in Rome Italy and I was engaged to design, architect and deploy a distributed enterprise system based on EJB, JPA and Webservices.

      The webservice architecture is based on CXF WS and the entire system must be must be deployed on jboss-5.1.0.GA.

      I've used Maven to generate my webservices and they have been created properly by using "wsdl2java".

       

      All webservice endpoints are deployed on different providers machines so that if one wants to make use of these services

      that one has to implement its own package by using the WSDLs made available by these different providers.

       

      So, as I mentioned already we've decide to generate the whole services by using "wsdl2java" in our pom.xml configuration and pointing at

      the WSDL files location. Every single service has been created perfectly.

       

      Well, basicly, I have a SessionBean that tries to invoke the webservice by using its class implementation, when the ejb tries to invoke the webservice I am obtaining the following error:

       

       

       

      00:00:31,296 INFO  [STDOUT] Invoking otaHotelRateAmountNotifRequest...

      00:00:34,000 ERROR [STDERR] com.sun.xml.ws.server.UnsupportedMediaException: Unsupported Content-Type: text/plain Supported ones are: [text/xml]

      00:00:34,000 ERROR [STDERR]     at com.sun.xml.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:291)

      00:00:34,000 ERROR [STDERR]     at com.sun.xml.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:128)

      00:00:34,000 ERROR [STDERR]     at com.sun.xml.ws.encoding.SOAPBindingCodec.decode(SOAPBindingCodec.java:287)

      00:00:34,015 ERROR [STDERR]     at com.sun.xml.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:171)

      00:00:34,015 ERROR [STDERR]     at com.sun.xml.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:86)

      00:00:34,015 ERROR [STDERR]     at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:595)

      00:00:34,015 ERROR [STDERR]     at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:554)

      00:00:34,015 ERROR [STDERR]     at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:539)

      00:00:34,015 ERROR [STDERR]     at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:436)

      00:00:34,031 ERROR [STDERR]     at com.sun.xml.ws.client.Stub.process(Stub.java:248)

      00:00:34,031 ERROR [STDERR]     at com.sun.xml.ws.client.sei.SEIStub.doProcess(SEIStub.java:135)

      00:00:34,031 ERROR [STDERR]     at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:109)

      00:00:34,031 ERROR [STDERR]     at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:89)

      00:00:34,031 ERROR [STDERR]     at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:118)

      00:00:34,031 ERROR [STDERR]     at $Proxy326.otaHotelRateAmountNotifRequest(Unknown Source)

      00:00:34,031 ERROR [STDERR]     at com.venere.xhi.OTAHotelRateAmountNotifPortTypeImpl.otaHotelRateAmountNotifRequest(OTAHotelRateAmountNotifPortTypeIm

      00:00:34,031 ERROR [STDERR]     at com.fhp.enterprise.venere.OTAHotelRateAmountNotifBeanSessionFacade.executeOtaRateAmountRequest(OTAHotelRateAmountNo

      00:00:34,031 ERROR [STDERR]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      00:00:34,031 ERROR [STDERR]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

      00:00:34,031 ERROR [STDERR]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

      00:00:34,031 ERROR [STDERR]     at java.lang.reflect.Method.invoke(Method.java:597)

      00:00:34,031 ERROR [STDERR]     at org.jboss.invocation.Invocation.performCall(Invocation.java:386)

      00:00:34,031 ERROR [STDERR]     at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:228)

      00:00:34,031 ERROR [STDERR]     at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:156)

      00:00:34,031 ERROR [STDERR]     at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63)

      00:00:34,046 ERROR [STDERR]     at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121)

      00:00:34,046 ERROR [STDERR]     at org.jboss.ejb.plugins.AbstractTxInterceptorBMT.invokeNext(AbstractTxInterceptorBMT.java:173)

      00:00:34,046 ERROR [STDERR]     at org.jboss.ejb.plugins.TxInterceptorBMT.invoke(TxInterceptorBMT.java:77)

      00:00:34,046 ERROR [STDERR]     at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:173)

      00:00:34,046 ERROR [STDERR]     at org.jboss.ejb.plugins.SecurityInterceptor.process(SecurityInterceptor.java:228)

      00:00:34,046 ERROR [STDERR]     at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:211)

      00:00:34,062 ERROR [STDERR]     at org.jboss.ejb.plugins.security.PreSecurityInterceptor.process(PreSecurityInterceptor.java:97)

      00:00:34,062 ERROR [STDERR]     at org.jboss.ejb.plugins.security.PreSecurityInterceptor.invoke(PreSecurityInterceptor.java:81)

      00:00:34,062 ERROR [STDERR]     at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)

      00:00:34,062 ERROR [STDERR]     at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:138)

      00:00:34,062 ERROR [STDERR]     at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:650)

      00:00:34,062 ERROR [STDERR]     at org.jboss.ejb.Container.invoke(Container.java:1029)

      00:00:34,093 ERROR [STDERR]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      00:00:34,109 ERROR [STDERR]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

      00:00:34,109 ERROR [STDERR]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

      00:00:34,109 ERROR [STDERR]     at java.lang.reflect.Method.invoke(Method.java:597)

      00:00:34,109 ERROR [STDERR]     at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)

      00:00:34,109 ERROR [STDERR]     at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)

      00:00:34,109 ERROR [STDERR]     at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)

      00:00:34,125 ERROR [STDERR]     at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)

      00:00:34,125 ERROR [STDERR]     at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)

      00:00:34,125 ERROR [STDERR]     at org.jboss.invocation.unified.server.UnifiedInvoker.invoke(UnifiedInvoker.java:232)

      00:00:34,125 ERROR [STDERR]     at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:891)

      00:00:34,125 ERROR [STDERR]     at org.jboss.remoting.transport.socket.ServerThread.completeInvocation(ServerThread.java:744)

      00:00:34,125 ERROR [STDERR]     at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:697)

      00:00:34,140 ERROR [STDERR]     at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:551)

      00:00:34,140 ERROR [STDERR]     at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:232)

      00:00:34,140 ERROR [LogInterceptor] RuntimeException in method: public abstract void com.fhp.enterprise.venere.OTAHotelRateAmountNotifSessionFacadeRem

      java.lang.RuntimeException: com.sun.xml.ws.server.UnsupportedMediaException: Unsupported Content-Type: text/plain Supported ones are: [text/xml]

              at com.venere.xhi.OTAHotelRateAmountNotifPortTypeImpl.otaHotelRateAmountNotifRequest(OTAHotelRateAmountNotifPortTypeImpl.java:56)

              at com.fhp.enterprise.venere.OTAHotelRateAmountNotifBeanSessionFacade.executeOtaRateAmountRequest(OTAHotelRateAmountNotifBeanSessionFacade.jav

              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

              at java.lang.reflect.Method.invoke(Method.java:597)

              at org.jboss.invocation.Invocation.performCall(Invocation.java:386)

              at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:228)

              at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:156)

              at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63)

              at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121)

              at org.jboss.ejb.plugins.AbstractTxInterceptorBMT.invokeNext(AbstractTxInterceptorBMT.java:173)

              at org.jboss.ejb.plugins.TxInterceptorBMT.invoke(TxInterceptorBMT.java:77)

              at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:173)

              at org.jboss.ejb.plugins.SecurityInterceptor.process(SecurityInterceptor.java:228)

              at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:211)

              at org.jboss.ejb.plugins.security.PreSecurityInterceptor.process(PreSecurityInterceptor.java:97)

              at org.jboss.ejb.plugins.security.PreSecurityInterceptor.invoke(PreSecurityInterceptor.java:81)

              at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)

              at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:138)

              at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:650)

              at org.jboss.ejb.Container.invoke(Container.java:1029)

              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

              at java.lang.reflect.Method.invoke(Method.java:597)

              at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)

              at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)

              at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)

              at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)

              at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)

              at org.jboss.invocation.unified.server.UnifiedInvoker.invoke(UnifiedInvoker.java:232)

              at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:891)

              at org.jboss.remoting.transport.socket.ServerThread.completeInvocation(ServerThread.java:744)

              at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:697)

              at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:551)

              at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:232)

      Caused by: com.sun.xml.ws.server.UnsupportedMediaException: Unsupported Content-Type: text/plain Supported ones are: [text/xml]

              at com.sun.xml.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:291)

              at com.sun.xml.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:128)

              at com.sun.xml.ws.encoding.SOAPBindingCodec.decode(SOAPBindingCodec.java:287)

              at com.sun.xml.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:171)

              at com.sun.xml.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:86)

              at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:595)

              at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:554)

              at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:539)

              at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:436)

              at com.sun.xml.ws.client.Stub.process(Stub.java:248)

              at com.sun.xml.ws.client.sei.SEIStub.doProcess(SEIStub.java:135)

              at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:109)

              at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:89)

              at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:118)

              at $Proxy326.otaHotelRateAmountNotifRequest(Unknown Source)

              at com.venere.xhi.OTAHotelRateAmountNotifPortTypeImpl.otaHotelRateAmountNotifRequest(OTAHotelRateAmountNotifPortTypeImpl.java:49)

              ... 36 more

      00:00:34,281 ERROR [ServerThread] WorkerThread#0[127.0.0.1:3785] failed

      java.io.NotSerializableException: com.sun.xml.ws.util.localization.LocalizableMessage

              at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1156)

              at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)

              at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)

              at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)

              at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)

              at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)

              at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:416)

              at java.lang.Throwable.writeObject(Throwable.java:648)

              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

              at java.lang.reflect.Method.invoke(Method.java:597)

              at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945)

              at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1461)

              at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)

              at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)

              at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)

              at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)

              at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)

              at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)

              at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)

              at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)

              at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)

              at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)

              at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)

              at org.jboss.remoting.serialization.impl.java.JavaSerializationManager.sendObjectVersion2_2(JavaSerializationManager.java:120)

              at org.jboss.remoting.serialization.impl.java.JavaSerializationManager.sendObject(JavaSerializationManager.java:95)

              at org.jboss.remoting.marshal.serializable.SerializableMarshaller.write(SerializableMarshaller.java:120)

              at org.jboss.invocation.unified.marshall.InvocationMarshaller.write(InvocationMarshaller.java:75)

              at org.jboss.remoting.transport.socket.ServerThread.versionedWrite(ServerThread.java:1006)

              at org.jboss.remoting.transport.socket.ServerThread.completeInvocation(ServerThread.java:783)

              at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:697)

              at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:551)

              at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:232)

       

       

       

      Does any one of you have come across this error before?

       

      Thanks in advance PALs

       

      Douglas

        • 1. Re: JBoss EJB unable to invoke webservices by using their class implementation
          Douglas Oviche Newbie

          Hi to everyone of you,

          I managed to solve the problem.

           

          Problem:

          Consumers were invoking an ejb Session Stateless and the ejb was trying to make webservice invokation obtaining the following error:

          com.sun.xml.ws.server.UnsupportedMediaException: Unsupported Content-Type: text/plain Supported ones are: [text/xml]

           

          [#|2010-11-13T14:48:08.875+0100|WARNING|glassfish3.0.1|javax.enterprise.resource.corba.ee._CORBA_.util|_ThreadID=29;_ThreadName=Thread-1;|"IOP00100006: (BAD_PARAM) Class com.sun.xml.ws.util.localization.LocalizableMessage is not Serializable"

           

          The remote webservice retrieved a Soap envelop with a Context-Type: text/plain and when the ejb tried make the call, it failed because the it could not manage to marshall/unmarshall the text/plain response to java object.

           

          My mastake was to use the implementation class obtained from the WSDL2Java within my ejb public method/service without taking into acount the fact that webservices are enabled to manifest themselve in a completely different context and they are capable to perform a specific tast in certain way because they are deployed in web-context which allows them to manifest through their different configuration files as per example is my case CXF(beans.xml).

           

           

          Solution:

           

          I've built the whole webservice software/package by using Maven CXF WSDL2JAVA.

          I've deployed the package as WebApp.

          Consumers invoke my enterprise java bean(s)  and my enterprise makes http call to a Servlet responsible for making the call at a specific endpoint.

          Everything is working terrificly perfect.

           

           

          I am sorry for not knowing this particular issue and not being able to provide as much information as you guys would have needed to help me out.

           

          Next time, I will try to be more concise.

           

          Thanks to everyone anyways

           

           

          Douglas