I have included a simple application (listings after the error printout) to 
show the problem I am having. Essentially, when I try to use cetain classes as 
method arguments or a return value for methods implemented in a session bean I 
get unkown source in the Client. I keep having the feeling I have missed some 
simple thing in the documentation but I can't find it anywhere. I have searched 
forums and googled the Web but no luck. In the example below the client is 
printing 5 and "This is a String" to show what does work and then the error 
when returning a java.math.BigInteger.

For JBoss I am using the Jems Installer 1.2.0.BETA3

run-client:
     [java] 5
     [java] This is a String
     [java] Exception in thread "main" 
java.lang.reflect.UndeclaredThrowableException
     [java]     at $Proxy0.getBigInteger(Unknown Source)
     [java]     at Client.main(Client.java:14)
     [java] Caused by: java.rmi.MarshalException: Failed to communicate.  
Problem during marshalling/unmarshalling; nested exception is: 
     [java]     java.io.StreamCorruptedException: invalid type code: 07
     [java]     at 
org.jboss.remoting.transport.socket.SocketClientInvoker.transport(SocketClientInvoker.java:306)
     [java]     at 
org.jboss.remoting.RemoteClientInvoker.invoke(RemoteClientInvoker.java:143)
     [java]     at org.jboss.remoting.Client.invoke(Client.java:525)
     [java]     at org.jboss.remoting.Client.invoke(Client.java:488)
     [java]     at 
org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:55)
     [java]     at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
     [java]     at 
org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:61)
     [java]     at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
     [java]     at 
org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:53)
     [java]     at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
     [java]     at 
org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:77)
     [java]     at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
     [java]     at 
org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:102)
     [java]     ... 2 more
     [java] Caused by: java.io.StreamCorruptedException: invalid type code: 07
     [java]     at 
java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1356)
     [java]     at 
java.io.ObjectInputStream.readArray(ObjectInputStream.java:1642)
     [java]     at 
java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1323)
     [java]     at 
java.io.ObjectInputStream.access$300(ObjectInputStream.java:188)
     [java]     at 
java.io.ObjectInputStream$GetFieldImpl.readFields(ObjectInputStream.java:2107)
     [java]     at 
java.io.ObjectInputStream.readFields(ObjectInputStream.java:519)
     [java]     at java.math.BigInteger.readObject(BigInteger.java:3109)
     [java]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     [java]     at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     [java]     at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     [java]     at java.lang.reflect.Method.invoke(Method.java:597)
     [java]     at 
java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:974)
     [java]     at 
java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1846)
     [java]     at 
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
     [java]     at 
java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
     [java]     at 
java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
     [java]     at 
org.jboss.aop.joinpoint.InvocationResponse.readExternal(InvocationResponse.java:122)
     [java]     at 
java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1792)
     [java]     at 
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1751)
     [java]     at 
java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
     [java]     at 
java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1945)
     [java]     at 
java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1869)
     [java]     at 
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
     [java]     at 
java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
     [java]     at 
java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
     [java]     at 
org.jboss.remoting.serialization.impl.java.JavaSerializationManager.receiveObject(JavaSerializationManager.java:128)
     [java]     at 
org.jboss.remoting.marshal.serializable.SerializableUnMarshaller.read(SerializableUnMarshaller.java:66)
     [java]     at 
org.jboss.remoting.transport.socket.SocketClientInvoker.transport(SocketClientInvoker.java:279)
     [java]     ... 14 more

Here is the application code:

import java.math.*;
import javax.ejb.Remote;

@Remote
public interface Session
{
        public int getInt();
        public String getString();
        public BigInteger getBigInteger();
}

===============================================

import java.math.BigInteger;
import javax.ejb.Stateless;

@Stateless
public class SessionBean implements Session
{
   public int getInt()
   {
      return 5;
   }

   public String getString()
   {
      return "This is a String";
   }

   public BigInteger getBigInteger()
   {
        return new BigInteger("7");
   }
}

===============================================

import java.math.*;
import javax.naming.InitialContext;

public class Client
{
   public static void main(String[] args) throws Exception
   {
      InitialContext ctx = new InitialContext();
      Session session = (Session) ctx.lookup("SessionBean/remote");

        System.out.println(session.getInt());
      System.out.println(session.getString());
      System.out.println(session.getBigInteger());
   }
}

Here is the Ant build.xml file:

<?xml version="1.0" encoding="UTF-8"?>



  
  
  

  
  
  
    
  

    <!-- Construct JBoss EJB classpath -->
    
          
          
        
        
        
        
        
        
        
        
        
        
          
        
        
        
        
        
        
    
        
  
    
    
      
    
  

          
            

            
              
                
                
              
            
          

          
            
          

        
            
                
                        
                
            
        




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

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4038910
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to