users@jaxb.java.net

RE: Crashing problems in ModelBuilder.getClassInfo

From: Regan, Jeremy (CGI Federal) <"Regan,>
Date: Fri, 21 Dec 2012 00:12:35 +0000

Hi, Thank you for your reply!

Yes you understand correctly, this worked fine with JDK6 and the problem appears with JDK7. From my understanding now JAXB is part of rt.jar of the JDK. So my question to you is, how do I even accomplish (1) from below? I built WSGenerator with a certain classpath but at runtime, the task in ant is going to use rt.jar so I think that is going to be the JAXB implementation used. Here is the ant task:

<path id="WebServiceGenerator-classpath">
      <pathelement path="${basedir}/"/>
      <pathelement location="${apache-config-jar-location}"/>
      <pathelement location="${jaxb-config-jar-location}"/>
      <pathelement location="${jaxp-config-jar-location}"/>
      <path refid="all.runtime.classpath"/>
      <pathelement path="${deploy.dir}/properties"/>
      <pathelement path="${components.dir}/webservices/consumer"/>
      <pathelement path="${components.dir}/webservices/provider"/>
      <pathelement path="${deploy.dir}/${app.name}/xml/wsPolicy"/>
      <fileset dir="${components.dir}/${previous-app-name}/lib/app" includes="**/*-webservices.jar" erroronmissingdir="false"/>
      <pathelement path="${components.dir}/lib/system"/>
    </path>

But see the command doesn't have a bootclasspath/p option:

<java classname="com.ams.core.renderer2.WebServiceGenerator"
          jvm="${build.java.executable}"
          fork="true"
          dir="${basedir}"
          failonerror="true"
          taskname="WSGenerator"
          classpathref="WebServiceGenerator-classpath">
      <jvmarg line="${jvm.args} -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled ${jvm.PermSize} ${jvm.MaxPermSize} -XX:+HeapDumpOnOutOfMemoryError"/>

I tried to use a bootclasspath/p option, but the problem is that we override some of the JAXB classes in our application, so then I had to bring in the kitchen sink as it were, which I can't do.

So if you can give insight into how to get around these classpath problems that would be great.

Here is the class though that is the problematic one:

import javax.annotation.Generated;
import javax.xml.bind.annotation.XmlType;

@Generated(value="com.sorry.cant.include.this")
@XmlType(name="BPMCBpmProcess", namespace="http://bpmprocess.sorry.cant.include.this.core.ams.com/", propOrder={""})
public class BPMCBpmProcess extends com.sorry.cant.include.this.bpmprocess.impl.BPMCBpmProcess_Impl {

    static final long serialVersionUID = 1L;
}

The impl class:

@XmlAccessorOrder(value = XmlAccessOrder.ALPHABETICAL)
@XmlAccessorType(value = XmlAccessType.NONE)
@XmlTransient
public abstract class BPMCBpmProcess_Impl extends com.sorry.cant.include.this.BPMCBpmProcess_Base {

...(nothing important)

The base class:

@Generated(value="com.sorry.cant.include.this.FormObjectRenderer")
@XmlAccessorOrder(value=XmlAccessOrder.ALPHABETICAL)
@XmlAccessorType(value=XmlAccessType.NONE)
@XmlTransient
public abstract class BPMCBpmProcess_Base extends ... implements ... {

here's the base class with all of the actual properties used in the JAXB schema generation:

@Generated(value="com.....FormObjectRenderer")
@XmlAccessorOrder(value=XmlAccessOrder.ALPHABETICAL)
@XmlAccessorType(value=XmlAccessType.NONE)
@XmlTransient
public abstract class AbstractCoreGuidDomain_Base extends ... implements ... {

    static final long serialVersionUID = 1L;

    /**
     * the default class id
     */
    public static final String CLASS_ID = "AbstractCoreGuidDomain";

    /**
     * string representation of default domain object state
     */
    public static final String DEFAULT_STATE = "";

    /**
     * Static Constant for referring to Field "guid"
     */
    @javax.annotation.Generated(value="com.....FieldConstants")
    public static final String FIELD_GUID = "guid";

