getting java library error in application - java

I have a web application that is deployed on WebSphere and that use one java library to generate files in excel format but I am getting the following error in WebSphere, but it will work fine with the TOMCAT server.
What can the problem be?
ERROR IS :-
Error 500: java.lang.LinkageError: LinkageError while defining class:
jxl.format.CellFormat Could not be defined due to: (jxl/format/CellFormat) bad major version at offset=6 This is often caused by having a class defined at multiple locations within the classloader hierarchy. Other potential causes include compiling against an older or newer version of the class that has an incompatible method signature. Dumping the current context classloader hierarchy: ==> indicates defining classloader ==>[0] com.ibm.ws.classloader.CompoundClassLoader#50c450c4 Local ClassPath: C:\Program Files\IBM\WebSphere\AppServer\profiles\AppSrv01\installedApps\yagneshNode01Cell\apptoolv2.ear\apptoolv2.war\WEB-INF\classes;C:\Program Files\IBM\WebSphere\AppServer\profiles\AppSrv01\installedApps\yagneshNode01Cell\apptoolv2.ear\apptoolv2.war\WEB-INF\lib\activation-1.1.jar;C:\Program Files\IBM\WebSphere\AppServer\profiles\AppSrv01\installedApps\yagneshNode01Cell\apptoolv2.ear\apptoolv2.war\WEB-INF\lib\axis.jar;C:\Program Files\IBM\WebSphere\AppServer\profiles\AppSrv01\installedApps\yagneshNode01Cell\apptoolv2.ear\apptoolv2.war\WEB-INF\lib\cglib-nodep-2.2.jar;C:\Program Files\IBM\WebSphere\AppServer\profiles\AppSrv01\installedApps\yagneshNode01Cell\apptoolv2.ear\apptoolv2.war\WEB-INF\lib\commons-discovery-0.2.jar;C:\Program Files\IBM\WebSphere\AppServer\profiles\AppSrv01\installedApps\yagneshNode01Cell\apptoolv2.ear\apptoolv2.war\WEB-INF\lib\commons-logging.jar;C:\Program Files\IBM\WebSphere\AppServer\profiles\AppSrv01\installedApps\yagneshNode01Cell\apptoolv2.ear\apptoolv2.war\WEB-INF\lib\commons-net-2.0.jar;C:\Program Files\IBM\WebSphere\AppServer\profiles\AppSrv01\installedApps\yagneshNode01Cell\apptoolv2.ear\apptoolv2.war\WEB-INF\lib\commons-net-ftp-2.0.jar;C:\Program Files\IBM\WebSphere\AppServer\profiles\AppSrv01\installedApps\yagneshNode01Cell\apptoolv2.ear\apptoolv2.war\WEB-INF\lib\dom4j-1.6.1.jar;C:\Program Files\IBM\WebSphere\AppServer\profiles\AppSrv01\installedApps\yagneshNode01Cell\apptoolv2.ear\apptoolv2.war\WEB-INF\lib\iText-5.0.6.jar;C:\Program Files\IBM\WebSphere\AppServer\profiles\AppSrv01\installedApps\yagneshNode01Cell\apptoolv2.ear\apptoolv2.war\WEB-INF\lib\jaxrpc.jar;C:\Program Files\IBM\WebSphere\AppServer\profiles\AppSrv01\installedApps\yagneshNode01Cell\apptoolv2.ear\apptoolv2.war\WEB-INF\lib\jdom-1.1.jar;C:\Program Files\IBM\WebSphere\AppServer\profiles\AppSrv01\installedApps\yagneshNode01Cell\apptoolv2.ear\apptoolv2.war\WEB-INF\lib\jettison-1.0.1.jar;C:\Program Files\IBM\WebSphere\AppServer\profiles\AppSrv01\installedApps\yagneshNode01Cell\apptoolv2.ear\apptoolv2.war\WEB-INF\lib\joda-time-1.6.jar;C:\Program Files\IBM\WebSphere\AppServer\profiles\AppSrv01\installedApps\yagneshNode01Cell\apptoolv2.ear\apptoolv2.war\WEB-INF\lib\json-rpc-1.0.jar;C:\Program Files\IBM\WebSphere\AppServer\profiles\AppSrv01\installedApps\yagneshNode01Cell\apptoolv2.ear\apptoolv2.war\WEB-INF\lib\jxl.jar;C:\Program Files\IBM\WebSphere\AppServer\profiles\AppSrv01\installedApps\yagneshNode01Cell\apptoolv2.ear\apptoolv2.war\WEB-INF\lib\mail-1.4.jar;C:\Program Files\IBM\WebSphere\AppServer\profiles\AppSrv01\installedApps\yagneshNode01Cell\apptoolv2.ear\apptoolv2.war\WEB-INF\lib\ojdbc14.jar;C:\Program Files\IBM\WebSphere\AppServer\profiles\AppSrv01\installedApps\yagneshNode01Cell\apptoolv2.ear\apptoolv2.war\WEB-INF\lib\quartz-all-1.5.2.jar;C:\Program Files\IBM\WebSphere\AppServer\profiles\AppSrv01\installedApps\yagneshNode01Cell\apptoolv2.ear\apptoolv2.war\WEB-INF\lib\saaj.jar;C:\Program Files\IBM\WebSphere\AppServer\profiles\AppSrv01\installedApps\yagneshNode01Cell\apptoolv2.ear\apptoolv2.war\WEB-INF\lib\scheduler-plugin-example.jar;C:\Program Files\IBM\WebSphere\AppServer\profiles\AppSrv01\installedApps\yagneshNode01Cell\apptoolv2.ear\apptoolv2.war\WEB-INF\lib\scheduler-plugin.jar;C:\Program Files\IBM\WebSphere\AppServer\profiles\AppSrv01\installedApps\yagneshNode01Cell\apptoolv2.ear\apptoolv2.war\WEB-INF\lib\servlet-api.jar;C:\Program Files\IBM\WebSphere\AppServer\profiles\AppSrv01\installedApps\yagneshNode01Cell\apptoolv2.ear\apptoolv2.war\WEB-INF\lib\sqljdbc.jar;C:\Program Files\IBM\WebSphere\AppServer\profiles\AppSrv01\installedApps\yagneshNode01Cell\apptoolv2.ear\apptoolv2.war\WEB-INF\lib\stax-1.2.0.jar;C:\Program Files\IBM\WebSphere\AppServer\profiles\AppSrv01\installedApps\yagneshNode01Cell\apptoolv2.ear\apptoolv2.war\WEB-INF\lib\stax-api-1.0.1.jar;C:\Program Files\IBM\WebSphere\AppServer\profiles\AppSrv01\installedApps\yagneshNode01Cell\apptoolv2.ear\apptoolv2.war\WEB-INF\lib\wsdl4j.jar;C:\Program Files\IBM\WebSphere\AppServer\profiles\AppSrv01\installedApps\yagneshNode01Cell\apptoolv2.ear\apptoolv2.war\WEB-INF\lib\wstx-asl-3.2.7.jar;C:\Program Files\IBM\WebSphere\AppServer\profiles\AppSrv01\installedApps\yagneshNode01Cell\apptoolv2.ear\apptoolv2.war\WEB-INF\lib\xml-writer-0.2.jar;C:\Program Files\IBM\WebSphere\AppServer\profiles\AppSrv01\installedApps\yagneshNode01Cell\apptoolv2.ear\apptoolv2.war\WEB-INF\lib\xom-1.1.jar;C:\Program Files\IBM\WebSphere\AppServer\profiles\AppSrv01\installedApps\yagneshNode01Cell\apptoolv2.ear\apptoolv2.war\WEB-INF\lib\xpp3_min-1.1.4c.jar;C:\Program Files\IBM\WebSphere\AppServer\profiles\AppSrv01\installedApps\yagneshNode01Cell\apptoolv2.ear\apptoolv2.war\WEB-INF\lib\xstream-1.3.1.jar;C:\Program Files\IBM\WebSphere\AppServer\profiles\AppSrv01\installedApps\yagneshNode01Cell\apptoolv2.ear\apptoolv2.war\WEB-INF\lib\xstream-benchmark-1.3.1.jar;C:\Program Files\IBM\WebSphere\AppServer\profiles\AppSrv01\installedApps\yagneshNode01Cell\apptoolv2.ear\apptoolv2.war Delegation Mode: PARENT_FIRST [1] com.ibm.ws.classloader.JarClassLoader#738995212 Local Classpath: Delegation mode: PARENT_FIRST [2] com.ibm.ws.classloader.ProtectionClassLoader#60e060e0 [3] com.ibm.ws.bootstrap.ExtClassLoader#70567056 [4] org.eclipse.osgi.framework.adaptor.core.CDSBundleClassLoader#4e024e02 [5] sun.misc.Launcher$AppClassLoader#6b806b80 [6] sun.misc.Launcher$ExtClassLoader#3fe03fe ---Original exception--- java.lang.UnsupportedClassVersionError: (jxl/format/CellFormat) bad major version at offset=6 at java.lang.ClassLoader.defineClassImpl(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:222) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:148) at com.ibm.ws.classloader.CompoundClassLoader._defineClass(CompoundClassLoader.java:526) at com.ibm.ws.classloader.CompoundClassLoader.findClass(CompoundClassLoader.java:477) at .............

