jar 的 SAP JBOSS 问题 [英] SAP JBOSS issues with jar

查看:17
本文介绍了jar 的 SAP JBOSS 问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 ABAP 函数调用将我的 j2ee 应用程序与 SAP 连接.当我使用热编码值在 Eclipse 中将它作为单个类运行时,它工作正常.当我尝试在 JBoss 服务器中运行它时,我从前端获取一些值并将其传递给我之前提到的同一个类的 java 类,它显示以下异常

I am trying to connect my j2ee application with SAP using ABAP function calls. When I run it as a single class in eclipse with hot coded values , it works fine. When I try to run it in JBoss server , where I am getting some values from my front end and passing it to my java class which is the same class I referred before, it shows this following exception

java.lang.NoClassDefFoundError: com/sap/conn/jco/JCoException
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.privateGetPublicMethods(Unknown Source)
at java.lang.Class.getMethods(Unknown Source)
at org.jboss.aop.ClassContainer.createMethodMap(ClassContainer.java:182)


09:35:42,326 INFO  [EARDeployer] Started J2EE application: file:/F:/jboss/jboss-         4.2.3.GA/server/default/deploy/MPCS.ear
09:35:42,326 ERROR [URLDeploymentScanner] Incomplete Deployment listing:

--- MBeans waiting for other MBeans ---
ObjectName: jboss.j2ee:service=EJB3,module=MPCS.jar
 State: FAILED
 Reason: java.lang.NoClassDefFoundError: com/sap/conn/jco/JCoException

--- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
ObjectName: jboss.j2ee:service=EJB3,module=MPCS.jar
State: FAILED
Reason: java.lang.NoClassDefFoundError: com/sap/conn/jco/JCoException

我在 F:/jar 中有我的 sapjco3.jar,我也有 ejb3-persistence.jar、jboss-ejb3x.jar 等,它们被正确识别.我也在构建路径中添加了 jar.但没有任何帮助.

I have my sapjco3.jar in F:/jar where I also have ejb3-persistence.jar, jboss-ejb3x.jar etc and they are properly recognized. I have added the jar in build path also. But nothing helps.

推荐答案

在 EJB 中使用 sapjco3.jar 中的类(用 @Singleton 和 @Startup 注释)时,我遇到了与 JBoss EAP 6.1 中的 NoClassDefFoundError 类似的问题.除此之外,我还收到一条错误消息,说在重新发布到 EAP 或重新启动部署的模块时,本机库已加载到另一个类加载器中.

I had a similar problem with the NoClassDefFoundError in JBoss EAP 6.1 when using classes from sapjco3.jar in an EJB (annotated with @Singleton and @Startup). Besides that I also received an error saying that the native library was already loaded in another classloader when republishing to EAP or restarting the deployed module.

我对这两个问题的解决方案是将 sapjco3.jar 作为全局 JBoss 模块包含进来.

My solution to both problems was to include sapjco3.jar as a global JBoss module.

我在 EAPS 的 modules 文件夹中创建了以下结构:

I created the following structure inside EAPS's modules folder:

com
--> sap
    --> conn
        --> jco
            --> main
                --> module.xml
                --> sapjco3.jar

module.xml的内容:

<?xml version="1.0" encoding="UTF-8"?>
   <module xmlns="urn:jboss:module:1.0" name="com.sap.conn.jco">
   <resources>
      <resource-root path="sapjco3.jar"/>
   </resources>
</module>

步骤 2

standalone.xml 中将模块添加为全局模块:

Step 2

Adding the module as a global module in standalone.xml:

<subsystem xmlns="urn:jboss:domain:ee:1.1">
   ... 
   <global-modules>
       <module name="com.sap.conn.jco" />
   </global-modules>
   ...
</subsystem>

步骤 3

在 EJB 项目 META-INF 中创建或编辑文件 jboss-deployment-structure.xml 以包含模块.我的文件看起来像这样:

Step 3

Create or edit file jboss-deployment-structure.xml inside EJB projects META-INF to contain the module. My file looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
   <deployment>
      <dependencies>
         <module name="com.sap.conn.jco" export="TRUE" />
      </dependencies>
   </deployment>
</jboss-deployment-structure>

步骤 4

将 Maven 依赖项配置为 provided 范围,以便我们可以在工作区中使用 sapjco3.jar,但不能在部署中使用它.

Step 4

Configure Maven dependency as scope provided, so that we can work with sapjco3.jar inside the workspace but not have it inside the deployment.

<dependency>
   <groupId>com.sap.conn.jco</groupId>
   <artifactId>sapjco3</artifactId>
   <version>3.0.10</version>
   <scope>provided</scope>
</dependency>

到目前为止,我记得这就是让它工作的内容,也许这对您或其他任何人都有帮助.

That is what I recall so far to make it work, maybe this is helpful for you or anybody else.

这篇关于jar 的 SAP JBOSS 问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