Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 334162

Summary: Error Creating JAXBContext when two nested classes have the same name
Product: z_Archived Reporter: Blaise Doughan <blaise.doughan>
Component: EclipselinkAssignee: Blaise Doughan <blaise.doughan>
Status: CLOSED INVALID QA Contact:
Severity: normal    
Priority: P3 CC: eclipselink.oxm-inbox
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
MOXy - Test Cases none

Description Blaise Doughan CLA 2011-01-12 15:33:33 EST
When a context is created on the following classes:

    public class Foo {
  
        public static class Inner {}

    }

and 

    public class Bar {

        public static class Inner {}

    }

The following exception occurs:

javax.xml.bind.JAXBException: 
Exception Description: Name collision.  Two classes have the XML type with uri  and name inner
 - with linked exception:
[Exception [EclipseLink-50007] (Eclipse Persistence Services - 2.3.0.qualifier): org.eclipse.persistence.exceptions.JAXBException
Exception Description: Name collision.  Two classes have the XML type with uri  and name inner]
	at org.eclipse.persistence.jaxb.JAXBContextFactory.createContext(JAXBContextFactory.java:266)
	at org.eclipse.persistence.jaxb.JAXBContextFactory.createContext(JAXBContextFactory.java:213)
	at org.eclipse.persistence.jaxb.JAXBContextFactory.createContext(JAXBContextFactory.java:110)
	at org.eclipse.persistence.jaxb.JAXBContextFactory.createContext(JAXBContextFactory.java:100)
	at org.eclipse.persistence.testing.jaxb.inner.InnerClassTestCases.testCreateContext(InnerClassTestCases.java:17)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at junit.framework.TestCase.runTest(TestCase.java:168)
	at junit.framework.TestCase.runBare(TestCase.java:134)
	at junit.framework.TestResult$1.protect(TestResult.java:110)
	at junit.framework.TestResult.runProtected(TestResult.java:128)
	at junit.framework.TestResult.run(TestResult.java:113)
	at junit.framework.TestCase.run(TestCase.java:124)
	at junit.framework.TestSuite.runTest(TestSuite.java:232)
	at junit.framework.TestSuite.run(TestSuite.java:227)
	at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: Exception [EclipseLink-50007] (Eclipse Persistence Services - 2.3.0.qualifier): org.eclipse.persistence.exceptions.JAXBException
Exception Description: Name collision.  Two classes have the XML type with uri  and name inner
	at org.eclipse.persistence.exceptions.JAXBException.nameCollision(JAXBException.java:193)
	at org.eclipse.persistence.jaxb.compiler.AnnotationsProcessor.processTypeQName(AnnotationsProcessor.java:1427)
	at org.eclipse.persistence.jaxb.compiler.AnnotationsProcessor.buildTypeInfo(AnnotationsProcessor.java:608)
	at org.eclipse.persistence.jaxb.compiler.AnnotationsProcessor.postBuildTypeInfo(AnnotationsProcessor.java:563)
	at org.eclipse.persistence.jaxb.compiler.AnnotationsProcessor.processClassesAndProperties(AnnotationsProcessor.java:225)
	at org.eclipse.persistence.jaxb.compiler.Generator.<init>(Generator.java:147)
	at org.eclipse.persistence.jaxb.JAXBContextFactory.createContext(JAXBContextFactory.java:263)
	... 23 more
Comment 1 Blaise Doughan CLA 2011-01-12 15:44:57 EST
Created attachment 186675 [details]
MOXy - Test Cases
Comment 2 Blaise Doughan CLA 2011-01-12 16:34:31 EST
Not a bug, the code is functioning as expected.
Comment 3 Eclipse Webmaster CLA 2022-06-09 10:09:55 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink