Hi ???,

it has been a frequent problem in the past that various application servers (incl. for example Websphere, ...) fail to be 100%-specification compliant in various areas.

The fact that it works just fine on WAS or RAD clearly indicates that Castor is not the problem (cause). Most fo the time it turns out that ....

a) Websphere needs to be (re)configured in oyur PROD environment to allow proper (spec-compliant) class loading. b) There's old versions of various libraries used in various places pre-configured, hence having a negative impact on class loading.

I know that this is not much of a help, but most of the time this is what folks told us weeks later after posting their original questions/problems.

Kind Regards
Werner

On 27.07.2010 22:29, sric1 wrote:

Hello,

I am using Spring2.5.6 and Castor 1.3.1 for my webservice. I have used
Source generator to generate my java classes from XSD. Everything is working
fine in the local server(WAS on RAD). But when i deploy it on the server, It
is complaining that it cannot find castor generated classes. I am not sure
what is wrong. I am using Maven to manage dependencies from a repository of
jars.

<code>
<bean id="webServiceTemplate"
class="org.springframework.ws.client.core.WebServiceTemplate">
                <constructor-arg ref="messageFactory" />
                <property name="defaultUri" value="${uri}" />
                <property name="marshaller" ref="marshaller" />
                <property name="unmarshaller" ref="marshaller" />
        </bean>

        <bean id="marshaller"
class="org.springframework.oxm.castor.CastorMarshaller" />
</code>


Then i wrote a class to extend CastorMarshaller as below. This class adds
the castor generated descriptor package to the XMLContext. But i still get
the same problem. After receiving XML message, when castor tries to convert
it to java object, it throws an exception saying castor generated classes
cannot be found.
<code>
public class CustomCastorMarshaller extends CastorMarshaller {

        protected XMLContext createXMLContext(Resource[] mappingLocations,
                        Class targetClass) throws MappingException, IOException,
                        ResolverException {
                XMLContext context = new XMLContext();
                logger.debug("Adding org.aamc.amspullservice.oxm.castor package 
to
XMLContext");
                context.addPackages(new String[] { 
"org.test.oxm.castor.descriptors" });
                if (!ObjectUtils.isEmpty(mappingLocations)) {
                        Mapping mapping = new Mapping();
                        for (int i = 0; i<  mappingLocations.length; i++) {
                                mapping.loadMapping(SaxUtils
                                                
.createInputSource(mappingLocations[i]));
                        }
                        context.addMapping(mapping);
                }
                if (targetClass != null) {
                        context.addClass(targetClass);
                }
                return context;
        }

}
</code>
<code>
<bean id="marshaller" class="org.test.CustomCastorMarshaller " />
</code>

Note: i have .castor.cdr file in my castor generated package. Any help would
be greatly appreciated.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email


Reply via email to