Rational Application Developer (RAD) 7.5+并且 websphere 运行时不会从项目中获取 jar

发布于 2024-08-23 16:16:23 字数 3164 浏览 4 评论 0原文

RAD 版本:7.5.3,Java 1.5。

我有几个不同的项目。我需要分解 java 代码并将 *.class 文件转换为 jar。所以基本上,相同的 *.class 文件我只是删除了代码,然后将类文件打包到 jar 中。

我将这些类分成一个 jar,然后将该 jar 包含在项目中。我还对 jar 进行了订购/导出,以便其他项目可以看到该 jar。

此时,理想情况下我的项目不应更改,因为我使用的是 jar 中的类文件而不是 java 代码。

当我在 websphere 中访问我的 Web 应用程序时,我在 jar 中的类上收到“未找到类”错误。

项目结构:

A. Project earApp  -- will need the webapp
B. Project webapp  -- will need the project (no jar files or *.java files are found in this project)
C. Project javasrc -- the java source and the NEW JAR file are found here.

我认为 websphere 不承认该 jar。

这是错误:

java.lang.NoClassDefFoundError: com.MyApp
 at java.lang.ClassLoader.defineClassImpl(Native Method)
 at java.lang.ClassLoader.defineClass(ClassLoader.java:258)
 at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:151)
 at com.ibm.ws.classloader.CompoundClassLoader._defineClass(CompoundClassLoader.java:675)
 at com.ibm.ws.classloader.CompoundClassLoader.findClass(CompoundClassLoader.java:614)
 at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:431)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:597)
 at java.lang.Class.getDeclaredMethodsImpl(Native Method)
 at java.lang.Class.getDeclaredMethods(Class.java:664)
 at com.ibm.ws.webcontainer.annotation.data.ScannedAnnotationData.collectMethodAnnotations(ScannedAnnotationData.java:130)
 at com.ibm.ws.webcontainer.annotation.data.ScannedAnnotationData.<init>(ScannedAnnotationData.java:47)
 at com.ibm.ws.webcontainer.annotation.AnnotationScanner.scanClass(AnnotationScanner.java:61)
 at com.ibm.ws.wswebcontainer.webapp.WebApp.processRuntimeAnnotationHelpers(WebApp.java:711)
 at com.ibm.ws.wswebcontainer.webapp.WebApp.populateJavaNameSpace(WebApp.java:624)
 at com.ibm.ws.wswebcontainer.webapp.WebApp.initialize(WebApp.java:289)
 at com.ibm.ws.wswebcontainer.webapp.WebGroup.addWebApplication(WebGroup.java:93)
 at com.ibm.ws.wswebcontainer.VirtualHost.addWebApplication(VirtualHost.java:162)
 at com.ibm.ws.wswebcontainer.WebContainer.addWebApp(WebContainer.java:671)
 at com.ibm.ws.wswebcontainer.WebContainer.addWebApplication(WebContainer.java:624)
 at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:395)
 at com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:611)
 at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1274)
 at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:1165)
 at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:587)
 at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:832)
 at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:921)
 at com.ibm.ws.runtime.component.ApplicationMgrImpl$AppInitializer.run(ApplicationMgrImpl.java:2124)
 at com.ibm.wsspi.runtime.component.WsComponentImpl$_AsynchInitializer.run(WsComponentImpl.java:342)
 at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1497)

你认为我需要做什么?

With RAD Version: 7.5.3, Java 1.5.

I have a couple of different projects. I needed to break out the java code and turn the *.class files into a jar. So basically, same *.class files I just removed the code and then jarred the class files into a jar.

I broke the classes into a jar and then included the jar in the project. And I also did an order/export on the jar so that other projects can see the jar.

At this point, ideally my project should not have changed because I am using class files in a jar instead of the java code.

When I visit my web application in websphere, I get class not found errors on the classes that are now in the jar.

Project Structure:

A. Project earApp  -- will need the webapp
B. Project webapp  -- will need the project (no jar files or *.java files are found in this project)
C. Project javasrc -- the java source and the NEW JAR file are found here.

I don't think websphere is acknowledging the jar.

Here is the error:

java.lang.NoClassDefFoundError: com.MyApp
 at java.lang.ClassLoader.defineClassImpl(Native Method)
 at java.lang.ClassLoader.defineClass(ClassLoader.java:258)
 at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:151)
 at com.ibm.ws.classloader.CompoundClassLoader._defineClass(CompoundClassLoader.java:675)
 at com.ibm.ws.classloader.CompoundClassLoader.findClass(CompoundClassLoader.java:614)
 at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:431)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:597)
 at java.lang.Class.getDeclaredMethodsImpl(Native Method)
 at java.lang.Class.getDeclaredMethods(Class.java:664)
 at com.ibm.ws.webcontainer.annotation.data.ScannedAnnotationData.collectMethodAnnotations(ScannedAnnotationData.java:130)
 at com.ibm.ws.webcontainer.annotation.data.ScannedAnnotationData.<init>(ScannedAnnotationData.java:47)
 at com.ibm.ws.webcontainer.annotation.AnnotationScanner.scanClass(AnnotationScanner.java:61)
 at com.ibm.ws.wswebcontainer.webapp.WebApp.processRuntimeAnnotationHelpers(WebApp.java:711)
 at com.ibm.ws.wswebcontainer.webapp.WebApp.populateJavaNameSpace(WebApp.java:624)
 at com.ibm.ws.wswebcontainer.webapp.WebApp.initialize(WebApp.java:289)
 at com.ibm.ws.wswebcontainer.webapp.WebGroup.addWebApplication(WebGroup.java:93)
 at com.ibm.ws.wswebcontainer.VirtualHost.addWebApplication(VirtualHost.java:162)
 at com.ibm.ws.wswebcontainer.WebContainer.addWebApp(WebContainer.java:671)
 at com.ibm.ws.wswebcontainer.WebContainer.addWebApplication(WebContainer.java:624)
 at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:395)
 at com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:611)
 at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1274)
 at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:1165)
 at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:587)
 at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:832)
 at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:921)
 at com.ibm.ws.runtime.component.ApplicationMgrImpl$AppInitializer.run(ApplicationMgrImpl.java:2124)
 at com.ibm.wsspi.runtime.component.WsComponentImpl$_AsynchInitializer.run(WsComponentImpl.java:342)
 at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1497)

What do you think I need to do?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

静谧幽蓝 2024-08-30 16:16:23

当我们升级到 WAS 7.0 时,我们遇到了同样的问题。

显然,WAS 7.0 改变了查找依赖项的方式,您需要确保您正在创建的 JAR 文件也在使用它们的清单文件中提及。

因此,如果您在 EJB 和 Web 项目中都使用它,则需要更新这两个清单文件以引用 JAR。

We have had the same problem when we upgraded to WAS 7.0

Apparently WAS 7.0 changed how it looks up its dependencies, and you need to make sure the JAR files you are creating are also mentioned in the manifest file where they are used.

So if you're using it in both the EJB and Web project, you will need to update both of the manifest files to reference the JAR.

南…巷孤猫 2024-08-30 16:16:23

您是否将 jar 添加到项目属性对话框中的 Java EE 模块依赖项中?该 jar 是否列在包资源管理器中的 EAR 或 Web Libraries 节点下?

did you add the jar to the Java EE module dependencies in the project properties dialog? is the jar listed under EAR or Web Libraries node in the package explorer?

长途伴 2024-08-30 16:16:23

我遇到了同样的问题,直到我将 jar 复制到 WebContent/WEB-INF/lib 为止。你可以试试这个。

I had the same problem until I copied the jar to WebContent/WEB-INF/lib. You could try this.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文