java - Exceptions with EJB3 -
i using method in session bean surrounded try , catch bloc ioexception , looks making problem when try call method java project client here bean code
package com.et; import com.gestionfichier.gestion.*; import java.io.ioexception; import javax.ejb.applicationexception; import javax.ejb.stateless; @stateless public class premierejb3bean implements premierejb3 { public string envoicode(string code) { string s = null; try { s = gestionfichier.copiercode(code); } catch (ioexception e) { e.printstacktrace(); } compilerfichierc.compilerfichier(s,s); return "compilation réussie !"; } }
and here client bean code:
package com.et; import javax.naming.context; import javax.naming.initialcontext; import javax.naming.namingexception; public class premierejb3client { public static void main(string[] args) { try { context context = new initialcontext(); premierejb3 beanremote = (premierejb3) context.lookup("premierejb3bean/remote"); system.out.println(beanremote.envoicode("somthing")); } catch (namingexception e) { e.printstacktrace(); } } }
and here in console
exception in thread "main" java.lang.reflect.undeclaredthrowableexception @ $proxy0.envoicode(unknown source) @ com.et.premierejb3client.main(premierejb3client.java:15) caused by: java.lang.classnotfoundexception: [ljava.lang.stacktraceelement; @ java.net.urlclassloader$1.run(unknown source) @ java.net.urlclassloader$1.run(unknown source) @ java.security.accesscontroller.doprivileged(native method) @ java.net.urlclassloader.findclass(unknown source) @ java.lang.classloader.loadclass(unknown source) @ sun.misc.launcher$appclassloader.loadclass(unknown source) @ java.lang.classloader.loadclass(unknown source) , more....
so quiet sure exceptions in bean causing me problem have no idea how fix
in order jndi lookup ejb standalone client, context properties needs added.
something similar below.
hashtable<string, string> ht = new hashtable<string, string>(); ht.put(context.initial_context_factory, "weblogic.jndi.wlinitialcontextfactory"); context ct=new initialcontext(ht);
Comments
Post a Comment