Java JAXB 2.0 Version - java

We just upgraded to Java 8 and I'm seeing the following error in our logs. My lead tells me I need to re-compile with an older version of JAXB, can anyone tell me where I can go to download JAXB 2.0 ? Or suggest another solution to this error?
java.lang.NoSuchMethodError: javax.xml.bind.annotation.XmlAccessorType.value()Ljavax/xml/bind/annotation/AccessType;
at com.sun.xml.bind.v2.model.impl.ClassInfoImpl.getAccessType(ClassInfoImpl.java:339)
at com.sun.xml.bind.v2.model.impl.ClassInfoImpl.getProperties(ClassInfoImpl.java:228)
at com.sun.xml.bind.v2.model.impl.RuntimeClassInfoImpl.getProperties(RuntimeClassInfoImpl.java:87)
at com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:127)
at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:49)
at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:41)
at com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:189)
at com.sun.xml.bind.v2.model.impl.RegistryInfoImpl.<init>(RegistryInfoImpl.java:51)
at com.sun.xml.bind.v2.model.impl.ModelBuilder.addRegistry(ModelBuilder.java:232)
at com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:201)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:327)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:198)
at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:76)
at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:55)
at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:124)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:171)
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:131)
at javax.xml.bind.ContextFinder.find(ContextFinder.java:335)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:431)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:394)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:298)
at com.sun.xml.internal.ws.assembler.MetroConfigLoader$3.run(MetroConfigLoader.java:259)
at com.sun.xml.internal.ws.assembler.MetroConfigLoader$3.run(MetroConfigLoader.java:256)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.xml.internal.ws.assembler.MetroConfigLoader.createJAXBContext(MetroConfigLoader.java:255)
at com.sun.xml.internal.ws.assembler.MetroConfigLoader.loadMetroConfig(MetroConfigLoader.java:241)
at com.sun.xml.internal.ws.assembler.MetroConfigLoader.init(MetroConfigLoader.java:131)
at com.sun.xml.internal.ws.assembler.MetroConfigLoader.<init>(MetroConfigLoader.java:104)
at com.sun.xml.internal.ws.assembler.TubelineAssemblyController.getTubeCreators(TubelineAssemblyController.java:78)
at com.sun.xml.internal.ws.assembler.MetroTubelineAssembler.createClient(MetroTubelineAssembler.java:103)
at com.sun.xml.internal.ws.client.Stub.createPipeline(Stub.java:328)
at com.sun.xml.internal.ws.client.Stub.<init>(Stub.java:295)
at com.sun.xml.internal.ws.client.Stub.<init>(Stub.java:228)
at com.sun.xml.internal.ws.client.Stub.<init>(Stub.java:243)
at com.sun.xml.internal.ws.client.sei.SEIStub.<init>(SEIStub.java:84)
at com.sun.xml.internal.ws.client.WSServiceDelegate.getStubHandler(WSServiceDelegate.java:814)
at com.sun.xml.internal.ws.client.WSServiceDelegate.createEndpointIFBaseProxy(WSServiceDelegate.java:803)
at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:436)
at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:404)
at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:386)
at javax.xml.ws.Service.getPort(Service.java:119)

If you’re using maven or gradle just set the appropriate version, it will be downloaded from maven central repository. Otherwise you can manually download it and add it to classpath.
https://mvnrepository.com/artifact/javax.xml.bind/jaxb-api/2.0

Related

Why Java doesn't recognize net.sf.jasperreports.engine.util.JRLoader class?

