在 weblogic 上部署 ear 时出现 classNotFound 异常
getting classNotFound Exception when deploying ear on weblogic
当我在 weblogic 管理员控制台上部署 ear
文件时,出现以下错误 -
javax.servlet.ServletException: [HTTP:101249][ServletContext@47518104[app:CorporateActionDatabaseEAR-0 module:/CorporateActionDatabaseWAR path:/CorporateActionDatabaseWAR spec-version:null]]: Servlet class org.glassfish.jersey.servlet.ServletContainer for servlet Jersey Web Application could not be loaded because the requested class was not found in the classpath . java.lang.UnsupportedClassVersionError: org/glassfish/jersey/servlet/ServletContainer : unsupported classversion 51.0.
知道为什么会这样吗?我知道这与添加 jersey-container-servlet-core jar 有关,但我应该将它添加到哪个模块中?我的 war
模块或我的 jar
模块或我的 ear
模块?请注意,这是一个 Maven Web 项目,我从中获得了一个 ear
文件。
我的 java 版本是 1.7
,我已经尝试将 jersey-core-1.17.1
和 jersey-servlet-1.17.1
添加到 war
模块的构建路径,但我仍然似乎遇到了同样的错误。
非常感谢!
您将哪个版本的 JRE 用于 weblogic?
当 JVM 试图加载一个用更高版本的 java 编译的 class 文件时,会发生 "unsupported classversion X.Y." 错误。在这种情况下,51.0 表示他的 class 文件已使用 java 1.7 编译,可能是您的 java 版本 < 1.7。在这种情况下,我看到了两个解决问题的选项
- 使用 java 1.7 或更高版本 运行 weblogic。
- 或者获取与您的 JRE 兼容的 jersey-container-servlet-core jar(以及依赖的 jar,如果有的话)。
当我在 weblogic 管理员控制台上部署 ear
文件时,出现以下错误 -
javax.servlet.ServletException: [HTTP:101249][ServletContext@47518104[app:CorporateActionDatabaseEAR-0 module:/CorporateActionDatabaseWAR path:/CorporateActionDatabaseWAR spec-version:null]]: Servlet class org.glassfish.jersey.servlet.ServletContainer for servlet Jersey Web Application could not be loaded because the requested class was not found in the classpath . java.lang.UnsupportedClassVersionError: org/glassfish/jersey/servlet/ServletContainer : unsupported classversion 51.0.
知道为什么会这样吗?我知道这与添加 jersey-container-servlet-core jar 有关,但我应该将它添加到哪个模块中?我的 war
模块或我的 jar
模块或我的 ear
模块?请注意,这是一个 Maven Web 项目,我从中获得了一个 ear
文件。
我的 java 版本是 1.7
,我已经尝试将 jersey-core-1.17.1
和 jersey-servlet-1.17.1
添加到 war
模块的构建路径,但我仍然似乎遇到了同样的错误。
非常感谢!
您将哪个版本的 JRE 用于 weblogic?
当 JVM 试图加载一个用更高版本的 java 编译的 class 文件时,会发生 "unsupported classversion X.Y." 错误。在这种情况下,51.0 表示他的 class 文件已使用 java 1.7 编译,可能是您的 java 版本 < 1.7。在这种情况下,我看到了两个解决问题的选项
- 使用 java 1.7 或更高版本 运行 weblogic。
- 或者获取与您的 JRE 兼容的 jersey-container-servlet-core jar(以及依赖的 jar,如果有的话)。