Hi, please give me help with this problem, i dont know what is the solution

I have this simple session bean deploy in a jboss 4.0.5 GA application server

My interface:


  | package server.ejb.usuarios;
  | 
  | import javax.ejb.Remote;
  | 
  | @Remote
  | public interface Prueba {
  |     public void getError() throws Exception;
  | }
  | 

My Session bean implementation:

  | package server.ejb.usuarios;
  | 
  | import javax.ejb.Stateless;
  | import server.ejb.usuarios.Prueba;
  | 
  | public @Stateless class PruebaBean implements Prueba {
  | 
  |     public void getError() throws Exception {
  |             throw new Exception("Mensaje de error");
  |     }
  |     
  | }
  | 

Simple, i can deploy this bean on my application server, now i have this client 
code:

  | package clientold;
  | 
  | import java.util.Properties;
  | 
  | import javax.naming.Context;
  | import javax.naming.InitialContext;
  | import javax.naming.NamingException;
  | 
  | import server.ejb.usuarios.Prueba;
  | 
  | public class MainPruebaError {
  | 
  |     /**
  |      * @param args
  |      */
  |     public static void main(String[] args) {
  |             Context ctx;
  |             try {
  |                     ctx = getInitialContext();
  |                     Prueba pruebaSession = (Prueba) 
ctx.lookup("PruebaBean/remote"); 
  |                     pruebaSession.getError();
  |             } catch (NamingException e) {
  |                     // TODO Auto-generated catch block
  |                     e.printStackTrace();
  |             } catch(Exception e){
  |                     System.out.println("Get error from server: " + 
e.getMessage());
  |                     e.printStackTrace();
  |             }
  |     }
  | 
  |     private static Context getInitialContext() throws NamingException {
  |             Properties prop = new Properties();
  |             prop.setProperty("java.naming.factory.initial",
  |                             "org.jnp.interfaces.NamingContextFactory");
  |             prop.setProperty("java.naming.provider.url", "127.0.0.1:1099");
  |             prop.setProperty("java.naming.factory.url.pkgs", 
"org.jboss.naming");
  | 
  |             return (new InitialContext(prop));
  |     }
  | }
  | 

and my client catch the exception but i canĀ“t get the correct exception 
message. I need pass custom message from my server to my clients and wrap it in 
a exception, but when i run this example got the next output:

  | Get error from server: [Ljava.lang.StackTraceElement;
  | java.lang.ClassNotFoundException: [Ljava.lang.StackTraceElement;
  |     at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
  |     at java.security.AccessController.doPrivileged(Native Method)
  |     at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
  |     at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
  |     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
  |     at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
  |     at 
org.jboss.remoting.loading.RemotingClassLoader.loadClass(RemotingClassLoader.java:50)
  |     at 
org.jboss.remoting.loading.ObjectInputStreamWithClassLoader.resolveClass(ObjectInputStreamWithClassLoader.java:139)
  |     at 
java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1575)
  |     at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496)
  |     at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1624)
  |     at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1323)
  |     at 
java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1945)
  |     at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1869)
  |     at 
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
  |     at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
  |     at 
java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1945)
  |     at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1869)
  |     at 
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
  |     at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
  |     at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
  |     at 
org.jboss.remoting.serialization.impl.java.JavaSerializationManager.receiveObject(JavaSerializationManager.java:128)
  |     at 
org.jboss.remoting.marshal.serializable.SerializableUnMarshaller.read(SerializableUnMarshaller.java:66)
  |     at 
org.jboss.remoting.transport.socket.SocketClientInvoker.transport(SocketClientInvoker.java:279)
  |     at 
org.jboss.remoting.RemoteClientInvoker.invoke(RemoteClientInvoker.java:143)
  |     at org.jboss.remoting.Client.invoke(Client.java:525)
  |     at org.jboss.remoting.Client.invoke(Client.java:488)
  |     at 
org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:41)
  |     at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
  |     at 
org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:46)
  |     at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
  |     at 
org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:40)
  |     at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
  |     at 
org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:77)
  |     at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
  |     at 
org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:102)
  |     at $Proxy0.getError(Unknown Source)
  |     at clientold.MainPruebaError.main(MainPruebaError.java:21)
  | 

What is the problem??, i must see on the output

  | Get error from server: Mensaje de error
  | 

but i have :

  | Get error from server: [Ljava.lang.StackTraceElement;
  | 

why???, is only a simple application exception and don,t work, somebody can 
help me??

i have tried to use an interceptor class for get the exceptions and work, but 
without interceptor, dont work

thanks

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4045693#4045693

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4045693

_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to