Results 1 to 10 of 22

Thread: how to deploy Spring WS with JaxBMarshaller

Hybrid View

  1. #1
    Join Date
    Dec 2007
    Posts
    15

    Default how to deploy Spring WS with JaxBMarshaller

    i tried to make all the configurations as given in spring web service documentation in web.xml and spring-ws-servlet.xml for MarshallingEndpoint with JaxBMarshalling/Unmarshalling.

    I have used dynamic wsdl generation bean in spring-ws-servlet.xml

    I have no idea how to deploy it to server so that it exposes it as web service.

    By just deploying it as web application to oc4j server its not configuring it as service


    I have attached the config files....


    Somebody please help me in this issue...
    Attached Files Attached Files

  2. #2
    Join Date
    Nov 2007
    Location
    Manila, Philippines
    Posts
    3

    Default

    Hi Virfal,

    Checking your configuration files, they look pretty straight forward. What is the exact error you're getting? If it is a 404 (File Not Found), this could mean that your web application was not properly deployed or you are accessing an incorrect port. However, if it is a 500 (Internal Server Error), you would have to check the SystemOut log files of your OC4J Application Server for details. You may want to post the logs and the schema as well. Remember you first need to check if you were able to generate a proper WSDL. Looking at your config files, the URL of the WSDL should be something like: http://<hostname>:<port>/<WebApplica...me>/Hello.wsdl

    Hope that helps.

  3. #3
    Join Date
    Dec 2007
    Posts
    15

    Default

    It was a 404(File not Found) .....so it was not getting deployed properly...i added following to web.xml and it started creating all beans in config file .......

    <listener>
    <listener-class>org.springframework.web.context.ContextLoade rListener</listener-class>
    </listener>


    Still its not generating wsdl and am getting error while creating beans on deployment as following:


    Error creating bean with name 'helloEndpoint' defined in ServletContext resource [/WEB-INF/spring-ws-servlet.xml]: Cannot resolve reference to bean 'marshaller' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'marshaller' defined in ServletContext resource [/WEB-INF/spring-ws-servlet.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: javax.xml.bind.JAXBContext.newInstance([Ljava/lang/ClassLjavax/xml/bind/JAXBContext;




    I tried running application in embedded oc4j with index.jsp to get web context....then while loading application it gave same error with following more details................



    Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultL istableBeanFactory@1325573: defining beans [helloEndpoint,marshaller,unmarshaller,helloService ,Hello]; root of factory hierarchy
    Dec 11, 2007 10:39:43 AM org.springframework.oxm.jaxb.Jaxb2Marshaller createJaxbContextFromClasses
    INFO: Creating JAXBContext with classes to be bound [class com.beans.HelloRequest,class com.beans.HelloResponse]
    Dec 11, 2007 10:39:43 AM org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry destroySingletons
    INFO: Destroying singletons in org.springframework.beans.factory.support.DefaultL istableBeanFactory@1325573: defining beans [helloEndpoint,marshaller,unmarshaller,helloService ,Hello]; root of factory hierarchy
    Dec 11, 2007 10:39:43 AM org.springframework.web.context.ContextLoader initWebApplicationContext
    SEVERE: Context initialization failed
    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'helloEndpoint' defined in ServletContext resource [/WEB-INF/spring-ws-servlet.xml]: Cannot resolve reference to bean 'marshaller' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'marshaller' defined in ServletContext resource [/WEB-INF/spring-ws-servlet.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: javax.xml.bind.JAXBContext.newInstance([Ljava/lang/ClassLjavax/xml/bind/JAXBContext;
    Caused by: org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'marshaller' defined in ServletContext resource [/WEB-INF/spring-ws-servlet.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: javax.xml.bind.JAXBContext.newInstance([Ljava/lang/ClassLjavax/xml/bind/JAXBContext;
    Caused by: java.lang.NoSuchMethodError: javax.xml.bind.JAXBContext.newInstance([Ljava/lang/ClassLjavax/xml/bind/JAXBContext;
    at org.springframework.oxm.jaxb.Jaxb2Marshaller.creat eJaxbContextFromClasses(Jaxb2Marshaller.java:306)
    at org.springframework.oxm.jaxb.Jaxb2Marshaller.creat eJaxbContext(Jaxb2Marshaller.java:280)
    at org.springframework.oxm.jaxb.AbstractJaxbMarshalle r.afterPropertiesSet(AbstractJaxbMarshaller.java:1 25)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.invokeInitMethods(Abstr actAutowireCapableBeanFactory.java:1201)

    .......




    I tried different versions of JAXB libraries but its not helping it out (dont know whether its conflict between JAXB libs and spring libs having marshalling classes).....

    Without adding JAXB libs its giving me error for attachment bean in jaxb... somewhere its getting referenced from spring libs

    error is as follow:
    Cannot resolve reference to bean 'marshaller' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'marshaller' defined in ServletContext resource [/WEB-INF/spring-ws-servlet.xml]: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/attachment/AttachmentUnmarshaller
    Last edited by virfal; Dec 11th, 2007 at 10:34 AM.

  4. #4
    Join Date
    Jul 2006
    Posts
    138

    Default

    You're getting that error because your "marshaller" bean is failing to be constructed properly, so it doesn't exist to be injected into your endpoint:

    Code:
    Caused by: org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'marshaller' defined in ServletContext resource [/WEB-INF/spring-ws-servlet.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError:
    I'm not an expert, but this is what my "marshaller" bean looks like:

    Code:
        <bean id="marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
            <description>
                The JAXB 2 Marshaller is used by the endpoints.
            </description>
            <property name="contextPath" value="com.mg21.shotgun.ws.bindings.catalog"/>
        </bean>
    Where "com.mg21.shotgun.ws.bindings.catalog" is the package to my XJC generated classes.

  5. #5
    Join Date
    Dec 2007
    Posts
    15

    Default

    replacing "classesToBeBound" property with "contextPath" given in ur reply...

    it started giving me different error as follow.....


    Cannot resolve reference to bean 'marshaller' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'marshaller' defined in ServletContext resource [/WEB-INF/spring-ws-servlet.xml]: Invocation of init method failed; nested exception is org.springframework.oxm.jaxb.JaxbSystemException: Unable to locate jaxb.properties for package com.mg21.shotgun.ws.bindings.catalog; nested exception is javax.xml.bind.JAXBException: Unable to locate jaxb.properties for package com.mg21.shotgun.ws.bindings.catalog

    dont know how this approach works

  6. #6
    Join Date
    Jul 2006
    Posts
    138

    Default

    Well, you need to change the contextPath to point to the package containing your XJC generated classes. It looks like you just copied and pasted my example without changing anything.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •