Announcement Announcement Module
Collapse
No announcement yet.
NullPointerException in PropertyInfoImpl.calcXmlName() Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • NullPointerException in PropertyInfoImpl.calcXmlName()

    Hello everybody,

    I'm currently trying to make spring-ws work, but unfortunetaly I get an NullPointerException in PropertyInfoImpl.calcXmlName() when I try to run the whole thing
    Currently I'm trying on my actual project, but I also tried the example from the spring-ws homepage (the holiday example) and even that one did not work.

    Well ok, here are the facts...

    I'm running the whole thing in a Tomcat 6.0.16 and I tried both, Java 5 and Java 6.


    And here is the full Stacktrace:
    Code:
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.ws.server.endpoint.mapping.PayloadRootQNameEndpointMapping#0' defined in URL [file:/home/.../WEB-INF/classes/app.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'MovilizerWebServiceEndpoint' defined in URL [file:/home/.../WEB-INF/classes/app.xml]: Cannot resolve reference to bean 'jaxb2Marshaller' while setting bean property 'marshaller'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jaxb2Marshaller' defined in URL [file:/home/.../WEB-INF/classes/app.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException
    	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:478)
    	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
    	java.security.AccessController.doPrivileged(Native Method)
    	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
    	org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
    ....
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'MovilizerWebServiceEndpoint' defined in URL [file:/home/.../WEB-INF/classes/app.xml]: Cannot resolve reference to bean 'jaxb2Marshaller' while setting bean property 'marshaller'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jaxb2Marshaller' defined in URL [file:/home/.../WEB-INF/classes/app.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException
    	org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:275)
    	org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:104)
    	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1244)
    	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1008)
    	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:470)
    	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
    ...
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jaxb2Marshaller' defined in URL [file:/home/.../WEB-INF/classes/app.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException
    	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1336)
    	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:471)
    	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
    	java.security.AccessController.doPrivileged(Native Method)
    ...
    java.lang.NullPointerException
    	com.sun.xml.bind.v2.model.impl.PropertyInfoImpl.calcXmlName(PropertyInfoImpl.java:287)
    	com.sun.xml.bind.v2.model.impl.PropertyInfoImpl.calcXmlName(PropertyInfoImpl.java:260)
    	com.sun.xml.bind.v2.model.impl.ElementPropertyInfoImpl.getTypes(ElementPropertyInfoImpl.java:100)
    	com.sun.xml.bind.v2.model.impl.RuntimeElementPropertyInfoImpl.getTypes(RuntimeElementPropertyInfoImpl.java:50)
    	com.sun.xml.bind.v2.model.impl.ElementPropertyInfoImpl$1.size(ElementPropertyInfoImpl.java:42)
    	java.util.AbstractList$Itr.hasNext(AbstractList.java:416)
    	com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:139)
    	com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:49)
    	com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:41)
    	com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:189)
    	com.sun.xml.bind.v2.model.impl.RegistryInfoImpl.<init>(RegistryInfoImpl.java:63)
    	com.sun.xml.bind.v2.model.impl.ModelBuilder.addRegistry(ModelBuilder.java:232)
    	com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:201)
    	com.sun.xml.bind.v2.runtime.JAXBContextImpl$3.run(JAXBContextImpl.java:352)
    	com.sun.xml.bind.v2.runtime.JAXBContextImpl$3.run(JAXBContextImpl.java:350)
    	java.security.AccessController.doPrivileged(Native Method)
    	com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:349)
    	com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:215)
    	com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:76)
    	com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:55)
    	com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:124)
    	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    	sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    	java.lang.reflect.Method.invoke(Method.java:585)
    	javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:132)
    	javax.xml.bind.ContextFinder.find(ContextFinder.java:286)
    	javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:372)
    	javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:337)
    	org.springframework.oxm.jaxb.Jaxb2Marshaller.createJaxbContextFromContextPath(Jaxb2Marshaller.java:311)
    	org.springframework.oxm.jaxb.Jaxb2Marshaller.createJaxbContext(Jaxb2Marshaller.java:286)
    	org.springframework.oxm.jaxb.AbstractJaxbMarshaller.afterPropertiesSet(AbstractJaxbMarshaller.java:125)
    	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1367)
    	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1333)
    	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:471)
    	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
    	java.security.AccessController.doPrivileged(Native Method)
    	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
    	org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
    	org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:217)
    	org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
    	org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
    	org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
    	org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:269)
    	org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:104)
    	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1244)
    	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1008)
    	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:470)
    	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
    	java.security.AccessController.doPrivileged(Native Method)
    	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
    	org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
    	org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:217)
    	org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
    	org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
    	org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
    	org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:881)
    	
    ...
    (Sorry, I had to shorten the stacktrace to make it fit in here. Let me know if I'm missing something important)


    Does anybody have any idea why that damn thing is so mean to me? (I've spent quite some time on that already. I guess you can tell ;-) )

    Thanks a lot in advance,
    Christian

  • #2
    And I also decompiled the class where the exception occurs:
    Code:
    	private QName calcXmlName(String uri, String local)
                {
    /* 277*/        TODO.checkSpec();
    /* 278*/        if(local.length() == 0 || local.equals("##default"))
                    {/* 279*/            local = seed.getName();
                    }/* 280*/        if(uri.equals("##default"))
                    {/* 281*/            XmlSchema xs = (XmlSchema)reader().getPackageAnnotation(javax/xml/bind/annotation/XmlSchema, parent.getClazz(), this);
                static class _cls1
                {
                            static final int $SwitchMap$javax$xml$bind$annotation$XmlNsForm[];
                            static 
                            {
    /* <-MISALIGNED-> */ /* 285*/                    $SwitchMap$javax$xml$bind$annotation$XmlNsForm = new int[XmlNsForm.values().length];
    /* <-MISALIGNED-> */ /* 285*/                    try
                                {
    /* <-MISALIGNED-> */ /* 285*/                        $SwitchMap$javax$xml$bind$annotation$XmlNsForm[XmlNsForm.QUALIFIED.ordinal()] = 1;
                                }
    /* <-MISALIGNED-> */ /* 285*/                    catch(NoSuchFieldError ex) { }
    /* <-MISALIGNED-> */ /* 285*/                    try
                                {
    /* <-MISALIGNED-> */ /* 285*/                        $SwitchMap$javax$xml$bind$annotation$XmlNsForm[XmlNsForm.UNQUALIFIED.ordinal()] = 2;
                                }
    /* <-MISALIGNED-> */ /* 285*/                    catch(NoSuchFieldError ex) { }
    /* <-MISALIGNED-> */ /* 285*/                    try
                                {
    /* <-MISALIGNED-> */ /* 285*/                        $SwitchMap$javax$xml$bind$annotation$XmlNsForm[XmlNsForm.UNSET.ordinal()] = 3;
                                }
    /* <-MISALIGNED-> */ /* 285*/                    catch(NoSuchFieldError ex) { }
                            }
                }
    /* <-MISALIGNED-> */ /* 284*/            if(xs != null)
                        {
    /* <-MISALIGNED-> */ /* 285*/                switch(_cls1..SwitchMap.javax.xml.bind.annotation.XmlNsForm[xs.elementFormDefault().ordinal()])
                            {
    /* <-MISALIGNED-> */ /* 287*/                case 1: 
    /* <-MISALIGNED-> */ /* 287*/                    uri = parent.getTypeName().getNamespaceURI(); // <--- nullpointerexception here!
    /* <-MISALIGNED-> */ /* 288*/                    if(uri.length() == 0)
                                {
    /* <-MISALIGNED-> */ /* 289*/                        uri = parent.builder.defaultNsUri;
                                }
                                break;
    /* <-MISALIGNED-> */ /* 293*/                case 2: 
    /* <-MISALIGNED-> */ /* 293*/                case 3: 
    /* <-MISALIGNED-> */ /* 293*/                    uri = "";
                                break;
                            }
                        } else
                        {
    /* <-MISALIGNED-> */ /* 296*/                uri = "";
                        }
                    }
    /* <-MISALIGNED-> */ /* 299*/        return new QName(uri.intern(), local.intern());
                }

    Comment


    • #3
      And if all that was not enough, my Maven dependencies are as follows:
      Code:
      		<dependency>
      			<groupId>org.springframework</groupId>
      			<artifactId>spring</artifactId>
      			<version>2.5.3</version><!-- 2.5.3 -->
      		</dependency>
      
      		<dependency>
      			<groupId>org.springframework</groupId>
      			<artifactId>spring-aspects</artifactId>
      			<version>2.5.3</version><!-- 2.5.3 -->
      		</dependency>
      
      		<dependency>
      			<groupId>org.springframework</groupId>
      			<artifactId>spring-web</artifactId>
      			<version>2.5.3</version><!-- 2.5.3 -->
      		</dependency>
      
      		<dependency>
      			<groupId>org.springframework.ws</groupId>
      			<artifactId>spring-ws-core</artifactId>
      			<version>1.5.0</version><!-- 1.5.0 -->
      		</dependency>
      
      		<dependency>
      			<groupId>org.springframework.ws</groupId>
      			<artifactId>spring-ws-core-tiger</artifactId>
      			<version>1.5.0</version><!-- 1.5.0 -->
      		</dependency>
      
      		<dependency>
      			<groupId>org.springframework.ws</groupId>
      			<artifactId>spring-oxm</artifactId>
      			<version>1.5.0</version><!-- 1.5.0 -->
      		</dependency>
      
      		<dependency>
      			<groupId>org.springframework.ws</groupId>
      			<artifactId>spring-oxm-tiger</artifactId>
      			<version>1.5.0</version><!-- 1.5.0 -->
      		</dependency>
      
      		<dependency>
      			<groupId>javax.xml.soap</groupId>
      			<artifactId>saaj-api</artifactId>
      			<version>1.3</version>
      		</dependency>
      
      		<dependency>
      			<groupId>com.sun.xml.messaging.saaj</groupId>
      			<artifactId>saaj-impl</artifactId>
      			<version>1.3</version>
      			<scope>runtime</scope>
      		</dependency>
      
      		<dependency>
      			<groupId>stax</groupId>
      			<artifactId>stax-api</artifactId>
      			<version>1.0.1</version>
      		</dependency>
      
      		<dependency>
      			<groupId>jdom</groupId>
      			<artifactId>jdom</artifactId>
      			<version>1.0</version>
      		</dependency>
      		
      		<dependency>
      			<groupId>jaxen</groupId>
      			<artifactId>jaxen</artifactId>
      			<version>1.1</version>
      		</dependency>
      
      		<dependency>
      			<groupId>javax.xml</groupId>
      			<artifactId>jaxb-api</artifactId>
      			<version>2.0</version><!-- 2.1 -->
      		</dependency>
      
      		<dependency>
      			<groupId>com.sun.xml.bind</groupId>
      			<artifactId>jaxb-impl</artifactId>
      			<version>2.0</version><!-- 2.1.3 -->
      		</dependency>
      
      		<dependency>
      			<groupId>backport-util-concurrent</groupId>
      			<artifactId>backport-util-concurrent</artifactId>
      			<version>3.1</version><!-- 3.1 -->
      		</dependency>
      ... along with some activemq, hibernate, mysql stuff.

      Comment


      • #4
        From the stack trace, it seems like a problem with your jaxb2 mapping.

        Comment


        • #5
          Hi tareq

          ok, at least now I know where to look. Thanks!

          I set up my simple test project again (where I have the same problem than in my actual project), in that the mapping looks as follows:
          Code:
          <?xml version="1.0" encoding="UTF-8"?>
          
          <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://movilitas.com/ext/schemas"
          	xmlns:gps="http://movilitas.com/ext/schemas" elementFormDefault="qualified">
          
          	<element name="transferDescriptionSurvey">
          		<complexType>
          			<sequence>
          				<element name="param0" type="string" />
          			</sequence>
          		</complexType>
          	</element>
          
          	<element name="transferDescriptionSurveyResponse">
          		<complexType>
          			<sequence>
          				<element name="return" type="int" />
          			</sequence>
          		</complexType>
          	</element>
          
          </schema>

          And the spring xml:
          Code:
          <?xml version="1.0" encoding="UTF-8"?>
          <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
          
          
          	<!-- the XML Marshaller / Unmarshaller -->
          	<bean id="jaxb2Marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
          		<property name="classesToBeBound">
          			<list>
          				<value>com.movilitas.ext.schemas.TransferDescriptionSurvey</value>
          				<value>com.movilitas.ext.schemas.TransferDescriptionSurveyResponse</value>
          			</list>
          		</property>
          		<property name="schema" value="/WEB-INF/extService.xsd" />
          	</bean>
          
          	<!-- the EndPoint for the external services  -->
          	<bean id="extServiceEndpoint" class="com.movilitas.extservice.ws.ExtServiceEndpoint">
          		<property name="marshaller" ref="jaxb2Marshaller" />
          		<property name="unmarshaller" ref="jaxb2Marshaller" />
          	</bean>
          
          	<!-- the mapping from a SAOPMessage to the EndPoint -->
          	<bean class="org.springframework.ws.server.endpoint.mapping.PayloadRootQNameEndpointMapping">
          		<property name="mappings">
          			<props>
          				<prop key="{http://movilitas.com/ext/schemas}TransferDescriptionSurvey">extServiceEndpoint</prop>
          				<prop key="{http://movilitas.com/ext/schemas}TransferDescriptionSurveyResponse">extServiceEndpoint</prop>
          			</props>
          		</property>
          		<property name="interceptors">
          			<bean class="org.springframework.ws.server.endpoint.interceptor.PayloadLoggingInterceptor" />
          		</property>
          	</bean>
          
          	<!-- the service itself -->
          	<bean id="extService" class="org.springframework.ws.wsdl.wsdl11.DynamicWsdl11Definition">
          		<property name="builder">
          			<bean class="org.springframework.ws.wsdl.wsdl11.builder.XsdBasedSoap11Wsdl4jDefinitionBuilder">
          				<property name="schema" value="/WEB-INF/extService.xsd" />
          				<property name="portTypeName" value="ExtServicePortType" />
          				<property name="locationUri" value="http://localhost:8080/extws/" />
          				<property name="targetNamespace" value="http://movilitas.com/extws/schemas" />
          			</bean>
          		</property>
          	</bean>
          
          
          </beans>
          You don't see anything wrong here either, do you?

          bye,
          Ch

          Comment


          • #6
            How do TransferDescriptionSurvey and TransferDescriptionSurveyResponse look like? Were they generated by xjc? And I'd like also to see the content of package-info.java (if any).

            Comment


            • #7
              hey,

              you're like a mindreader, I was just looking at the package info (or maybe I'm the one reading thoughts here ;-) )! Anyway, to me it looks ... well I can't say.

              Ok, so the jaxb classes are generated by the maven-jaxb-plugin.

              The generated package-info.java looks like this:
              Code:
              @javax.xml.bind.annotation.XmlSchema(namespace = "http://movilitas.com/ext/schemas", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
              package com.movilitas.ext.schemas;
              And the generated classes (I'll only post one):
              Code:
              package com.movilitas.ext.schemas;
              
              import javax.xml.bind.annotation.XmlAccessType;
              import javax.xml.bind.annotation.XmlAccessorType;
              import javax.xml.bind.annotation.XmlElement;
              import javax.xml.bind.annotation.XmlRootElement;
              import javax.xml.bind.annotation.XmlType;
              
              
              /**
               * <p>Java class for anonymous complex type.
               * 
               * <p>The following schema fragment specifies the expected content contained within this class.
               * 
               * <pre>
               * &lt;complexType>
               *   &lt;complexContent>
               *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
               *       &lt;sequence>
               *         &lt;element name="param0" type="{http://www.w3.org/2001/XMLSchema}string"/>
               *       &lt;/sequence>
               *     &lt;/restriction>
               *   &lt;/complexContent>
               * &lt;/complexType>
               * </pre>
               * 
               * 
               */
              @XmlAccessorType(XmlAccessType.FIELD)
              @XmlType(name = "", propOrder = {
                  "param0"
              })
              @XmlRootElement(name = "transferDescriptionSurvey")
              public class TransferDescriptionSurvey {
              
                  @XmlElement(required = true)
                  protected String param0;
              
                  /**
                   * Gets the value of the param0 property.
                   * 
                   * @return
                   *     possible object is
                   *     {@link String }
                   *     
                   */
                  public String getParam0() {
                      return param0;
                  }
              
                  /**
                   * Sets the value of the param0 property.
                   * 
                   * @param value
                   *     allowed object is
                   *     {@link String }
                   *     
                   */
                  public void setParam0(String value) {
                      this.param0 = value;
                  }
              
              }

              Comment


              • #8
                It might be a problem with the jars you're using. Check out these threads:
                http://forums.java.net/jive/message....ssageID=205766
                http://forum.springframework.org/showthread.php?t=44249

                Comment


                • #9
                  Tareq, you were right!

                  For anybody who has the same problem: Updating the jaxb-impl solved the problem

                  Code:
                  		<dependency>
                  			<groupId>com.sun.xml.bind</groupId>
                  			<artifactId>jaxb-impl</artifactId>
                  			<version>2.0.3</version>
                  		</dependency>
                  Thanks tareq for your help!

                  bye,
                  Christian

                  Comment

                  Working...
                  X