Skip to main content

JAXB Catalog and Bindings File

1 reply [Last post]
mikeb
Offline
Joined: 2004-03-04
Points: 0

Hi All, I'm having an issue when using a catalog to resolve external files and a bindings file to customize generated packages. When I just specify the catalog and no bindings file, the xsd documents are resolved locally with no issues and code is generated but in the wrong package. However when I add the binding specification, I start getting network errors that suggest the catalog is being ignored and the xsd are being resolved remotely. Any ideas why the catalog is being ignored when the binding file is specified? Thanks in advance for you help.
The workaround at the moment is to change the schemaLocation to point to a local xsd, but I'd prefer not to modify the xsd documents.
Relevant maven output

[INFO] Compiling file:/C:/workspaces/xxxx/schema-wssecurity/src/main/resources/oasis-200401-wss-wssecurity-secext-1.0.xsd
[ERROR] [ERROR] Connection timed out: connect
[ERROR] unknown location
[ERROR]
[ERROR] [ERROR] Connection timed out: connect
[ERROR] unknown location
[ERROR]
[ERROR] [ERROR] Connection timed out: connect
[ERROR] unknown location
[ERROR]

Relevant section from pom.xml

<plugin>
    <groupId>com.sun.tools.xjc.maven2</groupId>
    <artifactId>maven-jaxb-plugin</artifactId>
    <executions>
        <execution>
            <goals>
                <goal>generate</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <catalog>catalog.cat</catalog>
        <includeBindings>
            <includeBinding>bindings/*.xml</includeBinding>
        </includeBindings>
        <xdebug>true</xdebug>
        <verbose>true</verbose>
    </configuration>
</plugin>

My Catalog File - catalog.cat

PUBLIC 
"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
"src/main/resources/oasis-200401-wss-wssecurity-secext-1.0.xsd"

PUBLIC
"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
"src/main/resources/xsd/oasis-200401-wss-wssecurity-utility-1.0.xsd"

PUBLIC "http://www.w3.org/XML/1998/namespace" "src/main/resources/xsd/xml.xsd"

PUBLIC "http://www.w3.org/2000/09/xmldsig#" "src/main/resources/xsd/xmldsig-core-schema.xsd"

PUBLIC "-//W3C//DTD XMLSchema 200102//EN" "src/main/resources/xsd/XMLSchema.dtd"

JAXB Bindings file - jaxb.xml
<?xml version="1.0" encoding="UTF-8"?>
<jaxb:bindings version="2.1" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <jaxb:bindings schemaLocation="../oasis-200401-wss-wssecurity-secext-1.0.xsd" node="/xs:schema">
        <jaxb:schemaBindings>
            <jaxb:package name="com.xxxx.xsd.wssecurity.secext"/>
        </jaxb:schemaBindings>
    </jaxb:bindings>
    <jaxb:bindings schemaLocation="../xsd/oasis-200401-wss-wssecurity-utility-1.0.xsd" node="/xs:schema">
        <jaxb:schemaBindings>
            <jaxb:package name="com.xxxx.whdm.xsd.wssecurity.utility"/>
        </jaxb:schemaBindings>
    </jaxb:bindings>
</jaxb:bindings>

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
oliviero
Offline
Joined: 2007-01-29
Points: 0

Hi,

I got exactly the same problem. Have you found a solution ?

Olivier