cancel
Showing results for 
Search instead for 
Did you mean: 

resource in jar loading problem in udf

Former Member
0 Kudos

Hi,

I am trying to use the apache xml Canonicalizer class to canonicalize some xml from within a user-defined function. When I try to initialize the apache security package by calling the org.apache.xml.security.Init.init(); method I get errors that the XI server cannot load the resource bundles which are packaged in the xmlsec-1.3.0.jar. I have included the xmlsec-1.3.0.jar in the Imported Archives.

I know there are some restrictions when writing java code for mapping. (http://help.sap.com/saphelp_nw04/helpdata/en/bd/c91241c738f423e10000000a155106/frameset.htm). Is there another way to call this code?

Any help would be appreciated.

The error I am getting is:-

Class not found: org/apache/xml/security/resource/xmlsecurity

com.sap.aii.ibrun.server.mapping.persist.ResourceNotFoundException: Unable to find resource org/apache/xml/security/resource/xmlsecurity.class (http://esb.ie/file2SOAP, bbdc7f60-e11e-11db-b40e-e1f10a46d441, -1) at com.sap.aii.ibrun.server.mapping.persist.DBSwcvMappingPersistor.getInputStream(DBSwcvMappingPersistor.java:325) at com.sap.aii.ibrun.server.mapping.persist.DBSwcvMappingPersistor.readFile(DBSwcvMappingPersistor.java:203) at com.sap.aii.ibrun.server.mapping.persist.DBSwcvMappingPersistor.readClass(DBSwcvMappingPersistor.java:195) at com.sap.aii.ibrun.server.mapping.MappingLoader.findClass(MappingLoader.java:138) at java.lang.ClassLoader.loadClass(ClassLoader.java:590) at java.lang.ClassLoader.loadClass(ClassLoader.java:556) at java.util.ResourceBundle.loadBundle(ResourceBundle.java:1030) at java.util.ResourceBundle.findBundle(ResourceBundle.java:907) at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:732) at java.util.ResourceBundle.getBundle(ResourceBundle.java:559) at org.apache.xml.security.utils.I18n.initLocale(Unknown Source) at org.apache.xml.security.utils.I18n.init(Unknown Source) at org.apache.xml.security.Init.init(Unknown Source) at ie.esb.its.Security.<init>(Security.java:77) at ie.esb.its.Security.getInstance(Security.java:58) at com.sap.xi.tf._javaTest2_.testf2$(_javaTest2_.java:66) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60) at java.lang.reflect.Method.invoke(Method.java:391) at com.sap.aii.mappingtool.tf3.rt.C2CFunctionWrapper.cacheContext(C2CFunctionWrapper.java:90) at com.sap.aii.mappingtool.tf3.rt.C2CFunctionWrapper.gotoNextContext(C2CFunctionWrapper.java:46) at com.sap.aii.mappingtool.tf3.AMappingProgram.processNode(AMappingProgram.java:249) at com.sap.aii.mappingtool.tf3.AMappingProgram.processNode(AMappingProgram.java:309) at com.sap.aii.mappingtool.tf3.AMappingProgram.start(AMappingProgram.java:398) at com.sap.aii.mappingtool.tf3.Transformer.start(Transformer.java:141) at com.sap.aii.mappingtool.tf3.AMappingProgram.execute(AMappingProgram.java:102) at com.sap.aii.ibrun.server.mapping.JavaMapping.executeStep(JavaMapping.java:64) at com.sap.aii.ibrun.server.mapping.Mapping.execute(Mapping.java:91) at com.sap.aii.ibrun.server.mapping.MappingHandler.run(MappingHandler.java:90) at com.sap.aii.ibrun.sbeans.mapping.MappingRequestHandler.handleMappingRequest(MappingRequestHandler.java:95) at com.sap.aii.ibrun.sbeans.mapping.MappingRequestHandler.handleRequest(MappingRequestHandler.java:68) at com.sap.aii.ibrun.sbeans.mapping.MappingServiceImpl.processFunction(MappingServiceImpl.java:79) at com.sap.aii.ibrun.sbeans.mapping.MappingServiceObjectImpl0.processFunction(MappingServiceObjectImpl0.java:131) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60) at java.lang.reflect.Method.invoke(Method.java:391) at com.sap.engine.services.ejb.session.stateless_sp5.ObjectStubProxyImpl.invoke(ObjectStubProxyImpl.java:187) at $Proxy196.processFunction(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60) at java.lang.reflect.Method.invoke(Method.java:391) at com.sap.engine.services.rfcengine.RFCDefaultRequestHandler.call(RFCDefaultRequestHandler.java:219) at com.sap.engine.services.rfcengine.RFCDefaultRequestHandler.handleRequest(RFCDefaultRequestHandler.java:169) at com.sap.engine.services.rfcengine.RFCJCOServer.handleRequest(RFCJCOServer.java:156) at com.sap.mw.jco.JCO$Server.dispatchRequest(JCO.java:7701) at com.sap.mw.jco.MiddlewareJRfc$Server.dispatchRequest(MiddlewareJRfc.java:2376) at com.sap.mw.jco.MiddlewareJRfc$Server.listen(MiddlewareJRfc.java:1700) at com.sap.mw.jco.JCO$Server.listen(JCO.java:8061) at com.sap.mw.jco.JCO$Server.work(JCO.java:8181) at com.sap.mw.jco.JCO$Server.loop(JCO.java:8128) at com.sap.mw.jco.JCO$Server.run(JCO.java:8044) at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37) at java.security.AccessController.doPrivileged(AccessController.java:215) at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100) at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:124)

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

I added the code to a user module and it runs fine. I think code run from a UDF runs in a restricted environment and isn't run in an application-wide context.

Former Member
0 Kudos

I have specified the import correctly in the UDF and loaded dependant jars correctly in Imported Archives.

I think it is an XI container-specific issue - possibly to do with ClassLoader.

The code instantiates the security package correctly if I run the same code as a standalone application with the same JRE that XI uses.

henrique_pinto
Active Contributor
0 Kudos

From the link you have provided:

&#9679; Do not load a JDBC driver to use them directly. Instead, use the mapping lookup API (see: Mapping Lookups), or the JDBC Connector Service in the SAP J2EE Engine.

&#9679; Do not use the package java.io to write directly to files, or use it to read directly from files.

<b>&#9679; Do not use a class loader in your classes.</b>

&#9679; Within a Java mapping program, do not call java.lang.System.exit() or java.lang.System.setProperties().

&#9679; Do not create or use any threads.

&#9679; Do not use any network sockets.

I guess it won't be able to do this.

Probably you could deploy a application and consume its service.

Regards,

Henrique.

Former Member
0 Kudos

Hi,

In general , when we have such type of requirements , we will create a package and make jar and import it under imported archievs and inUDF , we will refer in Imports.

Messsage mapping functionality - http://help.sap.com/bp_bpmv130/Documentation/Operation/MappingXI30.pdf

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/d046c490-0201-0010-84b6-9df523cb...

Regards

Chilla

Former Member
0 Kudos

Hello,

Please try to import from package level, I mean package/class into your imported archives and you will not have this problem

Regards,

Former Member
0 Kudos

see in ur Imported Archives whether org/apache/xml/security/resource/xmlsecurity class is there or not....

if not remort the jar..

henrique_pinto
Active Contributor
0 Kudos

Have you imported the proper classes in your UDF?

Regards,

Henrique.