java.lang.IncompatibleClassChangeError while running POI 3.8 on Websphere - java

I’m having java.lang.IncompatibleClassChangeError error when I try to load jars in JVM on websphere and run my application. I’m using the following jars
• poi-3.8.jar
• poi-ooxml-3.8.jar
I have also checked manually for any different version used in lib folder but I couldn’t see any.
Can anyone please help me to solve this error?

Ensure you don't have multiple jars with the same "package.Class" in different versions. The jars must not have 'same' name but different version. This exception rises, if the classloader loads the wrong class, that don't have an expected method par ex.
Probably this search helps you to find other jars that contain the same class. http://search.maven.org/#advancedsearch%7Cgav
An other option could be, you set the classloader to PARENT_LAST. http://publib.boulder.ibm.com/infocenter/iseries/v5r3/index.jsp?topic=%2Frzamy%2F50%2Fprogram%2Fclsadmcns.htm

Related

Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory at runtime [duplicate]

I am trying to run GWT RequestFactory and facing this error:
ClassNotFoundException: org.slf4j.LoggerFactory
I have tried to download slf4j-api-1.3.1.jar but it didnt resolve the issue
Any idea exactly which jar I need to download ?
Better to always download as your first try, the most recent version from the developer's site
I had the same error message you had, and by downloading the jar from the above (slf4j-1.7.2.tar.gz most recent version as of 2012OCT13), untarring, uncompressing, adding 2 jars to build path in eclipse (or adding to classpath in comand line):
slf4j-api-1.7.2.jar
slf4j-simple-1.7.2.jar
I was able to run my program.
Try downloading jar from here
You can find, it holds the class you need.
EDIT
Seems like the website has changed its structure. You need to choose which jar file you need for your project.
For slf4j-api jar file for latest version as of now, please visit this link
For slf4j-simple jar file for latest version as of now, please visit this link
i know this is an old Question , but i faced this problem recently and i looked for it in google , and i came across this documentation here from slf4j website .
as it describes the following :
This error is reported when the org.slf4j.impl.StaticLoggerBinder
class could not be loaded into memory. This happens when no
appropriate SLF4J binding could be found on the class path.
Placing one (and only one) of slf4j-nop.jar, slf4j-simple.jar,
slf4j-log4j12.jar, slf4j-jdk14.jar or logback-classic.jar on the class
path should solve the problem.
SINCE 1.6.0 As of SLF4J version 1.6, in
the absence of a binding, SLF4J will default to a no-operation (NOP)
logger implementation.
Hope that will help someone .
For a bit more explanation: keep in mind that the "I" in "api" is interface. The slf4j-api jar only holds the needed interfaces (actually LoggerFactory is an abstract class). You also need the actual implementations (an example of which, as noted above, can be found in slf4j-simple). If you look in the jar, you'll find the required classes under the "org.slf4j.impl" package.
You'll need to download SLF4J's jars from the official site as either a zip (v1.7.4) or tar.gz (v1.7.4)
The download contains multiple jars based on how you want to use SLF4J. If you're simply trying to resolve the requirement of some other library (GWT, I assume) and don't really care about using SLF4J correctly, then I would probably pick the slf4j-api-1.7.4.jar since the Simple jar suggested by another answer does not contain, to my knowledge, the specific class you're looking for.
add this dependency
https://mvnrepository.com/artifact/org.slf4j/slf4j-api/1.7.28
will help fix error
I got this problem too and I fixed it in this way.
I was trying to run mapreduce job locally through Eclipse, after set the configurations, I met this error (in Linux, Virtual Box)
To solve it,
right click on the project you want to run,
go "Properties"->"Java
Build Path"->"Add External Jars",
then go to
file:/usr/lib/Hadoop/client-0.20, choose the three jars named started
by "slf4j".
Then you'll be able to run the job locally.
Hope my experience will help someone.
Add the following JARs to the build path or lib folder of the project:
slf4j-api-1.7.2.jar
slf4j-jdk14-1.7.2.jar
It needs "slf4j-simple-1.7.2.jar" to resolve the problem.
I downloaded a zip file "slf4j-1.7.2.zip" from http://slf4j.org/download.html. I extracted the zip file and i got slf4j-simple-1.7.2.jar
I had the same on Android. This is how i fixed it:
including ONLY the file:
slf4j-api-1.7.6.jar
in my libs/ folder
Having any additional slf4j* file, caused the NoClassDefFoundError.
Obviously, the rest of the libs can be there (android-support-v4, etc)
Versions:
Eclipse Kepler 2013 06 14 - 02 29
ADT 22.3
Android SDK: 4.4.2
Hope someone saves the time i wasted thanks to this!

Tomcat 6 Classloader : Which Jar is it reading?

I have a huge web application that I have to support. Recently when I downloaded the latest source from SVN and try to run it locally on Tomcat 6, I get the following error from one of the background batch jobs that the application runs...
2014-12-23 18:08:27 [taskScheduler-4] TaskUtils$LoggingErrorHandler [ERROR] Unexpected error occurred in scheduled task.
java.lang.NoSuchMethodError: javax.xml.stream.XMLEventFactory.newFactory()Ljavax/xml/stream/XMLEventFactory;
at org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor$HeadersProcessor.<clinit>(ReadHeadersInterceptor.java:275)
So I believe the problem is the Apache class ReadHeadersInterceptor which my application's code calls is trying to call the newFactory() method from XMLEventFactory but is not finding that method, probably because it is reading an older version of XMLEventFactory.
I think this is happening because there are some JARs in my lib folder I need to remove or add. Problem is I don't know which one. I see there are several JARs which have XMLEventFactory including..
woodstox-core-asl-4.2.0
stax2-api-3.1.1
And it is also part of Java 6 in the rt.jar.
So out of all these Jars which one is it trying to read and not find that method it needs?
Thanks.
This is a problem with specific version of JDK/JRE 1.6 (I mean the update). It may looks weird but the JDK API change for specific major version.
Please take a loot at the following link. You can see there that with change from version 1.6.0.17 to 1.6.0.18 the new methods have been added on the XMLEventFactory class.
Probably you have the JRE version less thank 1.6.0.18. I've had the same problem with Apache CXF and dynamic proxies. The update of JRE 1.6.0.14 to 1.6.0.19 fixed the issue.
I hope it helps.

NoClassDefFoundError while using docx4j in IBM message broker v8

I have a requirement to create a word document. So I am trying to use docx4j. I get a runtime error.
java.lang.NoClassDefFoundError: org.docx4j.openpackaging.packages.WordprocessingMLPackage
I am sure I have docx4j3.0.1 and all the dependencies added to my build path.
Is there an issue with the class initialization mechanism?
Any ideas?
Had to add all the jars to the MQSI/shared-classes folder. That worked.
For future reference a good way to resolve these problems on IBM JRE platforms is to set the environment variable IBM_JAVA_OPTIONS=-Dibm.cl.verbose=* and restart the Broker.
This will cause classloading trace to be written to Broker's standard output (located in $MQSI_WORKPATH/components//
This shows you what jars are available in each classloader and which classloaders are being searched whenever a class is loaded.

hbase + gwt multi module app, issues with slf4j and resources

I've found a lot of articles/questions dealing with this problem, but there was no answer that worked for me yet.
I'm using GWT 2.5 with the eclipse plugin. eclipse version is Juno with Java7.
Everytime I start the app it first tells me that log4j was not configured properly (no appenders...) and also my HBaseAdmin can't connect to HBase (which is running).
All of the answers tell me that I have to put the resources into WEB-INF/classes directory. In order to do that automatically I added the files into the root src directory. But still nothing.
Maybe it's worth mentioning that I don't use maven (b/c all the other projects are no maven projects either, and there is no time to introduce maven at the moment)
Thank you for any hints what might be missing.
EDIT:
somehow I don't get any warning anymore, but I didn't do anything except restarting over and over. Thus this should be working now. But, Zookeeper now throws
java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
I divided the gwt app up to the UI part, the executing implementation of the service is a seperate project, also the model is seperate. I first just added the required libraries to the projects that really need them. Know I also added them to the main GWT app, but that didn't help either. Any ideas?
LoggerFactory classes you are using is from slfj-api-1.6.1.jar . Try adding that jar into your WEB-INF/lib and classpath. Also we usually use it conjunction with slf4j-log4j12-1.6.1.jar .
Note: We are using version 1.6.1 as indicated by GWT sample examples available with gwt downloads.

Java xerces DocumentBuilderFactoryimpl not found - What to do?

I get this message :
javax.xml.parsers.FactoryConfigurationError:
Provider
org.apache.xerces.jaxp.DocumentBuilderFactoryImp
but i can't seem to solve the problem. I have googled, but can't find any good solutions.
Does anyone have an idea of what could be wrong?
And maybe how to solve it :)
The org.apache.xerces is from the Apache Xerces package, and something in your application has a dependency on it. Try downloading it (latest version is 2.9.0) and adding it to your application's classpath.
DocumentBuilderFactory has a multi-step process for finding the actual parser implementation, as described in the linked JavaDoc. Your error message is almost certainly coming from there.
I suspect that your JBoss startup script is setting the javax.xml.parsers.DocumentBuilderFactory system property incorrectly (I've seen this happen before, used to avoid a bug in the released library). I would start by grepping the JBoss configuration directory for that property, followed by explicitly setting the jaxp.debug property (also described in the link). Assuming that your startup script is indeed explicitly setting the property, find out who made that change and ask him/her if you can delete it (or to provide you with the correct JARs if not).
As you've tagged your question JBoss, I'll assume your code is running in the JBoss container.
JBoss may have already loaded a version of Xerces for it's own use and you're trying to load a different version in your code (either explicitly or through some dependency) and the configuration for your version is not compatible with the version that's already loaded.
This JIRA Ticket on JBoss.org suggests deleting the xercesimpl.jar in jasperserver/WEB-INF/lib folder to allow your version to be used.

Categories

Resources