Skip to main content

There's no ObjectFactory with an @XmlElementDecl for the element .., but its placed in ObjectFactory 'n given to new JAXBContext

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
2 replies [Last post]
andre0815
Offline
Joined: 2008-03-25

Hello,

At creating ne instance of JAXBContext with JAXBContext.newInstance(..) I get the error

- There's no ObjectFactory with an @XmlElementDecl for the element {http://myuri}Value.

I have verified that the right valid ObjectFactory is given as parameter to JAXBContext.newInstance(..)

and its parameterised.

Next I have reviewed my ObjectFactory that is generated by HyperJaxB3 and see again no errors.

Can anybody see the error ?

<code>

import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.XmlElementDecl;
import javax.xml.bind.annotation.XmlRegistry;
import javax.xml.namespace.QName;
@XmlRegistry
public class ObjectFactory {

private final static QName _MultiLangStringValue_QNAME = new QName("http://myuri", "Value");

/**
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.inubit.businessrepository
*
*/
public ObjectFactory() {
}

/**
* Create an instance of {@link Password }
*
*/
public Password createPassword() {
return new Password();
}

/**
* Create an instance of {@link MultiLangString }
*
*/
public MultiLangString createMultiLangString() {
return new MultiLangString();
}

/**
* Create an instance of {@link Value }
*
*/
public Value createValue() {
return new Value();
}

/**
* Create an instance of {@link JAXBElement }{@code <}{@link Value }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://myuri", name = "Value", scope = MultiLangString.class)
public JAXBElement<Value> createMultiLangStringValue(Value value) {
return new JAXBElement<Value>(_MultiLangStringValue_QNAME, Value.class, MultiLangString.class, value);
}

}
</code>

As you can see an @XmlElementDecl(namespace = "http://myuri", name = "Value", scope = MultiLangString.class) is available..

hm..

Best thank for advises.

Andre, Berlin

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
andre0815
Offline
Joined: 2008-03-25

I am facing on hyperjaxb mailing list why HJ3 does not generate the necessary XmlSeeAlso etc..

rgs

andre0815
Offline
Joined: 2008-03-25

Problem has been solved by using package names instead of root classes at creating new JaxB context with newinstance method.

greats