This is the problem:
Could not be defined due to: (jxl/format/CellFormat) bad major version at offset=6
You're using a JExcel library compiled for a version of Java that your application server does not support. You'll either need to recompile the library or move to a newer version of WebSphere Application Server.
(The product printed the same "defined at multiple locations" error with class loader dump for all LinkageError, regardless of whether that text is actually relevant, until around 6.1.0.21.)

Looks like you've got Andy Khan's JExcel library in the CLASSPATH twice. See if WebSphere ships with it. If it does, remove yours from the application WEB-INF/lib and see if that helps.

Related

downgrade java version on archlinux

I have just updated java on my archlinux server and now it mess up my tomcat projects.
I want to downgrade java from 11.0.17.u1 to 11.0.13.u8
I looked at my var/cache/pacman/pkg folder and it seems like my old package are still there
jre11-openjdk-11.0.13.u8-1-x86_64.pkg.tar.zst
jre11-openjdk-headless-11.0.13.u8-1-x86_64.pkg.tar.zst
I am trying to run this command to force the installation of this java version :
sudo pacman -U jre11-openjdk-11.0.13.u8-1-x86_64.pkg.tar.zst
But it does not let me and I get this message :
loading packages...
warning: downgrading package jre11-openjdk (11.0.17.u1-1 => 11.0.13.u8-1)
resolving dependencies...
warning: cannot resolve "jre11-openjdk-headless=11.0.13.u8-1", a dependency of "jre11-openjdk"
:: The following package cannot be upgraded due to unresolvable dependencies:
jre11-openjdk
What can I do to force the downgrade?
Further infos:
This is the error I am getting since I updated the JVM
09-Jan-2023 15:46:44.910 WARNING [main] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesObjectStreamClassCaches Failed to clear soft references from ObjectStreamClass$Caches for web application [docs]
java.lang.ClassCastException: class java.io.ObjectStreamClass$Caches$1 cannot be cast to class java.util.Map (java.io.ObjectStreamClass$Caches$1 and java.util.Map are in module java.base of loader 'bootstrap')
The tomcat servers I have not restarted yet (which are still running under the old jvm are doing just fine.
I found this topic here :
ClassCastException when stopping Tomcat 10 inside Eclipse
The solution that is brought is to upgrade the tomcat version. I am in an emergency situation where I don't have the time to update all my tomcat servers right now.

java.lang.ClassFormatError: JVMCFRE074 no Code attribute specified; class=javax/ejb/RemoveException, method=<init>()V, pc=0

I am getting the below error while trying to publish the application EAR in the server.
Deployment from com.ibm.etools.ejbdeploy.EJBDeployer had errors:
RMIC Command returns RC = MyApplicationEJB. The problems which stopped RMIC are displayed, and have also been recorded in the .log file in error: An error has occurred in the compiler; please file a bug report (http://java.sun.com/cgi-bin/bugreport.cgi).
java.lang.ClassFormatError: JVMCFRE074 no Code attribute specified; class=javax/ejb/RemoveException, method=<init>()V, pc=0
at java.lang.ClassLoader.defineClass(ClassLoader.java:275)
at java.lang.ClassLoader.defineClass(ClassLoader.java:212)
at com.ibm.tools.rmic.iiop.DirectoryLoader.loadClass(DirectoryLoader.java:149)
at com.ibm.tools.rmic.iiop.CompoundType.loadClass(CompoundType.java:354)
at com.ibm.tools.rmic.iiop.Type.initClass(Type.java:1008)
at com.ibm.tools.rmic.iiop.Type.setRepositoryID(Type.java:1025)
at com.ibm.tools.rmic.iiop.CompoundType.initialize(CompoundType.java:762)
at com.ibm.tools.rmic.iiop.ValueType.initialize(ValueType.java:323)
at com.ibm.tools.rmic.iiop.ValueType.forValue(ValueType.java:131)
at com.ibm.tools.rmic.iiop.CompoundType.getMethodExceptions(CompoundType.java:1678)
at com.ibm.tools.rmic.iiop.CompoundType$Method.<init>(CompoundType.java:2457)
at com.ibm.tools.rmic.iiop.CompoundType.addAllMethods(CompoundType.java:1308)
at com.ibm.tools.rmic.iiop.RemoteType.isConformingRemoteInterface(RemoteType.java:222)
at com.ibm.tools.rmic.iiop.RemoteType.initialize(RemoteType.java:171)
at com.ibm.tools.rmic.iiop.RemoteType.forRemote(RemoteType.java:90)
at com.ibm.tools.rmic.iiop.CompoundType.makeType(CompoundType.java:852)
at com.ibm.tools.rmic.iiop.CompoundType$Method.<init>(CompoundType.java:2408)
at com.ibm.tools.rmic.iiop.CompoundType.addAllMethods(CompoundType.java:1308)
at com.ibm.tools.rmic.iiop.RemoteType.isConformingRemoteInterface(RemoteType.java:222)
at com.ibm.tools.rmic.iiop.RemoteType.initialize(RemoteType.java:171)
at com.ibm.tools.rmic.iiop.RemoteType.forRemote(RemoteType.java:90)
at com.ibm.tools.rmic.iiop.CompoundType.addRemoteInterfaces(CompoundType.java:1455)
at com.ibm.tools.rmic.iiop.ImplementationType.initialize(ImplementationType.java:166)
at com.ibm.tools.rmic.iiop.ImplementationType.forImplementation(ImplementationType.java:92)
at com.ibm.tools.rmic.iiop.CompoundType.makeType(CompoundType.java:892)
at com.ibm.tools.rmic.iiop.ClassType.initParents(ClassType.java:197)
at com.ibm.tools.rmic.iiop.ImplementationType.initialize(ImplementationType.java:156)
at com.ibm.tools.rmic.iiop.ImplementationType.forImplementation(ImplementationType.java:92)
at com.ibm.tools.rmic.iiop.StubGenerator.getTopType(StubGenerator.java:151)
at com.ibm.tools.rmic.iiop.Generator.generate(Generator.java:285)
at sun.rmi.rmic.Main.doCompile(Main.java:547)
at sun.rmi.rmic.Main.compile(Main.java:148)
at sun.rmi.rmic.Main.main(Main.java:786)
1 error
Can anybody please help me out in this.
I am using - Websphere 9.1 and jdk 1.6. Interesting thing is my colleagues who have a lower version of Websphere - 8.0, do not get this error.
UPDATE: My Websphere's Runtime Environment is - WebSphere Application Server v7.0
In general a ClassFormatError means that the class with the error was compiled at a java level that is greater than the java level being used at runtime.
In the case of WebSphere v9.0 (which only support Java 8+), the javax/ejb/RemoveException class is compiled at the Java 7 level, so running WAS on Java 6 with a class compiled at the Java 7 or higher level will result in a ClassFormatError.
Update:
You have mentioned in the comments that you are using WAS v7.0 and not WAS v9. The overall explanation is the same regardless of what version of WAS you are using, namely, you can't run on a lower java level than what the classes were compiled with.
I recommend checking what java version the javax/ejb/RemoveException class in your WAS install was compiled at, and compare it to the java level you are running on.

Java extensions loader cannot find extensions after Java auto updates when application is running

Java uses "java.ext.dirs" property to get the directory from which extensions should be loaded. My application starts (through JNI), runs OK and then (after java's auto-update) I get:
java.lang.InternalError: java.io.FileNotFoundException: \C:\Program Files\Java\jre1.8.0_60\lib\ext\dnsns.jar
The updated version is in jre1.8.0_65, so no wonder the extension cannot be found. Any idea how to fix this?

HypergraphDB Netbeans settings

I want to do something with the HypergraphDB in Java. I'm not very familiar with this language and IDE Netbeans.
I followed steps describing the HGDB installation:Link to tutorial
Now I want to write an example in Java (using NetbeansIDE).
So I created new project, added refferences to the downloaded libraries. OK, now I'm able to import packages with HGDB. The only thing I have in my main method is HyperGraph HG = new HyperGraph(dbLocation);. This code compiles. But get following runtime error:
run:
checkpoint kbytes:0
checkpoint minutes:0
java.lang.IllegalStateException: There is 1 existing transaction opened against the Environment.
Aborting open transactions ...
aborting <Transaction id="28">
at com.sleepycat.je.Environment.close(Environment.java:383)
at org.hypergraphdb.storage.bje.BJEStorageImplementation.shutdown(BJEStorageImplementation.java:178)
at org.hypergraphdb.HGStore.close(HGStore.java:355)
at org.hypergraphdb.HyperGraph.open(HyperGraph.java:392)
at org.hypergraphdb.HyperGraph.open(HyperGraph.java:213)
at org.hypergraphdb.HyperGraph.<init>(HyperGraph.java:200)
at hgdbtest.HgdbTest.main(HgdbTest.java:16)
Exception in thread "main" org.hypergraphdb.HGException: java.lang.NoSuchMethodError: org.hypergraphdb.storage.bje.LinkBinding.objectToEntry(Ljava/lang/Object;Lcom/sleepycat/je/DatabaseEntry;)V
at org.hypergraphdb.HyperGraph.open(HyperGraph.java:395)
at org.hypergraphdb.HyperGraph.open(HyperGraph.java:213)
at org.hypergraphdb.HyperGraph.<init>(HyperGraph.java:200)
at hgdbtest.HgdbTest.main(HgdbTest.java:16)
Caused by: java.lang.NoSuchMethodError: org.hypergraphdb.storage.bje.LinkBinding.objectToEntry(Ljava/lang/Object;Lcom/sleepycat/je/DatabaseEntry;)V
at org.hypergraphdb.storage.bje.BJEStorageImplementation.store(BJEStorageImplementation.java:234)
at org.hypergraphdb.HGStore.store(HGStore.java:119)
at org.hypergraphdb.HGTypeSystem.addPrimitiveTypeToStore(HGTypeSystem.java:185)
at org.hypergraphdb.HGTypeSystem.bootstrap(HGTypeSystem.java:234)
at org.hypergraphdb.HyperGraph.open(HyperGraph.java:355)
... 3 more
Java Result: 1
BUILD SUCCESSFUL (total time: 4 seconds)
I guess it's caused by the native API of the BerkeleyDB.
According to the tutorial, in project options I supply the -Djava.library.path=$HGDB_ROOT/lib/native/$PLATFORM argument on Run card as a VM Option. Instead of the system variables I use full-path to the libraries.
My OS in Windows7. I'm not sure about using slashes or backslashes or double-backslashes as a path-separator.?
So a simply question is: how have I to set up the IDE for using the HypergraphDB?
Thank you for advices!
Judging from the stack trace, you are using the latest version of HyperGraphDB. In that version, the native API is not used. Rather, it's Java only libraries. You have to include the BerkeleyDB Java Edition 5.0.34 jar in your runtime classpath. You can get it either from the Oracle http://www.oracle.com/technetwork/products/berkeleydb/downloads/index.html or from the HyperGraphDB Maven repository: http://hypergraphdb.org/maven/org/hypergraphdb/hgbdbje/1.2/hgbdbje-1.2.jar
I had the same issue. I fixed it (by accident) by fixing the order of the libraries on which you're HyperGraphDB application relies on. The library je-[version].jar has to be ABOVE (and hence to be referenced before) db-[version].jar

JSP exception - class not found (tomcat)

I'm setting up an existing application on a new Tomcat 5.5 server connecting to a Postgres database (running on Debian Lenny). When I access it I get a series of stack traces with the following root cause:
java.lang.ClassNotFoundException: java.sql.SQLClientInfoException
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1363)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1209)
java.lang.Class.forName(libgcj.so.90)
java.lang.Class.initializeClass(libgcj.so.90)
java.lang.Class.initializeClass(libgcj.so.90)
org.postgresql.Driver.makeConnection(Driver.java:382)
org.postgresql.Driver.connect(Driver.java:260)
java.sql.DriverManager.getConnection(libgcj.so.90)
jof.DBConnection.getConnection(DBConnection.java:81)
jof.BeanInterfaceBase.db(BeanInterfaceBase.java:263)
jof.BeanInterfaceBase.getStatement(BeanInterfaceBase.java:613)
jof.HelpInterface.findByNaturalId(HelpInterface.java:81)
jof.HelpInterface.findByNaturalId(HelpInterface.java:128)
org.apache.jsp.index_jsp.getHelp(index_jsp.java:162)
org.apache.jsp.index_jsp._jspService(index_jsp.java:369)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
java.lang.reflect.Method.invoke(libgcj.so.90)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:244)
java.security.AccessController.doPrivileged(libgcj.so.90)
javax.security.auth.Subject.doAsPrivileged(libgcj.so.90)
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:276)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:162)
What's missing?
java.lang.ClassNotFoundException: java.sql.SQLClientInfoException
What's missing?
To be precise: the mentioned class is missing in the runtime classpath. It must be in the runtime classpath as a standalone class file (*.class) or packaged in a JAR file (*.jar). Alternatively you can also add its actual path to the runtime classpath.
By default the webapp's Webapp/WEB-INF/lib and Webapp/WEB-INF/classes folders are covered by the runtime classpath, as is appserver's Appserver/lib folder and the Java's JRE/lib.
Any 3rd party webapp-specific JAR files ought to be placed in Webapp/WEB-INF/lib. Any webapp-specific classes (servlets, etc..) ought to be placed in Webapp/WEB-INF/classes. Any appserver-specific (or webapp-common) JAR files ought to be placed in Appserver/lib. The Java's JRE/lib folder must be left untouched.
Hope this helps.
Edit: the actual problem is worse: this is indeed a Java 6 only class. Tomcat is apparently running on a Java 5. Review your JAVA_HOME environment variable. It must at least point to root installation folder of Java 6 JRE.
This is a guess, but I see that java.sql.SQLClientInfoException is a class that was introduced in Java6. What version of Java is being used to launch your Tomcat server? Maybe you are developing under Java6 but then deploying to a Tomcat running Java5?

Categories

Resources