Some issues while migrating application from Jboss 5 to 7
chandrasachin16 Mar 25, 2013 9:40 AMHi All,
We are in the process of migrating our Application from Jboss 5 to Jboss as 7. We are using Jboss AS 7.1.0. and JDK 1.7. We have studied that jboss AS 7 is modular and uses module based loading.Basically we are facing issues with JAXB. We are able to resolve couple of issues but we are stuck up while creating jaxb instance. Our code is as below:
JAXBContext jaxbContext = JAXBContext.newInstance("com.package.schemas.core"); //$NON-NLS-1$
This is actually happening during the deployment of our ear file which internally uses a jar file having a class (MesEnvironment) which has the above code.The error we are getting is
18:19:59,373 ERROR [stderr] (MSC service thread 1-2) javax.xml.bind.JAXBException: "com.package.schemas.core" doesnt contain ObjectFactory.class or jaxb.index
18:19:59,374 ERROR [stderr] (MSC service thread 1-2) at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:231)
18:19:59,376 ERROR [stderr] (MSC service thread 1-2) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
18:19:59,377 ERROR [stderr] (MSC service thread 1-2) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
18:19:59,378 ERROR [stderr] (MSC service thread 1-2) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
18:19:59,379 ERROR [stderr] (MSC service thread 1-2) at java.lang.reflect.Method.invoke(Unknown Source)
18:19:59,380 ERROR [stderr] (MSC service thread 1-2) at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:137)
18:19:59,381 ERROR [stderr] (MSC service thread 1-2) at javax.xml.bind.ContextFinder.find(ContextFinder.java:294)
18:19:59,382 ERROR [stderr] (MSC service thread 1-2) at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:412)
18:19:59,383 ERROR [stderr] (MSC service thread 1-2) at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:375)
18:19:59,384 ERROR [stderr] (MSC service thread 1-2) at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:279)
We tried to search this in forums and came across my solutions but nothing is worknig out. We used all types of possibilites but didn't had any luck. We also debugged inside the libraray by downloading the source code which gives error in the ContextFactory class at this line :--------------------- o = classLoader.loadClass(pkg+".ObjectFactory"); even though the ObjectFactory Class is in the package.
Also tried with JAXBContext jaxbContext = JAXBContext.newInstance("com.package.schemas.core",com.package.schemas.core.ObjectFactory.class.getClassLoader()); and
JAXBContext jaxbContext = JAXBContext.newInstance("com.package.schemas.core",com.package.schemas.core.MesEnvironment.class.getClassLoader()); // but couldn't solve
So we decided to put this here if somebody can throw some light on it . Is it something which we can resolve or is it that cannot be resolved in current jboss release.
Regards
Sachin