Good afternoon.
I am working on JDK 1.6.
I am trying to integrate JasperReports to the Java Web Application of company where I work. First, I created an simple Java Application for to test the reports generation, and I used the next libraries (jars):
Commons collections 3.2.1
Commons beanutils 1.9.0
Commons digester 2.1
Commons logging 1.2
Groovy all 1.8.0
Joda time 2.0
JasperReports 6.0.0
With these I was able to create a report but, when I transfered this libraries to the Java Web Application,happened the next exception:
javax.faces.FacesException: #{bean.functionCalled}: java.lang.reflect.InvocationTargetException
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:118)
at org.primefaces.application.CleanupActionListener.processAction(CleanupActionListener.java:42)
...
Caused by: javax.faces.el.EvaluationException: java.lang.reflect.InvocationTargetException
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:102)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
... 51 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
... 52 more
Caused by: java.lang.NoClassDefFoundError: net/sf/jasperreports/engine/util/JRLoader
... 85 more
Caused by: java.lang.ClassNotFoundException: net.sf.jasperreports.engine.util.JRLoader
at java.net.URLClassLoader$1.run(Unknown Source)
...
... 86 more
I found out that the cause of the problem is the commons loggin version, or the libraries combination.
By default, this Java Web Application has the next libraries:
Commons collections 3.2
Commons beanutils 1.6
Commons digester 1.8.1
Commons logging 1.1.1
Groovy all 1.5.4
Joda time 1.6
I'm making differents versions combinations but not working, the problem persist.
What you recommend me?
Thank you so much.
This is a missing jars in the class path issue.
I had this issue and found that with by adding the missing jars to the class path it resolved the issue.
From the below article java.dzone.com article here I found that the minimal jars necessary are...Now The versions numbers have changed but with these libraries only I managed to get it working.
jasperreports-3.5.3.jar and above version
commons-digester-2.1.jar
commons-collections-3.2.jar (commons-collections.jar)
commons-logging-1.2.jar
commons-beanutils.jar
iText-5.0.jar (used infor PDF exporting)

Java NoClassDefFoundError initialization error after Lotus Domino upgrade from Version 6.5.3 to 8.5.2

We have upgraded Lotus Domino upgrade from Version 6.5.3 to 8.5.2, After upgrading we are getting initialization error while calling Java methods.
The classes are kept at a location say d:\javaclasses and an entry is made in notes.ini as shown below
JavaUserClasses=.;d:\javaclasses;d:\javaclasses\lib... etc.
Everything call to java works on Version 6.5.3 however it does not work on 8.5.2.
We have not changed any java files, Just copied from older version to new version server at the same location
Note: d:\javaclasses classes are compiled using JDK1.3, Domino Version 6.5.3 uses JDK1.3 native library,
Domino Version 8.5.2 uses JDK1.6 native library inbuilt
Stack trace for reference.
java.lang.NoClassDefFoundError: com.centtric.td.cprm.AppSource (initialization failure)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:140)
at com.centtric.td.cprm.Coverage.<init>(Coverage.java:87)
at com.centtric.td.cprm.Coverage.find(Coverage.java:572)
at CPRMLib.deleteCoverage(CPRMLib.java:913)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:600)
at lotus.domino.JavaConnectInvoker.invoke(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:600)
at lotus.domino.JavaConnectLoader.invoke(Unknown Source)
Caused by:
java.lang.NullPointerException
at com.centtric.connectors.JDBCConnector.closeStatements(JDBCConnector.java:484)
at com.centtric.connectors.JDBCConnector.closeAll(JDBCConnector.java:431)
at com.centtric.td.cprm.AppSource.init(AppSource.java:70)
at com.centtric.td.cprm.AppSource.get(AppSource.java:79)
at com.centtric.td.cprm.AppSource.<clinit>(AppSource.java:32)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:200)
It's hard to say, but it looks like your new JVM either is missing some native libraries, or don't have the same classpath as your old JVM has. Are you sure the ini-file format hasn't changed?
J9VMInternals is an IBM-specific class that takes care of classloading and stuff.

Java JPG codec won't work

