<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    Same application deployed twice gives "2 counts of IllegalAnnotationExceptions" initialization error
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="http://community.jboss.org/people/mnsharif">nafees sharif</a> in <i>JBoss Web Services</i> - <a href="http://community.jboss.org/message/609778#609778">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>I have two applications running under my JBoss 5.1 (using JDK6) with names <em>appA1.war</em> and <em>appZ.war</em>. Both of these web-applications are clients of web services published by external parties. I am using myeclipse to generate client side stubs etc. I am using Metro1.1 jars in my applications, i.e. both of these applications have following jars (apart from others) in WEB-INF/lib folder:</p><p>-- webservices-api.jar</p><p>-- webservices-extra.jar</p><p>-- webservices-extra-api.jar</p><p>-- webservices-rt.jar</p><p>Everything works file up till here. I can deploy and consume external web services in both of my applications.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Then i deployed a copy of <em>appA1.war</em> as <em>appA2.war</em> with only a few changes (different release with new features etc.). The _deployment_ of all three web-applications does not introduce any problem. The consumtpion of external web service as client works perfectly on <em>appA1.war</em> application. However, when i try to consuming the external web service at <em>appA2.war</em>, the following exception occurs:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="text-decoration: underline;">java.lang.ExceptionInInitializerError</span></p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; at java.lang.reflect.Constructor.newInstance(Constructor.java:513)</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; at java.lang.Class.newInstance0(Class.java:355)</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; ...</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; ...<em>edited for brevity</em></p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; ...</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:436)</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; at org.apache.coyote.ajp.AjpProtocol$AjpConnectionHandler.process(AjpProtocol.java:384)</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; at java.lang.Thread.run(Thread.java:619)</p><p>Caused by: javax.xml.ws.WebServiceException: Error creating JAXBContext for W3CEndpointReference.</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; at com.sun.xml.ws.spi.ProviderImpl$2.run(ProviderImpl.java:222)</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; at com.sun.xml.ws.spi.ProviderImpl$2.run(ProviderImpl.java:218)</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; at java.security.AccessController.doPrivileged(Native Method)</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; at com.sun.xml.ws.spi.ProviderImpl.getEPRJaxbContext(ProviderImpl.java:217)</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; at com.sun.xml.ws.spi.ProviderImpl.&lt;clinit&gt;(ProviderImpl.java:88)</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; ... 40 more</p><p><strong style="color: #800000;">Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 2 counts of IllegalAnnotationExceptions</strong></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><strong>Two classes have the same XML type name "address". Use @XmlType.name and @XmlType.namespace to assign different names to them.</strong></p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; this problem is related to the following location:</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; at <span style="text-decoration: underline;"><em>com.sun.xml.ws.developer.MemberSubmissionEndpointReference$Address</em></span></p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; at public com.sun.xml.ws.developer.MemberSubmissionEndpointReference$Address com.sun.xml.ws.developer.MemberSubmissionEndpointReference.addr</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; at com.sun.xml.ws.developer.MemberSubmissionEndpointReference</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; this problem is related to the following location:</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; at<span style="text-decoration: underline;"><em> javax.xml.ws.wsaddressing.W3CEndpointReference$Address</em></span></p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; at private javax.xml.ws.wsaddressing.W3CEndpointReference$Address javax.xml.ws.wsaddressing.W3CEndpointReference.address</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; at javax.xml.ws.wsaddressing.W3CEndpointReference</p><p><strong>Two classes have the same XML type name "elements". Use @XmlType.name and @XmlType.namespace to assign different names to them.</strong></p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; this problem is related to the following location:</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; at <span style="text-decoration: underline;"><em>com.sun.xml.ws.developer.MemberSubmissionEndpointReference$Elements</em></span></p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; at public com.sun.xml.ws.developer.MemberSubmissionEndpointReference$Elements com.sun.xml.ws.developer.MemberSubmissionEndpointReference.referenceProperties</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; at com.sun.xml.ws.developer.MemberSubmissionEndpointReference</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; this problem is related to the following location:</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; at <span style="text-decoration: underline;"><em>javax.xml.ws.wsaddressing.W3CEndpointReference$Elements</em></span></p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; at private javax.xml.ws.wsaddressing.W3CEndpointReference$Elements javax.xml.ws.wsaddressing.W3CEndpointReference.referenceParameters</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; at javax.xml.ws.wsaddressing.W3CEndpointReference</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; at com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:102)</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:438)</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; at com.sun.xml.bind.v2.runtime.JAXBContextImpl.&lt;init&gt;(JAXBContextImpl.java:286)</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:139)</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:117)</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; at java.lang.reflect.Method.invoke(Method.java:597)</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:211)</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; at javax.xml.bind.ContextFinder.find(ContextFinder.java:372)</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:574)</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:522)</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; at com.sun.xml.ws.spi.ProviderImpl$2.run(ProviderImpl.java:220)</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; ... 44 more</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I have looked around a little and have found following links partially useful. However, i have not been able to find a workaround and any help in this regard will be much appreciated.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><a class="jive-link-external-small" href="http://stackoverflow.com/questions/4254334/illegalannotationexception-two-classes-have-the-same-xml-type-name">http://stackoverflow.com/questions/4254334/illegalannotationexception-two-classes-have-the-same-xml-type-name</a></p><p><a class="jive-link-external-small" href="http://stackoverflow.com/questions/4991394/two-classes-have-the-same-xml-type-name">http://stackoverflow.com/questions/4991394/two-classes-have-the-same-xml-type-name</a></p><p><a class="jive-link-thread-small" href="http://community.jboss.org/thread/103648">http://community.jboss.org/thread/103648</a></p><p><a class="jive-link-external-small" href="http://forums.netbeans.org/post-88330.html">http://forums.netbeans.org/post-88330.html</a></p><p><a class="" href="http://community.jboss.org/message/250396#250396">http://community.jboss.org/message/250396</a></p><p><a class="jive-link-thread-small" href="http://community.jboss.org/thread/103026">http://community.jboss.org/thread/103026</a></p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/609778#609778">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in JBoss Web Services at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2044">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>