G
guest
Gast
Hallo Zusammen,
ich hätte da ein Problem. Ich versuche zurzeit über eine Client Anwendung eine Methode aus einer EJB aufzurufen die mir ein ArrayList zurückgeben soll.
Bekomme dabei aber immer eine NotSerializable Exception. Weiß jemand von euch vielleicht woran das liegt?
Bei der Methode die mir einen String zurückliefert funktioniert das nämlich alles einwandfrei.
Hier der Quellcode für den Aufruf der EJB:
try {
// Create a new intial context, which loads from jndi.properties file.
String contextFactory = "com.sap.engine.services.jndi.InitialContextFactoryImpl";
System.out.println ("contextfactory" + contextFactory );
Properties properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, contextFactory);
//properties.put("force_remote", "true");
properties.put(Context.PROVIDER_URL, "server_url");
properties.put(Context.SECURITY_PRINCIPAL, "user");
properties.put(Context.SECURITY_CREDENTIALS, "password");
Context ctx = new InitialContext(properties);
// Look up the home interface using the JNDI name.
// This JNDI lookup returns a reference to an EJBHome instance.
TestHome home = (TestHome) ctx.lookup("TestWorldEar/TestBean");
// Create a session object.
remote = home.create();
// Invoke the remote EJB methods, test and debug.
System.out.println("Result1:" + remote.getWert()); //String
***Hier tritt die NotSerializable Exception auf *****
System.out.println("Result2:" + remote.getMessage()); //ArrayList
} catch (Exception e) {
System.out.println("Exception: " + e.getLocalizedMessage());
}
Danke für alle Antworten im Voraus!!!
ich hätte da ein Problem. Ich versuche zurzeit über eine Client Anwendung eine Methode aus einer EJB aufzurufen die mir ein ArrayList zurückgeben soll.
Bekomme dabei aber immer eine NotSerializable Exception. Weiß jemand von euch vielleicht woran das liegt?
Bei der Methode die mir einen String zurückliefert funktioniert das nämlich alles einwandfrei.
Hier der Quellcode für den Aufruf der EJB:
try {
// Create a new intial context, which loads from jndi.properties file.
String contextFactory = "com.sap.engine.services.jndi.InitialContextFactoryImpl";
System.out.println ("contextfactory" + contextFactory );
Properties properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, contextFactory);
//properties.put("force_remote", "true");
properties.put(Context.PROVIDER_URL, "server_url");
properties.put(Context.SECURITY_PRINCIPAL, "user");
properties.put(Context.SECURITY_CREDENTIALS, "password");
Context ctx = new InitialContext(properties);
// Look up the home interface using the JNDI name.
// This JNDI lookup returns a reference to an EJBHome instance.
TestHome home = (TestHome) ctx.lookup("TestWorldEar/TestBean");
// Create a session object.
remote = home.create();
// Invoke the remote EJB methods, test and debug.
System.out.println("Result1:" + remote.getWert()); //String
***Hier tritt die NotSerializable Exception auf *****
System.out.println("Result2:" + remote.getMessage()); //ArrayList
} catch (Exception e) {
System.out.println("Exception: " + e.getLocalizedMessage());
}
Danke für alle Antworten im Voraus!!!