I have problem with my tomcat application, after changing the server and installing the last version of tomcat7 my application won't read/load jpg files..
I installed imageio and jai on the server, try to change java version but every time I have the same error..
Anybody have an idea?
Error: One factory fails for the operation "jpeg"
Occurs in: javax.media.jai.ThreadSafeOperationRegistry
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at javax.media.jai.FactoryCache.invoke(FactoryCache.java:122)
at javax.media.jai.OperationRegistry.invokeFactory(OperationRegistry.java:1674)
at javax.media.jai.ThreadSafeOperationRegistry.invokeFactory(ThreadSafeOperationRegistry.java:473)
at javax.media.jai.registry.RIFRegistry.create(RIFRegistry.java:332)
at com.sun.media.jai.opimage.StreamRIF.create(StreamRIF.java:102)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at javax.media.jai.FactoryCache.invoke(FactoryCache.java:122)
at javax.media.jai.OperationRegistry.invokeFactory(OperationRegistry.java:1674)
at javax.media.jai.ThreadSafeOperationRegistry.invokeFactory(ThreadSafeOperationRegistry.java:473)
at javax.media.jai.registry.RIFRegistry.create(RIFRegistry.java:332)
at javax.media.jai.RenderedOp.createInstance(RenderedOp.java:819)
at javax.media.jai.RenderedOp.createRendering(RenderedOp.java:867)
at javax.media.jai.RenderedOp.getWidth(RenderedOp.java:2179)
The whole error log can be found here -> http://paste.ubuntu.com/7653452/.
Update: The problem is related to grails plugin called ImageTools
If you look at the code for JPEGImageDecoder you'll see it depends on com.sun.image.codec.jpeg.ImageFormatException in its imports.
However, com.sun.image.codec.jpeg was removed from Java 7 onwards.
So likely the problem is that JAI is simply out of date, and you would have to use a Java 6 runtime to use it.

java newrelic agent throwing classnotfound exception

