gpt4 book ai didi

java - .class 文件中的版本号错误。在 Jdev 10.1.3.4.0 中嵌入的 oc4j

转载 作者:行者123 更新时间:2023-12-01 12:57:13 25 4
gpt4 key购买 nike

我正在将一个项目从在 tomcat 上的 Netbeans 中运行转换为在嵌入式 tomcat 上的 jdeveloper 中运行。但我遇到了这个错误:

oracle.classloader.util.AnnotatedClassFormatError: Bad version number in .class file

我读到这与版本有关,但我已将所有内部 jar 编译为 1.5,并确保我的项目也以 1.5 为目标

有关如何解决或如何“升级”嵌入式 OC4j 的任何建议

完整的堆栈跟踪:

2014-05-21 07:39:32,014 [HTTPThreadGroup-4] ERROR org.apache.commons.digester.Digester - Begin event threw exception
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUtils.java:1789)
at org.apache.commons.beanutils.PropertyUtils.setNestedProperty(PropertyUtils.java:1684)
at org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils.java:1713)
at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:1019)
at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)
at org.apache.commons.digester.SetPropertiesRule.begin(SetPropertiesRule.java:259)
at org.apache.commons.digester.Rule.begin(Rule.java:200)
at org.apache.commons.digester.Digester.startElement(Digester.java:1273)
at oracle.xml.parser.v2.NonValidatingParser.parseElement(NonValidatingParser.java:1288)
at oracle.xml.parser.v2.ValidatingParser.parseRootElement(ValidatingParser.java:146)
at oracle.xml.parser.v2.NonValidatingParser.parseDocument(NonValidatingParser.java:303)
at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:206)
at org.apache.commons.digester.Digester.parse(Digester.java:1548)
at org.apache.struts.action.ActionServlet.parseModuleConfigFile(ActionServlet.java:1006)
at org.apache.struts.action.ActionServlet.initModuleConfig(ActionServlet.java:955)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:470)
at javax.servlet.GenericServlet.init(GenericServlet.java:256)
at com.evermind.server.http.HttpApplication.loadServlet(HttpApplication.java:2379)
at com.evermind.server.http.HttpApplication.findServlet(HttpApplication.java:4830)
at com.evermind.server.http.HttpApplication.findServlet(HttpApplication.java:4754)
at com.evermind.server.http.HttpApplication.initPreloadServlets(HttpApplication.java:4942)
at com.evermind.server.http.HttpApplication.initDynamic(HttpApplication.java:1144)
at com.evermind.server.http.HttpApplication.<init>(HttpApplication.java:741)
at com.evermind.server.ApplicationStateRunning.getHttpApplication(ApplicationStateRunning.java:431)
at com.evermind.server.Application.getHttpApplication(Application.java:586)
at com.evermind.server.http.HttpSite$HttpApplicationRunTimeReference.createHttpApplicationFromReference(HttpSite.java:1987)
at com.evermind.server.http.HttpSite$HttpApplicationRunTimeReference.createHttpApplicationFromReference(HttpSite.java:1970)
at com.evermind.server.http.HttpSite$HttpApplicationRunTimeReference.getHttpApplication(HttpSite.java:1922)
at com.evermind.server.http.HttpSite.getApplication(HttpSite.java:423)
at com.evermind.server.http.HttpRequestHandler.resolveApplication(HttpRequestHandler.java:398)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:439)
at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:221)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:122)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:111)
at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:234)
at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:29)
at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:879)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:298)
at java.lang.Thread.run(Thread.java:595)
Caused by: oracle.classloader.util.AnnotatedClassFormatError: Bad version number in .class file

Ugyldig klasse: dk.myproject.bII.login.actions.LoginActionForm
Indlæser: current-workspace-app.web.DefaultProject:0.0.0
Kodekilde: /C:/workspace/myproject/test/Return/libs/BUtilities.jar
Konfiguration: <classpath> in C:\workspace\myproject\test\Return\Client\public_html

Afhængig klasse: org.apache.struts.config.FormBeanConfig
Indlæser: current-workspace-app.web.DefaultProject:0.0.0
Kodekilde: /C:/jdevstudio10134/jakarta-struts/lib/struts.jar
Konfiguration: <classpath> in C:\workspace\myproject\test\Return\Client\public_html

