Announcement Announcement Module
Collapse
No announcement yet.
Spring-JAXWS error Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring-JAXWS error

    I am writing authenticate service using Spring 2.5.6 with both Hessian remoting implementation and jaxws web service implement. Hession remoting is working fine. However, there is still error in jaxws web service implementation. Basically, I follow the instruction of the link https://jax-ws-commons.dev.java.net/spring/ and have both JAXWS2.1.1 and jaxws-spring download . In the process, I got com.sun.xml.ws.model.RuntimeModelerException: runtime modeler error: Wrapper class com.ceg.security.core.jaxws.jaxws.Authenticate is not found. Have you run APT to generate them.
    I ran ant wsgen and resolve that issue. Now, I got another error like the following

    nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'authenticateServiceEndpoint': FactoryBean threw exception on object creation; nested exception is java.lang.NullPointerException
    at org.springframework.beans.factory.support.BeanDefi nitionValueResolver.resolveReference(BeanDefinitio nValueResolver.java:275)
    at org.springframework.beans.factory.support.BeanDefi nitionValueResolver.resolveValueIfNecessary(BeanDe finitionValueResolver.java:104)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.applyPropertyValues(Abs tractAutowireCapableBeanFactory.java:1245)
    at
    :
    :
    at org.springframework.context.support.AbstractApplic ationContext.finishBeanFactoryInitialization(Abstr actApplicationContext.java:728)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:380)
    at org.springframework.web.context.ContextLoader.crea teWebApplicationContext(ContextLoader.java:255)
    at org.springframework.web.context.ContextLoader.init WebApplicationContext(ContextLoader.java:199)
    at org.springframework.web.context.ContextLoaderListe ner.contextInitialized(ContextLoaderListener.java: 45)
    at org.apache.catalina.core.StandardContext.listenerS tart(StandardContext.java:3843)

    Caused by: org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'authenticateServiceEndpoint': FactoryBean threw exception on object creation; nested exception is java.lang.NullPointerException
    at org.springframework.beans.factory.support.FactoryB eanRegistrySupport$1.run(FactoryBeanRegistrySuppor t.java:127)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.springframework.beans.factory.support.FactoryB eanRegistrySupport.doGetObjectFromFactoryBean(Fact oryBeanRegistrySupport.java:116)
    at org.springframework.beans.factory.support.FactoryB eanRegistrySupport.getObjectFromFactoryBean(Factor yBeanRegistrySupport.java:91)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getObjectForBeanInstance(AbstractBeanF actory.java:1288)
    at org.springframework.beans.factory.support.Abstract BeanFactory.doGetBean(AbstractBeanFactory.java:217 )
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:185)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:164)
    at org.springframework.beans.factory.support.BeanDefi nitionValueResolver.resolveReference(BeanDefinitio nValueResolver.java:269)
    ... 42 more
    Caused by: java.lang.NullPointerException
    at com.sun.xml.ws.api.BindingID.parse(BindingID.java: 290)
    at org.jvnet.jax_ws_commons.spring.SpringService.getO bject(SpringService.java:294)
    at org.jvnet.jax_ws_commons.spring.SpringService.getO bject(SpringService.java:45)
    at org.springframework.beans.factory.support.FactoryB eanRegistrySupport$1.run(FactoryBeanRegistrySuppor t.java:121)


    Any idea, why, I attached both web.xml and applicationContext.xml. I am not using autowired. Thanks.

  • #2
    Spring-Jaxws error : resolved

    I resolved the problem myself. I checked with spring-jax-ws-core.xsd.html in my jaxws-spring jar, bindingID attribute rely upon SEI, which is impl attribute. That's required even though I have nested bean of the same class defined. I put back impl attribute and it started working.

    I had that attribute defined in the beginning. I took that out because I I got com.sun.xml.ws.model.RuntimeModelerException. In order to solve that issue, I ran ant wsgen. wsgen does not like Autowired in my web service class. Therefore, I took Autowired out. I have to rely upon nested bean to inject the property in ws:service. To avoid define duplicate implementation class, I took impl attribute out. Apparently, jaxws-spring implementation think differently.

    If you want to use Spring-JAXWS implementation
    1) follow https://jax-ws-commons.dev.java.net/spring/
    2) run wsgen on your web service implementation class.
    3) make sure you have impl attribute defined in ws:service even you define nested implementation bean.
    Thanks

    Comment


    • #3
      Spring-JAXWS error : resolution correction

      Make one final correction. My previous settings:

      <ws:service id="authenticateWebService" impl="com.ceg.security.core.jaxws.AuthenticateServ iceEndpoint" >
      <bean class="com.ceg.security.core.jaxws.AuthenticateSer viceEndpoint">
      <property name="authenticateService" ref="ldapAuthenticateServiceImpl" />
      </bean>
      </ws:service>

      won't cause any error when deployed. However, nested bean does not take effect. Basically, it creates a default instance of impl class. Property authenticateService injection was not applied. Therefore, I got NullPointerException when the web service method was executed.

      The followings are final working configuration for your reference.

      <bean id="authenticateServiceEndpoint" class="com.ceg.security.core.jaxws.AuthenticateSer viceEndpoint">
      <property name="authenticateService" ref="ldapAuthenticateServiceImpl" />
      </bean>

      <wss:binding id="jax-ws.http" url="/webservice">
      <wss:service><!-- nested bean is of course fine -->
      <ws:service bean="#authenticateServiceEndpoint" />
      </wss:service>
      </wss:binding>

      https://jax-ws-commons.dev.java.net/spring/ does provide a sample of this flavor. Thanks.

      Comment

      Working...
      X