I am trying to install newrelic on a linux machine with tomcat 7. This installation does not have a catalina.sh so cannot use the newrelic installer.
I tried the manula approach of adding the newrelic.jar to the javaagent like:
CATALINA_OPTS="$CATALINA_OPTS -javaagent:/usr/share/tomcat7/newrelic/newrelic.jar"
But whenever I start the tomcat I get the following classnotfoundexception:
Unable to start New Relic agent: javax.xml.transform.TransformerFactoryConfigurationError: Provider org.apache.xalan.processor.TransformerFactoryImpl not found
javax.xml.transform.TransformerFactoryConfigurationError: Provider org.apache.xalan.processor.TransformerFactoryImpl not found
at javax.xml.transform.TransformerFactory.newInstance(TransformerFactory.java:106)
at com.newrelic.agent.extension.dom.ExtensionDomParser.getTransformerFactory(ExtensionDomParser.java:360)
at com.newrelic.agent.extension.dom.ExtensionDomParser.fixNamespace(ExtensionDomParser.java:337)
at com.newrelic.agent.extension.dom.ExtensionDomParser.parseDocument(ExtensionDomParser.java:167)
at com.newrelic.agent.extension.dom.ExtensionDomParser.readFile(ExtensionDomParser.java:152)
at com.newrelic.agent.extension.ExtensionParsers$3.parse(ExtensionParsers.java:46)
at com.newrelic.agent.extension.JarExtension.<init>(JarExtension.java:59)
at com.newrelic.agent.extension.JarExtension.<init>(JarExtension.java:104)
at com.newrelic.agent.extension.ExtensionService.initializeBuiltInExtensions(ExtensionService.java:388)
at com.newrelic.agent.extension.ExtensionService.doStart(ExtensionService.java:145)
at com.newrelic.agent.service.AbstractService.start(AbstractService.java:54)
at com.newrelic.agent.service.ServiceManagerImpl.doStart(ServiceManagerImpl.java:124)
at com.newrelic.agent.service.AbstractService.start(AbstractService.java:54)
at com.newrelic.agent.Agent.premain(Agent.java:208)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:622)
at com.newrelic.bootstrap.BootstrapAgent.premain(BootstrapAgent.java:117)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:622)
at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:343)
at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:358)
Caused by: java.lang.ClassNotFoundException: org/apache/xalan/processor/TransformerFactoryImpl
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:270)
at javax.xml.transform.FactoryFinder.getProviderClass(FactoryFinder.java:124)
at javax.xml.transform.FactoryFinder.newInstance(FactoryFinder.java:179)
I have tried everything I could for this, but nothing works. I have even added the xalan jar manually to the tomcat lib but no luck
You need to make sure you have xalan.jar installed. If it is installed, it may be in the wrong place. You probably need it at the container level, here is a blog post that discusses this issue (tomcat5 but most of the advice should still apply).
http://doookstechstuff.blogspot.com/2010/04/how-to-fix-tomcat5-on-rhel5.html
Make sure that the location where you put the xalan.jar is in the classpath and that the user account you're running tomcat under has access to it. If you have dropped it in the tomcat /lib folder make sure the perms for the .jar file match the other objects in the folder.
Let us know if this helps. If you need additional information it might be best to create a ticket with New Relic Support (http://support.newrelic.com).

IncompatibleClassChangeError while running JAXB on Unix AIX

I get a java.lang.IncompatibleClassChangeError when i try to run my project on AIX machine.
The project generate XML files using JAXB API (2.0).
The development environment installed in Windows XP and use JDK1.5.0(the same JDK as AIX machine ones).
In the developement environment the project works good. but in the AIX machine it doesn't work (throws the exception).
Here is the stack trace when I try to run the project :
........................./build.xml:176: java.lang.IncompatibleClassChangeError
at com.sun.xml.bind.v2.model.impl.ElementPropertyInfoImpl$1.size(ElementPropertyInfoImpl.java:82)
at java.util.AbstractList$Itr.hasNext(AbstractList.java:431)
at com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:260)
at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:104)
at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:85)
at com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:214)
at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:99)
at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:85)
at com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:320)
at com.sun.xml.bind.v2.model.impl.RegistryInfoImpl.<init>(RegistryInfoImpl.java:103)
at com.sun.xml.bind.v2.model.impl.ModelBuilder.addRegistry(ModelBuilder.java:362)
at com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:332)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:460)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:298)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:141)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1163)
at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:145)
at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:236)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:615)
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:186)
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:146)
at javax.xml.bind.ContextFinder.find(ContextFinder.java:348)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:446)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:409)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:313)
at gen.utils.Util.unmarshalling(Unknown Source)
at gen.utils.Util.mvtConfig(Unknown Source)
at gen.utils.Util.mvtGenConfig(Unknown Source)
at gen.start.StartGen.mvtGeneration(Unknown Source)
at gen.start.StartGen.start(Unknown Source)
at gen.start.StartGen.main(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:615)
at org.apache.tools.ant.taskdefs.ExecuteJava.run(ExecuteJava.java:217)
at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:152)
at org.apache.tools.ant.taskdefs.Java.run(Java.java:771)
at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:221)
at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:135)
at org.apache.tools.ant.taskdefs.Java.execute(Java.java:108)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:615)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:390)
at org.apache.tools.ant.Target.performTasks(Target.java:411)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.Main.runBuild(Main.java:809)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Please help.
Thanks.
Check your classpath on AIX and make sure you are using compatible versions of jaxb-api and jaxb-impl libraries. I have encountered IncompatibleClassChangeError when only the minor version is different by one increment (e.g. 2.2.5 versus 2.2.6).
To check what version of each library you are using and what is required for compatibility, look in the manifest file located in the META-INF directory within each jar file. The jaxb-impl manifest declares (in addition to its own version) the specification-version, which is the version of jaxb-api jar that it requires. Since v2.2.2, the version numbers of compatible instances of jaxb-api and jaxb-impl no longer match: e.g. jaxb-impl v2.2.4 is compatible with jaxb-api v2.2.3
I only have experience using the Sun implementation of JAXB (com.sun.xml.bind), so this might not apply if you are using a different implementation.

Categories