13 Replies Latest reply on Jan 10, 2006 10:26 AM by Alexander Schlett

    Can't find serializer...

    Ryan Newbie

      Heya all,

      I followed all the instructions on the wiki page to create a document literal web service. I've wrapped my original interface and I'm returning an array of objects in a bean. The web service call comes in a-ok, but when trying to write the response, I get the message:

      java.io.IOException: No serializer found for class profiles.SeacProfileBean in registry org.jboss.axis.encoding.TypeMappingImpl@d9d6ae
       at org.jboss.axis.encoding.SerializationContextImpl.serializeActual(SerializationContextImpl.java:1484)
      


      In the .wsdd file published on the server (in the data directory):

      <typeMapping
       qname='ns2:SeacProfileBean' xmlns:ns2='http://service.profiles/types'
       type='java:profiles.SeacProfileBean'
       serializer='org.jboss.webservice.encoding.ser.MetaDataBeanSerializerFactory'
       deserializer='org.jboss.webservice.encoding.ser.MetaDataBeanDeserializerFactory'
       encodingStyle=''>
       <typeDesc>
       <elementDesc fieldName='profileName' xmlName='profileName'/>
       <elementDesc fieldName='username' xmlName='username'/>
       <elementOrder>
       <element name='profileName'/>
       <element name='username'/>
       </elementOrder>
       </typeDesc>
       </typeMapping>
      


      When I turn on "DEBUG" for org.jboss.axis... I see where the error is occurring...

      2005-06-09 14:11:46,750 DEBUG [org.jboss.axis.utils.BeanPropertyDescriptor] got: [Lprofiles.SeacProfileBean;@13a0067
      2005-06-09 14:11:46,750 DEBUG [org.jboss.axis.encoding.ser.BeanSerializer] Item type is null
      2005-06-09 14:11:46,750 DEBUG [org.jboss.axis.encoding.SerializationContextImpl] Enter:getSerializer: [class=class profiles.SeacProfileBean,xmlType=null]
      


      I'm wondering why there's a little L in front of this line:

      2005-06-09 14:11:46,750 DEBUG [org.jboss.axis.utils.BeanPropertyDescriptor] got: [Lprofiles.SeacProfileBean;@13a0067
      


      Anyone else come across a problem like this? Seems like the type mapping has been registered... not sure why it can't be found. Is there a way to see what type mappings are registered?

      Thanks,
      Ryan

      p.s. I've created an ant build file that simplifies deploying a JBoss web service if anyone is interested, I'll post a link on the wiki.

        • 1. Re: Can't find serializer...
          Bruce Scharlau Newbie

          kanno,

          you probably need to put the class files generated by wscompile from your WSDL file under the WEB-INF/classes directory of the war that you've deployed your WS in. (Or under the META-INF/classes if you've used a jar with a SLSB).

          Basically the error message mean the service can't find your classes, and you need to put them in the usual place.

          Bruce

          • 2. Re: Can't find serializer...
            Ryan Newbie

             

            "Scharlau" wrote:
            kanno,

            you probably need to put the class files generated by wscompile from your WSDL file under the WEB-INF/classes directory of the war that you've deployed your WS in. (Or under the META-INF/classes if you've used a jar with a SLSB).

            Basically the error message mean the service can't find your classes, and you need to put them in the usual place.

            Bruce


            Bruce,

            I thought that the class files generated by wscompile... aside from the Response/Response_Struct ones (used to wrap original classes) are artifacts that aren't even used. I was under the assumption that JBoss uses its own internal classes such as BeanSerializerFactory, etc using introspection and the mapping files to map the xml data into memory, and from memory back to xml.

            (I could be wrong though... still don't understand why the mapping can't be found in the registry when I can see it in the .wsdd file; unless of course the namespace is incorrect, but from what I can tell... it looks right) :)

            _Ryan


            • 3. Re: Can't find serializer...
              Thomas Diesler Master

              Ryan,

              your assumption is right, we only need the request response structures and array wrappers generated by wscompile. All other artifacts are jwsdp specific.

              You WS fails because it cannot find the mapping of the an array type.

              The [LSomeType; is how java denotes an array type.

              • 4. Re: Can't find serializer...
                Ryan Newbie

                 

                "thomas.diesler@jboss.com" wrote:
                Ryan,

                your assumption is right, we only need the request response structures and array wrappers generated by wscompile. All other artifacts are jwsdp specific.

                You WS fails because it cannot find the mapping of the an array type.

                The [LSomeType; is how java denotes an array type.



                Thomas,

                But isn't this the mapping in the .wsdd file in the data directory?

                typeMapping
                 qname='ns2:SeacProfileBean' xmlns:ns2='http://service.profiles/types'
                 type='java:profiles.SeacProfileBean'
                 serializer='org.jboss.webservice.encoding.ser.MetaDataBeanSerializerFactory'
                 deserializer='org.jboss.webservice.encoding.ser.MetaDataBeanDeserializerFactory'
                 encodingStyle=''>
                 <typeDesc>
                 <elementDesc fieldName='profileName' xmlName='profileName'/>
                 <elementDesc fieldName='username' xmlName='username'/>
                 <elementOrder>
                 <element name='profileName'/>
                 <element name='username'/>
                 </elementOrder>
                 </typeDesc>
                 </typeMapping>
                


                or do I need to specify my own in the ws4ee file? This works in 4.0.1, but for some reason, doesn't deploy in 4.0.2.

                _Ryan

                • 5. Re: Can't find serializer...
                  Jason Greene Master

                  Did you wrap your array in a java bean?

                  -Jason

                  • 6. Re: Can't find serializer...
                    Ryan Newbie

                    Yep, I followed the exact instructions on the website. I wrapped the array in a JavaBean... it looks as though it's attempting to serialize the original array type and that's the serializer that can't be found, even though I can see the typemapping in the .wsdd file on the server.

                    • 7. Re: Can't find serializer...
                      Ryan Newbie

                      I'm wondering if there's anyway to see into the Typemapping registry at runtime... I want to see why there's no mapping for the type SeacProfileBean when I can see the mapping in the wsdd file in the data directory... I looked at the source... and it appears that in

                      BeanSerializer.java... this is where the code fails...

                      if (!isEncoded && propValue != null && JavaUtils.isArrayClass(propValue.getClass())
                       && !Constants.XSD_BASE64.equals(xmlType) && !Constants.XSD_HEXBIN.equals(xmlType))
                       {
                       QName itemType;
                      
                       if (itemXmlType == null)
                       {
                       Class componentType = propValue.getClass().getComponentType();
                       itemType = context.getQNameForClass(componentType);
                       }
                       else
                       {
                       itemType = itemXmlType;
                       }
                      
                       log.debug("Item type is " + itemType);
                       for (int j = 0; j < Array.getLength(propValue); j++)
                       {
                       Object item = Array.get(propValue, j);
                       context.serialize(qname, null, item, itemType, true, new Boolean(false));
                       }
                       }
                      


                      Specifically, when JBossWS is serializing the array within the wrapper class, the itemType is null because of the line(s):

                      Class componentType = propValue.getClass().getComponentType();
                      itemType = context.getQNameForClass(componentType);
                      


                      Since the error indicates the appropriate class name, the componentType is coming back correctly... profiles.SeacProfileBean. I'm wondering why
                      itemType comes back as null from context.getQNameForClass()... which calls getTypeMapping().getTypeQName(cls)... especially if I can see the typemapping in the wsdd file. Could there have possibly been an error where even though the .wsdd file on the server in the data directory displays the mapping, it wasn't read into memory because the actual class file couldn't be loaded?

                      Thanks,
                      Ryan


                      • 8. Re: Can't find serializer...
                        Thomas Diesler Master

                        I am eager to see this deployment that works in jboss-4.0.1 and fails in jboss-4.0.2.

                        Please create a jira issue and attach a sample deployment (with source) that shows your problem.

                        • 9. Re: Can't find serializer...
                          Ryan Newbie

                           

                          "thomas.diesler@jboss.com" wrote:
                          I am eager to see this deployment that works in jboss-4.0.1 and fails in jboss-4.0.2.

                          Please create a jira issue and attach a sample deployment (with source) that shows your problem.


                          Ok... after hours of deploying and undeploying - and testing and what not... it came down to a classloader issue. Apparently, 4.0.2 was throwing this error because as I surmised earlier, one of the loaders was getting confused about the classes since I packaged the same class in both the web service war/ejb jar. I resolved this issue by using the Class-Path in the manifest files to point to one jar file in the .ear and *poof*, the application doesn't throw any errors anymore. I still found it interesting that 4.0.1, the application worked fine, then in 4.0.2, the application didn't. :P

                          Now... all I have to figure out is when I make a call to a local home interface of a session bean... it's taking like 17 seconds, when on 4.0.1, the call took like 2 seconds. =/ Anyone else seen this? :P

                          _Ryan

                          • 10. Re: Can't find serializer...
                            Ryan Newbie

                             

                            "kanno" wrote:
                            "thomas.diesler@jboss.com" wrote:
                            I am eager to see this deployment that works in jboss-4.0.1 and fails in jboss-4.0.2.

                            Please create a jira issue and attach a sample deployment (with source) that shows your problem.


                            Ok... after hours of deploying and undeploying - and testing and what not... it came down to a classloader issue. Apparently, 4.0.2 was throwing this error because as I surmised earlier, one of the loaders was getting confused about the classes since I packaged the same class in both the web service war/ejb jar. I resolved this issue by using the Class-Path in the manifest files to point to one jar file in the .ear and *poof*, the application doesn't throw any errors anymore. I still found it interesting that 4.0.1, the application worked fine, then in 4.0.2, the application didn't. :P

                            Now... all I have to figure out is when I make a call to a local home interface of a session bean... it's taking like 17 seconds, when on 4.0.1, the call took like 2 seconds. =/ Anyone else seen this? :P

                            _Ryan


                            Oh... one last thing... to debug this problem, I used Sun's Application Verification Kit found here:

                            http://java.sun.com/j2ee/avk/

                            I set it up as an Ant task and verified the war/ejb jar/ear that I was deploying. It's pretty neat as it runs through a whole bunch of verification tests that allow you to "test your application for correct use of J2EE APIs and to maintain portability across J2EE compatible application servers"

                            • 11. Re: Can't find serializer...
                              Thomas Diesler Master

                              The release notes of jboss-4.0.2 tell you about a change in default of

                               <!-- A flag indicating if the JBoss Loader should be used. This loader
                               uses a unified class loader as the class loader rather than the tomcat
                               specific class loader.
                               The default is false to ensure that wars have isolated class loading
                               for duplicate jars and jsp files.
                               -->
                               <attribute name="UseJBossWebLoader">false</attribute>
                              




                              • 12. Re: Can't find serializer...
                                Ryan Newbie

                                 

                                "thomas.diesler@jboss.com" wrote:
                                The release notes of jboss-4.0.2 tell you about a change in default of

                                 <!-- A flag indicating if the JBoss Loader should be used. This loader
                                 uses a unified class loader as the class loader rather than the tomcat
                                 specific class loader.
                                 The default is false to ensure that wars have isolated class loading
                                 for duplicate jars and jsp files.
                                 -->
                                 <attribute name="UseJBossWebLoader">false</attribute>
                                




                                Yeah, I had seen this in the 4.0.2 release notes, that's why I made sure that my 4.0.1 and 4.0.2 used similar configurations (both set to false). :)



                                • 13. Re: Can't find serializer...
                                  Alexander Schlett Newbie

                                  hi,
                                  now that I stumble upon the same problem, I wonder what the exact reason for the "Can't find serializer" exception is when "UseJBossWebLoader" is set to false? I'm deploying my application together with axis 1.3 not using JbossWS.
                                  This works fine in WAS 6. The Axis war calls a session bean via EJBProvider. The bean is in the ejb jar. Is the problem that the war doeasn't see the classes in the jar, though both are in one ear? If so, is it possible to specify anything to change this, like manifest entries or similar?
                                  thanks,
                                  alex