    /**
     * Static Constant array of sorted field names used by {_at_link #getString(String)} and {_at_link #setString(String, String)}
     */
    @javax.annotation.Generated(value="com.....DataObject")
    private static final String[] DATA_OBJECT_FIELDS = {FIELD_GUID};

    /**
     * Represents the basic display label for this instance
     */
    @javax.annotation.Generated(value="com.....ContextAware")
    public static final String DISPLAY_LABEL = "{RESOURCE:/domain/com/ams/core/AbstractCoreGuidDomain:properties.label}";

    /**
     * The map of field names to labels
     */
    @javax.annotation.Generated(value="com.....ContextAware")
    private static final Map<String, String> mFieldLabels = new HashMap<String, String>();

    /**
     * Static Constant array of sorted field names used by {_at_link #getString(String)} and {_at_link #setString(String, String)}
     */
    @javax.annotation.Generated(value="com.....FormObjectRenderer")
    private static final String[] FORM_OBJECT_FIELDS = {FIELD_GUID};

    static {
        mFieldLabels.put("guid", "{RESOURCE:/.../AbstractCoreGuidDomain:field.guid.properties.label}");
    }
    
    /**
     * Unique Constructor
     */
    public AbstractCoreGuidDomain_Base() {
        super();
        setClassId(CLASS_ID);
        setDomainObjectState(DEFAULT_STATE);
    }

    
    /**
     * Returns the dynamic extension data for this domain
     * @param strDataValue The data value for the associated extension
     * @return DynamicExtensionBase
     */
    @Generated(value="com.....FormObjectRenderer")
    @Override
    public DynamicExtensionBase getDynamicExtensionBase(String strDataValue) {
        return DynamicExtensionUtil.getInstance().getDynamicExtensionBase(this.getClassId(), strDataValue, "");
    }

    
    /**
     * Get the guid attribute
     * @return String
     */
    @XmlElement(name="guid", namespace="http://....ams.com/", type=String.class, nillable=false, required=true)
    public String getGuid() {
        String value = getValue( FIELD_GUID );
        return (StringUtils.isBlank(value)) ? null : value;
    }

All of the rest of the properties are all just like guid. Sometimes it crashes on guid property. But other times it does not. I really feel this is a synchronization issue. Please let me know what you think.

Thanks,
Jeremy

    

-----Original Message-----
From: Iaroslav Savytskyi [mailto:iaroslav.savytskyi_at_oracle.com]
Sent: Thursday, December 20, 2012 11:33 AM
To: users_at_jaxb.java.net
Subject: Re: Crashing problems in ModelBuilder.getClassInfo

Hi, Jeremy,

Did I understand right that app was working fine with JDK6 and the problem appeared only with JDK7?

There are several things we can do:

1) You can try to use the newest JAXB release 2.2.6. May be a bug is fixed already:

http://jaxb.java.net/2.2.6/

2) You can provide that objects for which you were trying to create JAXBContext. And I'll try to find the problem.

--
Yarda


On 20/12/12 16:07, Regan, Jeremy (CGI Federal) wrote:
> Hello everyone!
>
> I am upgrading our software to use the 1.7 jdk which includes JAXB now in the rt.jar. I am running into a problem that is mysterious... if I debug it I can get it to work, but if I let it just run, it always fails on some property. Here is the stack trace of the failure. It seems like an iterator is trying to get an element that has already been consumed. Can you help me determine what is the problem here? What can I change to fix this? Let me know if I can provide any additional information about the object that fails. I am kind of new to this but I know that there is the WSDL file and the actual XSD schema, and the "ref" elements are part of the schema. This object is failing to even generate that schema, and it seems on the ref elements. Another thing is that it feels like this is threading related because if I do a clean build, parts of the stack trash "smash" each other due to not having synchronization on System.out. I have an example of a smashed stack tra!
 ce output
below the cleaner stack trace showing the issue. Any help is greatly appreciated.
>
> [WSGenerator] Caused by: java.lang.NullPointerException
> [WSGenerator] at $Proxy37.required(Unknown Source)
> [WSGenerator] at com.sun.xml.bind.v2.model.impl.ElementPropertyInfoImpl.getTypes(ElementPropertyInfoImpl.java:143)
> [WSGenerator] at com.sun.xml.bind.v2.model.impl.RuntimeElementPropertyInfoImpl.getTypes(RuntimeElementPropertyInfoImpl.java:90)
> [WSGenerator] at com.sun.xml.bind.v2.model.impl.ElementPropertyInfoImpl$1.size(ElementPropertyInfoImpl.java:82)
> [WSGenerator] at java.util.AbstractList$Itr.hasNext(AbstractList.java:351)
> [WSGenerator] at com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:259)
> [WSGenerator] at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:104)
> [WSGenerator] at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:85)
> [WSGenerator] at com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:213)
> [WSGenerator] at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:99)
> [WSGenerator] at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:85)
> [WSGenerator] at com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:319)
> [WSGenerator] at com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:334)
> [WSGenerator] at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:460)
> [WSGenerator] at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:298)
> [WSGenerator] at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:141)
> [WSGenerator] at com.sun.xml.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1157)
> [WSGenerator] at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:188)
> [WSGenerator] at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:167)
> [WSGenerator] at com.ams.core.xml.jaxb.ContextFactory.createContext(ContextFactory.java:265)
> [WSGenerator] at com.ams.core.renderer2.schema.JaxbSchemaGenerator.createJAXBContext(JaxbSchemaGenerator.java:400)
> [WSGenerator] at com.ams.core.renderer2.schema.JaxbSchemaGenerator.generateSchemaForParameters(JaxbSchemaGenerator.java:203)
> [WSGenerator] at org.apache.axis2.jaxbri.JaxbSchemaGenerator.generateSchema(JaxbSchemaGenerator.java:66)
> [WSGenerator] at com.ams.core.renderer2.schema.JaxbSchemaGenerator.generateSchema(JaxbSchemaGenerator.java:173)
> [WSGenerator] at org.apache.axis2.description.AxisService.createService(AxisService.java:2529)
>
>
> A smashed one:
>
> [WSGenerator] Caused by: java.lang.NullPointerException
> [WSGenerator] at $Proxy37.required(Unknowt com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:298)
> [WSGenerator] at com.sun.xml.bind.v2.runtime.JAXBContextImpl.n Source)
> [WSGenerator] at com.sun.xml.bind.v2.model.impl.ElementPropertyInfoImpl.getTypes(ElementPropertyInfoImpl.java:143)
> [WSGenerator] at com.sun.xm<init>(JAXBContextImpl.java:141)
> [WSGenerator] at com.sun.xml.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:l.bind.v2.model.impl.RuntimeElementPropertyInfoImpl.getTypes(RuntimeElementPropertyInfoImpl.java:90)
> [WSGenerator] at com.sun.xml.bind.v2.mo1157)
> [WSGenerator] at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:188)
> [WSGenerator] at com.sun.xml.bind.v2.ContextFactory.credel.impl.ElementPropertyInfoImpl$1.size(ElementPropertyInfoImpl.java:82)
> [WSGenerator] at java.util.AbstractList$Itr.hasNext(AbstractList.jaateContext(ContextFactory.java:167)
> [WSGenerator] at com.ams.core.xml.jaxb.ContextFactory.createContext(ContextFactory.java:265)
> [WSGenerator] at com.amva:351)
> [WSGenerator] at com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:259)
> [WSGenerator] at com.sun.xml.bind.v2.model.impls.core.renderer2.schema.JaxbSchemaGenerator.createJAXBContext(JaxbSchemaGenerator.java:400)
> [WSGenerator] at com.ams.core.renderer2.schema.J.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:104)
> [WSGenerator] at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassaxbSchemaGenerator.generateSchemaForParameters(JaxbSchemaGenerator.java:203)
> [WSGenerator] at org.apache.axis2.jaxbri.JaxbSchemaGenerator.geInfo(RuntimeModelBuilder.java:85)
>
>
> Thank you for taking a look!
> Jeremy
>
>
>