Getting the JAXB exception like "Two classes have the same XML type name-"

Getting the JAXB exception like "Two classes have the same XML type name...",
Here is the exception details:
Exception in thread "main" com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions Two classes have the same XML type name "city". Use @XmlType.name and @XmlType.namespace to assign different names to them. this problem is related to the following location: at com.model.City at public com.model.City com.model.Address.getCurrentCity() at com.model.Address this problem is related to the following location: at com.common.City at public com.common.City com.model.Address.getPreviousCity() at com.model.Address
at com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException$Builder.check(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(Unknown Source) at com.sun.xml.internal.bind.v2.ContextFactory.createContext(Unknown Source) at com.sun.xml.internal.bind.v2.ContextFactory.createContext(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at javax.xml.bind.ContextFinder.newInstance(Unknown Source) at javax.xml.bind.ContextFinder.find(Unknown Source) at javax.xml.bind.JAXBContext.newInstance(Unknown Source) at javax.xml.bind.JAXBContext.newInstance(Unknown Source) at com.PojoToXSD.main(PojoToXSD.java:17)
I took the example like:
package com.model; ---->this package contains 'Address' class and 'City' class
public class Address {
private String areaName; private City currentCity; private com.common.City previousCity;
package com.model;
public class City {
private String cityName;
Another city class in "com.common" package.
package com.common;
public class City {
private String pinCode;
We need to create XSDs and needs to do the Marshalling and unmarshalling with the existing code in our project(like as above example code), code does not have any annotations like "@XmlRootElement/@XmlType" and we can not able to change the source code.
I would like to know is there any solution to fix the above issue or any other ways to create XSDs and marshaling/unmarshalling(like MOXy..etc)?
It would be great if i can get the solution from any one....May thanks in advance.
Thanks,
Satya.

Getting the JAXB exception like "Two classes have the same XML type name...",
Here is the exception details:
Exception in thread "main" com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions Two classes have the same XML type name "city". Use @XmlType.name and @XmlType.namespace to assign different names to them. this problem is related to the following location: at com.model.City at public com.model.City com.model.Address.getCurrentCity() at com.model.Address this problem is related to the following location: at com.common.City at public com.common.City com.model.Address.getPreviousCity() at com.model.Address
at com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException$Builder.check(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(Unknown Source) at com.sun.xml.internal.bind.v2.ContextFactory.createContext(Unknown Source) at com.sun.xml.internal.bind.v2.ContextFactory.createContext(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at javax.xml.bind.ContextFinder.newInstance(Unknown Source) at javax.xml.bind.ContextFinder.find(Unknown Source) at javax.xml.bind.JAXBContext.newInstance(Unknown Source) at javax.xml.bind.JAXBContext.newInstance(Unknown Source) at com.PojoToXSD.main(PojoToXSD.java:17)
I took the example like:
package com.model; ---->this package contains 'Address' class and 'City' class
public class Address {
private String areaName; private City currentCity; private com.common.City previousCity;
package com.model;
public class City {
private String cityName;
Another city class in "com.common" package.
package com.common;
public class City {
private String pinCode;
We need to create XSDs and needs to do the Marshalling and unmarshalling with the existing code in our project(like as above example code), code does not have any annotations like "@XmlRootElement/@XmlType" and we can not able to change the source code.
I would like to know is there any solution to fix the above issue or any other ways to create XSDs and marshaling/unmarshalling(like MOXy..etc)?
It would be great if i can get the solution from any one....May thanks in advance.
Thanks,
Satya.

Similar Messages

  • Two classes have the same XML type name??? Please, help...

    Hello!
    I have a simple web service class. I generated the ws server-side classes using wsgen.
    I created a jar file from the generated code.
    Then :
    Endpoint endPoint = Endpoint.create(
    new WebServicesUnitImpl()
    String wsFinalName = "http://localhost:9999/akarmi";
    endPoint.publish( wsFinalName );
    The web service started fine.
    Then called wsimport, and the generated classes have been placed into a jar file.
    Then called the code like this:
    WebServicesUnitImplService service = new WebServicesUnitImplService();
    WebServicesUnitImpl unit = service.getWebServicesUnitImplPort();
    unit.serviceXXX();
    but the code doesn't work at all, resulting this error message:
    Two classes have the same XML type name "{http://ws.components.core.ilogique.vii.com/}getMessages". Use @XmlType.name and @XmlType.namespace to assign different names to them.
         this problem is related to the following location:
              at com.vii.ilogique.core.components.ws.GetMessages
              at public com.vii.ilogique.core.components.ws.GetMessages com.vii.ilogique.core.components.ws.ObjectFactory.createGetMessages()
              at com.vii.ilogique.core.components.ws.ObjectFactory
         this problem is related to the following location:
              at com.vii.ilogique.core.components.ws.GetMessages
    I have this error report on all generated class file! How can i fix this?
    What is the main problem? The SE usage? I copied the lates jax-ws jars into endorsed lib resulting the same.
    Any help is appreciate.

    Hello!
    I have a simple web service class. I generated the ws server-side classes using wsgen.
    I created a jar file from the generated code.
    Then :
    Endpoint endPoint = Endpoint.create(
    new WebServicesUnitImpl()
    String wsFinalName = "http://localhost:9999/akarmi";
    endPoint.publish( wsFinalName );
    The web service started fine.
    Then called wsimport, and the generated classes have been placed into a jar file.
    Then called the code like this:
    WebServicesUnitImplService service = new WebServicesUnitImplService();
    WebServicesUnitImpl unit = service.getWebServicesUnitImplPort();
    unit.serviceXXX();
    but the code doesn't work at all, resulting this error message:
    Two classes have the same XML type name "{http://ws.components.core.ilogique.vii.com/}getMessages". Use @XmlType.name and @XmlType.namespace to assign different names to them.
         this problem is related to the following location:
              at com.vii.ilogique.core.components.ws.GetMessages
              at public com.vii.ilogique.core.components.ws.GetMessages com.vii.ilogique.core.components.ws.ObjectFactory.createGetMessages()
              at com.vii.ilogique.core.components.ws.ObjectFactory
         this problem is related to the following location:
              at com.vii.ilogique.core.components.ws.GetMessages
    I have this error report on all generated class file! How can i fix this?
    What is the main problem? The SE usage? I copied the lates jax-ws jars into endorsed lib resulting the same.
    Any help is appreciate.

  • Query on sorting  XML using XSLT and getting the same XML as output !

    Hi,
    Looking for one information regarding sorting XML using XSLT , with the sorted XML as output. For eg. my XML is :
    <?xml version="1.0"?>
    <?xml-stylesheet type="text/xsl" href="sort1.xsl"?>
    <levelone>
         <child ID="1" sort="5">
              <name>Paul</name>
         </child>
         <child ID="2" sort="1">
              <name>Adam</name>
         </child>
         <child ID="3" sort="2">
              <name>Will</name>
         </child>
    </levelone>
    and XSL :
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/levelone">
         <xsl:copy>
         <xsl:apply-templates>
              <xsl:sort select="@sort"/>
         </xsl:apply-templates>
              </xsl:copy>
         </xsl:template>
         <xsl:template match="child">
              <xsl:copy-of select="."/>
         </xsl:template>
    </xsl:stylesheet>
    This does the sort based on Name. But I want to get the same xml as output with the name sorted. Eg.
    <?xml version="1.0"?>
    <?xml-stylesheet type="text/xsl" href="sort1.xsl"?>
    <levelone>
         <child ID="2" sort="1">
              <name>Adam</name>
         </child>
         <child ID="1" sort="5">
              <name>Paul</name>
         </child>
         <child ID="3" sort="2">
              <name>Will</name>
         </child>
    </levelone>
    Any pointers will be highly appreciated.
    - Thanks

    Don't you want <xsl:sort select="name"/> rather than <xsl:sort select="@sort"/>?

  • I upgraded my new iPad (iPad 3) to IOS 6 and everything went well except Siri won't launch apps. When asked say "launch Facebook" Siri responds with "it doesn't look like you have an app named Facebook" and I get the same results when trying to launch any

    I upgraded my new iPad (iPad 3) to IOS 6 and everything went well except Siri won’t launch apps. When asked say “launch Facebook” Siri responds with “it doesn’t look like you have an app named Facebook” and I get the same results when trying to launch any app. Siri works for everything else it just won’t launch apps. Any ideas? Thanks.

    I have this same problem... Seems like nobody else does. Siri won't launch any apps for me, including native apps.

  • Do not seem to be able to backup iPad via iTunes on to my PC. Message after connecting is "iTunes was unable to load class information from Sync Services, Reconnect or try later"  Have tried that but get the same result. Can anyone assist?

    Do not seem to be able to backup iPad via iTunes on to my PC.
    Message after connecting is "iTunes was unable to load class information from Sync Services, Reconnect or try later" 
    Have tried that but get the same result.
    Remedies I've tried are:
    wait and try again
    reboot
    reload iTunes
    NB hp is a relatively new machine and has previously backed up quite happily.
    Can anyone assist?

    RHoodnkt-
    Try rebooting the iPad.  Hold down both the Home and Sleep buttons for several seconds until the Apple logo appears.  Ignore the "Slide to power off" arrow.  It takes a minute or two to restart.
    Also be sure your iPad battery is not completely discharged.
    Fred

  • My iphone 6 connects to the car via bluetooth, the music works good, but the phone calles does not work.  It looks like it is working but doesn't.  I have tried in my Hyundai and a Dodge rent car and get the same results.  I updated the last 8.0.2.

    My iphone 6 connects to the car via bluetooth, the music works good, but the phone calls does not work.  It looks like it is working but doesn't.  I have tried in my Hyundai Sonata and a Dodge Dart rent car and get the same results.  I updated the last 8.0.2.  It worked the first day i had the phone, and then i updated to Ios 8.0.2 and it quit working.
    Now when i get in the car, it acts like it is connected and makes the same call it was on after syncing to bluetooth, but it really isn't on a call.  This is happening on both cars.
    Does anyone know if this is the phone and i need to take it to Apple or if there is an issue that Apple is working on getting a fix for?
    My son in law has the exact same phone as me, we both got the on 10/6, he had a Dodge Dart and his is working via bluetooth.
    Someone HELP please, as i consider this a safety issue by not having my calls go to bluetooth.

    We had the same problem, but figure out the solution.
    You MUST have at least 1 song added to your ITUNE!  After you add a free song, then everything else should work as normal!
    Hope this helps!

  • I have just signed upfor family sharing. Is there any way you can get the same app on two devices but not have to share it? My sons both want clash of clans but they don't want to be on the same village and they can't both be on app at the same time?

    I have just signed up for family sharing. Is there any way you can get the same app on two devices but not have to share it? My sons both want clash of clans but they don't want to be on the same village and they can't both be on app at the same time?

    hi, the app is not "shared", it works as if you bought the app twice with different accounts, only you paid it once. they should have 2 different villages since they're on 2 different devices.

  • I'm logged in to Creative Cloud, have saved a web gallery within Lightroom, and am trying to publish my first web gallery.  All seems to be going well until it looks like it's almost finished and I consistently get the same message, 'An error occurred sen

    Am logged in to Creative Cloud, have saved a web gallery, and am trying to publish first web gallery.  Consistently get the same message, 'An error occurred sending the file : connection to the server failed'.  Can somebody help me to resolve this?

    Firstly, have you entered the correct FTP settings as given by the host where you are uploading to?
    Next, try using Export and then uploading via an external FTP program like Filezilla. FTP from Lightroom isn't as robust as a dedicated FTP program.

  • I tried to install yosemite yesterday and my computer goes through the whole installation process and then to a blank white screen.  I've rebooted, I've reinstalled several times and get the same result.  Two days wasted!

    I tried to install yosemite yesterday and my computer goes through the whole installation process and then to a blank white screen.  I've rebooted, I've reinstalled several times and get the same result.  Two days wasted and I can't use my computer!!

    I don't know if you've already resolved your problem, but I had the same thing, it took me 6 hours to fix it. I had the exact same as you, installed the update and then it went to a white screen. After trying start up holding down cmmd r or holding down the alt key to try to install it again, nothing worked, same result every time. Then an angel came to me here somewhere but I can't find it now to thank him. Start in safe mode, press shift once you hear the start up chime and hold it down until you hear it again. Installation completion box came up and it was working. turn off computer and start up again normally and all is well. Except my final cut pro x doesn't work with it, have to update that now too. same as when I updated to mavericks.
    Hope this helps.

  • I am trying to get into my Game Center app but every time I tap on the app it opens too a blank white screen. I have tried several times to reset my phone but I get the same result.

    I am trying to get into my Game Center app but every time I tap on the app it opens too a blank white screen. I have tried several times to reset my phone but I get the same result.

    Hello there Sweebs44,
    It sounds like you are tapping the Game Center app to open it, but the screen is blank. I recommend signing out of your account:
    Go to Settings > Game Center, where you can:
    Sign out (tap your Apple ID)
    From: iPhone User Guide
              http://help.apple.com/iphone/7/#/iph6c493cac
    Then close all the running apps:
    iOS: Force an app to close
    http://support.apple.com/kb/ht5137
    Double-click the Home button.
    Swipe left or right until you have located the app you wish to close.
    Swipe the app up to close it.
    When you have done that restart the phone sign back into your account and try again:
    iOS: Turning off and on (restarting) and resetting
    http://support.apple.com/kb/ht1430
    Thank you for using Apple Support Communities.
    Take care,
    Sterling

  • HT204053 I previously use an apple id , I have tried to reset and even changed the id on the settings on my phone but each time I try to update an apple apps , I keep getting the same old ID on my phone. What do I do?

    I previously use an apple id called *** @hotmail.co.uk, I have tried to reset and even changed the id on the settings on my phone but each time I try to update an apple apps , I keep getting the same old ID on my phone. What do I do?
    <Email Edited by Host>

    Is the same true for using the App Store with a desktop machine? Someone installed a program on my machine (the IT department) and I would like to install the updates but it was installed under a different Apple ID. This anyone know how to change, or work around this particular issue?
    Any thoughts or suggestions are greatly appreciated.
    Cheers

  • HT204088 How how can I synch my ipod + iphone music to my new computer? I get the same error  "my ipod or iphone is synched with another itunes library.An Ipod can be synched with only one itunes library at a time. What would I like to do Erase and Synch

    How can I synch my ipod & iphone music (purchased from itunes on my old laptop) to my new laptop? I keep getting the same message on my itunes on my new laptop: " The ipod/Iphone is synched with another itunes library. An ipod/iphone can be synched with only one itunes library at a time. What would you like to do - Erase and Synch or Transfer Purchases?" What do I do?
    A couple of other items:
    1) I am guessing Apple does not keep a history of all my music purchases? As I did not have my entire library backed-up anywhere, and relying on the music I have on my ipod and my iphone as my only source of itunes music....I have lost over 500 songs!!!
    2) I used to have an Apple account under another account name, and since have switched to a new account name. Is there anyway to find the history of purchases from my old Apple account name and transfer these over to my new account name and onto my new laptop?
    I hope someone can help, I am having a very difficult time trying to obtain answers. Angie

    The iphone/ipod is NOT a storage/backup device.  Not maintaining a backup copy is a big mistake.
    You can transfer itunes purchases from your iphone/ipod to your computer:
    Authorize your computer for all accounts and then click  File>Transfer Purchases

  • Trying to remove an old version of I Tunes and keep getting the message "The folder path I Tunes contains an invalid character' . It won't let me go any further, have tried deleting/repairing the program but keep getting the same message?

    trying to remove an old version of I tunes, but keep getting the message 'The folder path I Tunes contains an invalid character'
    It won't let me go any further, have tried deleting/repairing but get the same message and am blocked from continuing?

    Hi Barbara,
    I had a similar problem recently and using the "more like this" feature I discovered an answer. To a problem posed by Holo7,  who like myself was a newbie on this platform,  b noir proposed a solution to Holo7's problem that also worked with my problem. It involves downloading a version of MS Windows Instal Cleanup and using it to completely remove all traces of the old version.
    If you look at my problem (follow OldGit66) and the link to Holo7's problem then you will find b noir's answer which I think may help you. I am new around here so you might want to wait for one of the higher status correspondents.
    Regards
    John

  • HT203176 i have a slow macbook, i ran live disk utilities and said I need to repair disk from a cd. did that, I got volume repaired from the external disk. when I reboot from hdd, then run disk utility, I get the same error message i did b4 repair

    i have a slow macbook, i ran live disk utilities (from hard drive), turned out I needed to repair disk from a installation disk. Did that, I got the volume (Hard drive) repaired from the installation disk disk. To this point, great!
    When I reboot from hdd, then run disk utility, I get the same error message i did b4 repair. I went thru two rounds of this.....
    Can anyone help? thanks

    Sorry guys, I don't see how to reply to you so I use reply to "me" basically.
    So the error I get is "volume header needs minor repair" and then you need to perform repair from the installation disk message.
    I did repair not verify from the disk twice. Every time ending in the "the volume had ha been successfully repaired". Then I reboot from the internal disk. Run disk utilities from it, do verify and get the same error message I got before repair. I hope this can shed some light fr you guys. Sorry I didn't include details in the original
    MEssage.

  • I have three Imacs running Final Cut X but only able to update to 10.0.7 on one of them. Everytime I try to update it ask for my apple ID which I submit...then get the same replay to enter my Apple Id have only been able to update one of them to latest

    I have three Imacs running Final Cut X but only able to update to 10.0.7 on one of them. Everytime I try to update it ask for my apple ID which I submit...then I get the same message to enter my Apple ID...Any suggestions?

    Easiest thing to do is put the app on the non updated computers in the trash and then copy the new app on to a flash drive and copy into the app folders on the other two computters.

Maybe you are looking for

  • Batch Management with Moving Average Price

    Hi all, I got a question here. If we use batch management in SAP with our price control as 'V' (MAP for Moving Average Price), and we do good issue out by batch, will the system credit my stock based on MAP value or the actual value (actual PO price

  • Cables to connect my PCI-7334 motion to one UMI and one SSR backplane?

    i want to connect a PCI 7334 to one UMI and one SSR backplane, what cables do i need (number)

  • Creat new files at the beginning of every hour

    I am trying to write a VI to store data in text file. To avoid a too large file, I want to store the data in different files. I want these files to be created at the beginning of every hour. How could I achieve this? Thanks in advance! Solved! Go to

  • Hierarchy in a Dimension - like father/sons

    Hello, I have a standard Oracle rpd model for Service Request (Dim) and Service Request (facts) - that is from OBI Applications. Facts SR has connection with several other dimensions. In this customer they have created in the source application (Sieb

  • Premiere pro cs3 window "flickers" or "shakes" then windows shuts down

    lately, i've been having this problem. when i run adobe premiere pro cs3, the window "flickers" or "shakes." i'm not quite sure how to explain it, but it's like a quick "jolt." sometimes it recovers from that and i'm able to continue editing. other t