• Post Reply Bookmark Topic Watch Topic
  • New Topic

Mikalai Zaikin SCBCD5.0 example problem  RSS feed

 
anshul bhatt
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

i am facing the following exception whenever i try to run the first sample program

tools used are:
eclipse3.2.1
jboss 4.0
jre 1.5

i have deployed the jar file calculator.jar and i am able to see it in jmx console,service =jndiview, javalangstring list, global jndi namespace still getting the following error while running client

Exception in thread "main" java.lang.RuntimeException: Could not resolve beanClass method from proxy call
at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:199)
at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:828)
at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:681)
at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:358)
at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:398)
at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:239)
at org.jboss.remoting.RemoteClientInvoker.invoke(RemoteClientInvoker.java:190)
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:65)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:102)
at $Proxy0.add(Unknown Source)
at by.iba.client.CalculatorClient.main(CalculatorClient.java:22)

CODE:

package by.iba.client;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.rmi.PortableRemoteObject;

import by.iba.ejb.StatelessCalculator;

public class CalculatorClient {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
try
{
Context jndiContext=new InitialContext();
Object ref=jndiContext.lookup("StatelessCalculatorBean/remote");
StatelessCalculator calc=(StatelessCalculator)PortableRemoteObject.narrow(ref,StatelessCalculator.class);
System.out.println("4+3="+ calc.add(4,3));
System.out.println("4+3="+ calc.multiply(4,3));
System.out.println("4+3="+ calc.subtract(4,3));
System.out.println("4+3="+ calc.divide(4,3));
}catch(NamingException ne){
ne.printStackTrace();
}
}
}

---------------------------------------------------------------------------------------------------------------

package by.iba.ejb;

import javax.ejb.Remote;

@Remote
public interface StatelessCalculator {
public double add(double a, double b);

public double subtract(double a, double b);

public double divide(double a, double b);

public double multiply(double a, double b);
}
---------------------------------------------------------------

package by.iba.ejb;

import javax.ejb.Stateless;
import by.iba.ejb.StatelessCalculator;

public @Stateless class StatelessCalculatorBean implements StatelessCalculator {

public double add(double a, double b) {
// TODO Auto-generated method stub
return a+b;
}

public double divide(double a, double b) {
// TODO Auto-generated method stub
if(b==0.0){
throw new javax.ejb.EJBException("Divided by zer0");
}

return a/b;
}

public double multiply(double a, double b) {
// TODO Auto-generated method stub
return a*b;
}

public double subtract(double a, double b) {
// TODO Auto-generated method stub
return a-b;
}

}

please reply as soon as possible as i feel stuck have checked so many times
cannot resolve by myself

Thanks
 
aleem khan
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Some where i read this in forum, jboss 4 doesn't support EJB 3.0 , need to go for Jboss 5 or go for sun's glassfish...not sure though you may try
 
anshul bhatt
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

I was able to resolve the issue, yes you are quite right jboss4.0 doesnt support ejb3.0, however you can instali jemsinstaller made for the the particular server to make it compatible with ejb 3.0, coming back to the main issue that was completely my fault
i was using jboss 4.0.4 and jems installer designed for jboss as 4.0.5, different versions of jre were also causing the issue.

Thanks
SCJP(1.4)
SCWCD
 
aleem khan
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!