简体   繁体   中英

Weblogic 12.2 - CXF 3.1 - JAXB 2.2 - Deployment : Error javax.xml.ws.WebServiceException: java.lang.IllegalStateException: The prefix X is not bound

Error occurs when starting weblogic server:

Problem with the wsdl generated:

 org.springframework.beans.factory.BeanCreationException: Error creating bean with name '': Invocation of init method failed; nested exception is javax.xml.ws.WebServiceException: java.lang.IllegalStateException: The prefix X is not bound. at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) Caused by: javax.xml.ws.WebServiceException: java.lang.IllegalStateException: The prefix X is not bound. at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:375) at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:255) at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:543) Caused by: java.lang.IllegalStateException: The prefix X is not bound. at org.apache.ws.commons.schema.SchemaBuilder.getRefQName(SchemaBuilder.java:823) at org.apache.ws.commons.schema.SchemaBuilder.getRefQName(SchemaBuilder.java:831) 

Namespace not found on the element root while it's defined in the @XmlRootElement

Here the SchemaBuilder.getRefQName source code :

https://github.com/wso2/wso2-xmlschema/blob/master/xmlschema/src/main/java/org/apache/ws/commons/schema/SchemaBuilder.java

        prefix = pName.substring(0, offset);
        uri = NodeNamespaceContext.getNamespaceURI(pNode, prefix);
        if (uri == null || Constants.NULL_NS_URI.equals(uri)) {
            if (schema.parent != null
                    && schema.parent.getNamespaceContext() != null) {
                uri = schema.parent.getNamespaceContext().getNamespaceURI(
                        prefix);
            }
        }

        if (uri == null || Constants.NULL_NS_URI.equals(uri)) {
            throw new IllegalStateException("The prefix " + prefix
                    + " is not bound.");
        }

Any idea please?

My problem is resolved by adding the namesapce in the @XmlType annotation defined in the java entity:

@XmlType(name = "", propOrder = { "elt1", "elt2", "elt3" }, namespace ="http://xyz" )

避免版本兼容性问题似乎更好的另一种解决方案是强制您的项目使用weblogic库。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM