Win a copy of High Performance Python for Data Analytics this week in the Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

NoClassFoundError on websphere

 
Ranch Hand
Posts: 249
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have one struts 2 web application war file, which is running on my local tomcat.

I checked inside WEB-INF/lib and it has all the required dependencies (for struts 2) -- Jars.jpg attached.

I assume that if my WEB-INF/lib directory contains the required jars, I should not be providing the jars anywhere else.

When I deployed the same war file on websphere, I am getting class not found exception. / No Class found def error.

E0293E: [Servlet Error]-[com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor]: java.lang.NoClassDefFoundError: org/apache/commons/lang3/StringUtils
       at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:211)
       at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:102)
       at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:234)
       at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67)
       at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:445)


E0293E: [Servlet Error]-[GenericServletWrapper]: java.lang.UnsupportedClassVersionError: JVMCFRE003 bad major version; class=org/apache/commons/lang3/StringUtils, offset=6
       at java.lang.ClassLoader.defineClassImpl(Native Method)
       at java.lang.ClassLoader.defineClass(ClassLoader.java:284)
       at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:154)
       at com.ibm.ws.classloader.CompoundClassLoader._defineClass(CompoundClassLoader.java:853)
       at com.ibm.ws.classloader.CompoundClassLoader.localFindClass(CompoundClassLoader.java:763)


[12/22/20 4:09:03:657 PST] 00000117 ecs           W com.ibm.ws.ecs.internal.scan.context.impl.ScannerContextImpl scanJAR unable to open input stream for resource org/apache/logging/log4j/Marker.class in archive WEB-INF/lib/log4j-api-2.13.3.jar
                                java.lang.IllegalArgumentException
       at org.objectweb.asm.ClassReader.<init>(Unknown Source)
       at org.objectweb.asm.ClassReader.<init>(Unknown Source)
       at org.objectweb.asm.ClassReader.<init>(Unknown Source)
       at com.ibm.ws.ecs.internal.scan.impl.ClassScanner.scanInputStream(ClassScanner.java:147)



Can someone please help me in resolving the errors?




Jars.jpg
Jars taken from WEB-INF/lib directory inside the war file.
Jars taken from WEB-INF/lib directory inside the war file.
 
Master Rancher
Posts: 4107
37
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

java.lang.UnsupportedClassVersionError: JVMCFRE003 bad major version;


That error looks like the class file was created by a younger version of java compared with the JVM's version of java
 
Yogesh Gandhi
Ranch Hand
Posts: 249
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Norm Radder wrote:

java.lang.UnsupportedClassVersionError: JVMCFRE003 bad major version;


That error looks like the class file was created by a younger version of java compared with the JVM's version of java




Thanks for taking out your precious time and replying to my post.

Yes, you are right, and this was the exact issue.

Actually I was using commons-lang3-3.11 version which I downloaded from maven repository and it was built using java 1.8
When I found this, I downloaded the lower version of the commons-lang, which was compiled using java version 1.5

Since i was using java version 1.6 on my websphere, putting this new jar solved my problem.
 
Marshal
Posts: 26310
80
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I used to work with Websphere and yes, I know it takes a long time to get a new version running in an organization. All the dependencies, all the work you have to do to replicate the "features" which change from one version to the next, all the people that have to approve it and schedule it and all that.

But even so, you really ought to get your Websphere upgraded to at least something which uses Java 8!
 
reply
    Bookmark Topic Watch Topic
  • New Topic