SAP JBOSS与jar有关 [英] SAP JBOSS issues with jar

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

问题描述

我正在尝试使用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.

推荐答案

在使用sapjco3.jar中的类时,JBoss EAP 6.1中的NoClassDefFoundError遇到了类似的问题EJB(使用@Singleton和@Startup注释)。
除此之外,我还收到一条错误消息,说当重新发布到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 中的全局模块:

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



第3步



创建或编辑文件EJB项目中的 jboss-deployment-structure.xml 包含模块的META-INF。
我的文件如下所示:

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依赖关系配置为范围提供,以便我们可以在工作区内使用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.

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

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