Skip to Content
0
Former Member
Jul 18, 2005 at 10:00 AM

EJB and XI Mappings in P12 (stackOverflowError)

101 Views

hello,

we have been using the code below to access EJBs from XI mappings (as User Function). In the example we use the SAP sample Calculator EJB.

That code works fine on P11.

However on P12 it throws the exception:

Caused by: java.lang.StackOverflowError

at java.lang.String.getBytes(String.java:590)

at java.io.UnixFileSystem.getBooleanAttributes0(Native Method)

at java.io.UnixFileSystem.getBooleanAttributes(UnixFileSystem.java:221)

at java.io.File.exists(File.java:680)

at sun.misc.URLClassPath$FileLoader.getResource(URLClassPath.java:887)

at sun.misc.URLClassPath.getResource(URLClassPath.java:157)

at java.net.URLClassLoader$1.run(URLClassLoader.java:191)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(URLClassLoader.java:187)

at java.lang.ClassLoader.loadClass(ClassLoader.java:289)

at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)

at java.lang.ClassLoader.loadClass(ClassLoader.java:235)

at com.sap.engine.boot.FrameClassLoader.loadClass(FrameClassLoader.java:97)

at com.sap.engine.boot.FrameClassLoader.loadClass(FrameClassLoader.java:87)

at com.sap.engine.frame.core.load.ResourceLoader.loadClass(ResourceLoader.java:127)

at java.lang.ClassLoader.loadClass(ClassLoader.java:282)

at java.lang.ClassLoader.loadClass(ClassLoader.java:235)

at java.util.ResourceBundle.loadBundle(ResourceBundle.java:1058)

.....

is anybody else using EJBs in XI Mappings?

thanks

Marcos Sola

-


Java code in User Function is:

ClassLoader old_context_classloader = Thread.currentThread().getContextClassLoader();

try {

Thread.currentThread().setContextClassLoader(com.sap.examples.calculator.CalculatorHome.class.getClassLoader() );

// get calculator bean and execute multiply method

InitialContext ctx = new InitialContext();

Object ob = ctx.lookup("sap.com/CalculatorEar/CalculatorBean");

com.sap.examples.calculator.CalculatorHome calcHome=(com.sap.examples.calculator.CalculatorHome) javax.rmi.PortableRemoteObject.narrow(ob,com.sap.examples.calculator.CalculatorHome.class);

com.sap.examples.calculator.Calculator calc=calcHome.create();

return ""+calc.multiply(3,4); // result should be 3*4 = 12

}

catch (Exception e){

throw new RuntimeException(e);

}

finally {

Thread.currentThread().setContextClassLoader( old_context_classloader );

}