Class bytes found but defineClass()failed for error when deploying EAR

本文解决了在WebLogic上部署应用程序时出现的“Class bytes found but defineClass() failed”错误。该问题源于ActiveMQ 5.13.4版本与WebLogic Server使用的JDK版本不兼容。提供了解决方案包括使用正确的JDK版本进行编译或运行。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

weblogic 上面部署应用的时候报错

<Caused by: java.lang.ClassNotFoundException: Class bytes found but defineClass()failed for: 'org.apache.activemq.ActiveMQConnectionFactory'> 

根据博客的说明

http://stackoverflow.com/questions/23771470/class-bytes-found-but-defineclassfailed-for-error-when-deploying-ear

原因是:

activemq5.13.4 要求运行的Java版本是 jdk 1.7以上,但是weblogic server 运行的jdk版本小于1.7

Compiling code with JDK 1.7 Running code with Weblogic server with JDK 1.6

Solution 1: Compile code with JDK 1.6

Solution 2: Run weblogic server with JDK 1.7

Update (Middleware)\user_projects\domains(DomainName)\bin\setDomainEnv.cmd (Windows)

Update (Middleware)\user_projects\domains(DomainName)\bin\setDomainEnv.sh (*nix)

set SUN_JAVA_HOME= JDK 1.7 path (e.g C:\Program Files\Java\jdk1.7.0_79)

set JAVA_HOME= JDK 1.7 path (e.g C:\Program Files\Java\jdk1.7.0_79)

 

转载于:https://my.oschina.net/u/2308739/blog/742480