5

When running the XJC task on SNotification.xsd, two XSDs(SNotification.xsd, CDataModel.xsd) are generating the same class. The error it is showing off is:

A class/interface with the same name "com.att.mre.ecrupr.atlas.jms.MarketInfo" is already in use. Use a class customization to resolve this conflict.
      [xjc]   line 214 of file:/C:/Documents%20and%20Settings/rkar4749/workspace/ECRUPR_1306/AtlasEventsListener/xsd/Atlas/Container/Public/SubscriberNotification.xsd
      [xjc] [ERROR] (Relevant to above error) another "MarketInfo" is generated from here.
      [xjc]   line 22368 of file:/C:/Documents%20and%20Settings/rkar4749/workspace/ECRUPR_1306/AtlasEventsListener/xsd/Common/Types/Public/CingularDataModel.xsd
      [xjc] [ERROR] Two declarations cause a collision in the ObjectFactory class.
      [xjc]   line 22368 of file:/C:/Documents%20and%20Settings/rkar4749/workspace/ECRUPR_1306/AtlasEventsListener/xsd/Common/Types/Public/CingularDataModel.xsd
      [xjc] [ERROR] (Related to above error) This is the other declaration.   
      [xjc]   line 214 of file:/C:/Documents%20and%20Settings/rkar4749/workspace/ECRUPR_1306/AtlasEventsListener/xsd/Atlas/Container/Public/SubscriberNotification.xsd
      [xjc] failure in the XJC task. Use the Ant -verbose switch for more details
maryJane
  • 117
  • 3
  • 16

2 Answers2

16

i had the same problem and run below command from terminal and it was solved

xjc -XautoNameResolution your.xsd 
Winston
  • 1,800
  • 2
  • 20
  • 30
  • I ran into a similar issue only using maven-jaxb2-plugin. I ran the xjc command from the terminal and got the same issue. After adding this argument it resolved my issue. The command I used: xjc -wsdl -p com.package.wsdl -XautoNameResolution https://. Thanks. – Alan B. Dee May 21 '14 at 16:34
  • I was having the same issue and this worked for me: xjc -XautoNameResolution -d ./src/main/java ./xsd/some-one-elses-schema.xsd. This was with xjc version 2.2.4-2 (java version 1.7.0_51). I was surprised that -XautoNameResolution was not listed in the options when you type xjc into a cmd prompt but it does seem to be available in the version of xjc I'm using. – John Sep 06 '16 at 14:40
0

You can use an external binding file to rename one of the generated classes.

Example

Community
  • 1
  • 1
bdoughan
  • 147,609
  • 23
  • 300
  • 400