at oracle.classloader.PolicyClassLoader.defineClass(PolicyClassLoader.java:2285)
at oracle.classloader.PolicyClassLoader.findLocalClass(PolicyClassLoader.java:1462)
at oracle.classloader.SearchPolicy$FindLocal.getClass(SearchPolicy.java:167)
at oracle.classloader.SearchSequence.getClass(SearchSequence.java:119)
at oracle.classloader.PolicyClassLoader.internalLoadClass(PolicyClassLoader.java:1674)
at oracle.classloader.PolicyClassLoader.loadClass(PolicyClassLoader.java:1635)
at oracle.classloader.PolicyClassLoader.loadClass(PolicyClassLoader.java:1620)
at org.apache.struts.config.FormBeanConfig.formBeanClass(FormBeanConfig.java:320)
at org.apache.struts.config.FormBeanConfig.setType(FormBeanConfig.java:191)
... 44 more
Caused by: java.lang.UnsupportedClassVersionError: Bad version number in .class file
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at oracle.classloader.PolicyClassLoader.defineClass(PolicyClassLoader.java:2241)
... 52 more
2014-05-21 07:39:32,019 [HTTPThreadGroup-4] ERROR org.apache.struts.action.ActionServlet - Parsing error processing resource path
java.lang.reflect.InvocationTargetException
at org.apache.commons.digester.Digester.createSAXException(Digester.java:2540)
at org.apache.commons.digester.Digester.createSAXException(Digester.java:2566)
at org.apache.commons.digester.Digester.startElement(Digester.java:1276)
at oracle.xml.parser.v2.NonValidatingParser.parseElement(NonValidatingParser.java:1288)
at oracle.xml.parser.v2.ValidatingParser.parseRootElement(ValidatingParser.java:146)
at oracle.xml.parser.v2.NonValidatingParser.parseDocument(NonValidatingParser.java:303)
at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:206)
at org.apache.commons.digester.Digester.parse(Digester.java:1548)
at org.apache.struts.action.ActionServlet.parseModuleConfigFile(ActionServlet.java:1006)
at org.apache.struts.action.ActionServlet.initModuleConfig(ActionServlet.java:955)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:470)
at javax.servlet.GenericServlet.init(GenericServlet.java:256)
at com.evermind.server.http.HttpApplication.loadServlet(HttpApplication.java:2379)
at com.evermind.server.http.HttpApplication.findServlet(HttpApplication.java:4830)
at com.evermind.server.http.HttpApplication.findServlet(HttpApplication.java:4754)
at com.evermind.server.http.HttpApplication.initPreloadServlets(HttpApplication.java:4942)
at com.evermind.server.http.HttpApplication.initDynamic(HttpApplication.java:1144)
at com.evermind.server.http.HttpApplication.<init>(HttpApplication.java:741)
at com.evermind.server.ApplicationStateRunning.getHttpApplication(ApplicationStateRunning.java:431)
at com.evermind.server.Application.getHttpApplication(Application.java:586)
at com.evermind.server.http.HttpSite$HttpApplicationRunTimeReference.createHttpApplicationFromReference(HttpSite.java:1987)
at com.evermind.server.http.HttpSite$HttpApplicationRunTimeReference.createHttpApplicationFromReference(HttpSite.java:1970)
at com.evermind.server.http.HttpSite$HttpApplicationRunTimeReference.getHttpApplication(HttpSite.java:1922)
at com.evermind.server.http.HttpSite.getApplication(HttpSite.java:423)
at com.evermind.server.http.HttpRequestHandler.resolveApplication(HttpRequestHandler.java:398)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:439)
at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:221)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:122)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:111)
at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:234)
at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:29)
at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:879)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:298)
at java.lang.Thread.run(Thread.java:595)
2014-05-21 07:39:32,034 [HTTPThreadGroup-4] ERROR _jsp._generalError - javax.servlet.jsp.JspException: Cannot retrieve mapping for action /AjaxActions

一些堆栈跟踪的翻译:

 Ugyldig klasse: dk.myproject.bII.login.actions.LoginActionForm
Indlæser: current-workspace-app.web.DefaultProject:0.0.0
Kodekilde: /C:/workspace/myproject/test/Return/libs/BUtilities.jar
Konfiguration: <classpath> in C:\workspace\myproject\test\Return\Client\public_html

翻译成:

Invalid class : ....
loading: ....
sourcecode : ...
configuration : ....

更新:检查所有 jar 文件,最高版本均为 49 (java 1.5)。有人知道如何检查嵌入式oc4j可以运行的版本吗?

最佳答案

通常,当您的项目使用比 oc4j 更高版本的 JAVA 时,就会出现该错误。您必须检查 oc4j 的 JRE 版本,并且您已经使用该版本构建了项目。

我不确定 Netbeans,但如果您使用 eclipse,那么您必须在项目中进行两项更改:-1.转到项目属性并选择Java编译器,根据oc4j上的版本更改版本

  • 转到项目属性并选择项目构面,并在此处更改 JAVA 版本
  • 希望这有帮助

    关于java - .class 文件中的版本号错误。在 Jdev 10.1.3.4.0 中嵌入的 oc4j,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23777411/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com