Hi,
I'm having some problems running a simple ejb client program.
JBoss: 4.0.0
Red Hat Linux 7.x, Linux 2.4.19 (i386)
We receive the following output...
| Obtained JNDI Context...
| Obtained Object Reference...
| Exception in thread "main" java.lang.IllegalStateException:
| Failed to find method for hash:6090549741276665905 available mappings:
| {4121927297169232143=public abstract void
javax.ejb.EJBHome.remove(javax.ejb.Handle)
| throws java.rmi.RemoteException,javax.ejb.RemoveException,
-8220990928542008427=public abstract itmp.interest.InterestRemote
| itmp.interest.InterestRemoteHome.create() throws
java.rmi.RemoteException,javax.ejb.CreateException,
| -7423251857241384719=public abstract void
javax.ejb.EJBHome.remove(java.lang.Object) throws java.rmi.RemoteException,
| javax.ejb.RemoveException, 7415355246179212884=public abstract boolean
javax.ejb.EJBObject.isIdentical(javax.ejb.EJBObject)
| throws java.rmi.RemoteException, 8981122088959051067=public abstract
javax.ejb.HomeHandle javax.ejb.EJBHome.getHomeHandle()
| throws java.rmi.RemoteException, -1225864925247205563=public abstract void
javax.ejb.EJBObject.remove()
| throws java.rmi.RemoteException,javax.ejb.RemoveException,
-883843542736932254=public abstract java.lang.Object
| javax.ejb.EJBObject.getPrimaryKey() throws java.rmi.RemoteException,
4512095171315154818=public abstract
| javax.ejb.EJBHome javax.ejb.EJBObject.getEJBHome() throws
java.rmi.RemoteException, 3781219857755091396=public
| abstract javax.ejb.EJBMetaData javax.ejb.EJBHome.getEJBMetaData() throws
java.rmi.RemoteException, -3260590760910195779=
| public abstract javax.ejb.Handle javax.ejb.EJBObject.getHandle() throws
java.rmi.RemoteException, -8289334516425189948=
| public abstract double
itmp.interest.InterestRemote.calculateCompoundInterest(double,double,double)
| throws java.rmi.RemoteException, 8594593460157411074=public abstract
javax.ejb.EJBObject javax.ejb.Handle.getEJBObject()
| throws java.rmi.RemoteException} at
org.jboss.invocation.MarshalledInvocation.getMethod(MarshalledInvocation.java:297)
|
| at org.jboss.ejb.Container.invoke(Container.java:852)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:324)
| at
org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
| at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
| at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:242)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
| at
org.jboss.invocation.jrmp.server.JRMPInvoker$MBeanServerAction.invoke(JRMPInvoker.java:775)
| at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:382)
| at sun.reflect.GeneratedMethodAccessor97.invoke(Unknown Source)
| at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:324)
| at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
| at sun.rmi.transport.Transport$1.run(Transport.java:148)
| at java.security.AccessController.doPrivileged(Native Method)
| at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
| at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
| at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
| at java.lang.Thread.run(Thread.java:534)
| at
sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
| at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
| at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133)
| at org.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke(Unknown Source)
| at
org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProxy.java:118)
| at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:96)
| at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46)
| at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:55)
| at
org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:97)
| at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:86)
| at $Proxy1.foo(Unknown Source)
| at InterestClient.main(InterestClient.java:46)
|
occurs when running the client
| import java.rmi.RemoteException;
| import java.util.Hashtable;
|
| import javax.ejb.CreateException;
| import javax.naming.InitialContext;
| import javax.naming.NamingException;
| import javax.rmi.PortableRemoteObject;
|
| import itmp.interest.*;
|
| class InterestClient
| {
| public static void main(String[] args)
| {
| System.setProperty("java.naming.factory.initial",
"org.jnp.interfaces.NamingContextFactory");
| System.setProperty("java.naming.provider.url", "localhost:1099");
|
| Object reference = null;
|
| try
| {
| InitialContext jndiContext = new InitialContext();
|
| System.out.println("Obtained JNDI Context...");
|
| reference = jndiContext.lookup("itmp/Interest");
|
| System.out.println("Obtained Object Reference...");
| }
| catch(NamingException e)
| {
| e.printStackTrace();
| }
|
| InterestRemoteHome home = (InterestRemoteHome)
| PortableRemoteObject.narrow (reference, InterestRemoteHome.class);
|
| double answer = Double.NaN;
| String feedback = null;
|
| try
| {
| InterestRemote interest = home.create();
|
| answer = interest.calculateCompoundInterest (1000, 0.10, 2);
| feedback = interest.foo("Feedback String");
| }
| catch(CreateException e)
| {
| e.printStackTrace();
| }
| catch(RemoteException e)
| {
| e.printStackTrace();
| }
|
| System.out.println ("Interest on 1000 units, at 10% per period, compounded over 2
periods is:");
| System.out.println (answer);
| System.out.println (feedback);
| }
| }
|
The bean classes and remote interfaces are
Bean Class
| package itmp.interest;
|
| import java.rmi.RemoteException;
|
| import javax.ejb.SessionBean;
| import javax.ejb.SessionContext;
|
| public class InterestBean implements SessionBean
| {
| public void ejbCreate() {}
|
| public double calculateCompoundInterest(double principle, double rate, double
periods)
| {
| System.out.println ("itmp.interest.calculateCompoundInterest()");
|
| return principle * Math.pow(1 + rate, periods) - principle;
| }
|
| public String foo(String s)
| {
| return s;
| }
|
| public void ejbPassivate() {}
| public void ejbActivate() {}
| public void ejbRemove() {}
|
| public void setSessionContext(SessionContext ctx) {}
| }
|
Remote Home Interface
| package itmp.interest;
|
| import java.rmi.RemoteException;
|
| import javax.ejb.CreateException;
| import javax.ejb.EJBHome;
|
| public interface InterestRemoteHome extends EJBHome
| {
| public InterestRemote create() throws RemoteException, CreateException;
| }
|
Remote Object Interface
| package itmp.interest;
|
| import java.rmi.RemoteException;
|
| import javax.ejb.EJBObject;
|
| public interface InterestRemote extends EJBObject
| {
| public double calculateCompoundInterest(double principle, double rate, double
periods) throws RemoteException;
|
| public String foo(String s) throws RemoteException;
| }
|
The deployment descriptors...
ejb-jar.xml
| <?xml version="1.0" encoding="UTF-8"?>
|
| <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans
2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
|
| <ejb-jar>
| <enterprise-beans>
|
| <session>
| <ejb-name>InterestBean</ejb-name>
| <home>itmp.interest.InterestRemoteHome</home>
| <remote>itmp.interest.InterestRemote</remote>
| <ejb-class>itmp.interest.InterestBean</ejb-class>
| <session-type>Stateless</session-type>
| <transaction-type>Container</transaction-type>
| </session>
|
| <entity>
| <ejb-name>ShipBean</ejb-name>
| <home>itmp.ship.ShipHomeRemote</home>
| <remote>itmp.ship.ShipRemote</remote>
| <local-home>itmp.ship.ShipHomeLocal</local-home>
| <local>itmp.ship.ShipLocal</local>
| <ejb-class>itmp.ship.ShipBean</ejb-class>
| <persistence-type>Container</persistence-type>
| <prim-key-class>java.lang.Integer</prim-key-class>
| <reentrant>False</reentrant>
| <abstract-schema-name>Ship</abstract-schema-name>
|
| <cmp-field><field-name>pk</field-name></cmp-field>
| <cmp-field><field-name>name</field-name></cmp-field>
|
| <primkey-field>pk</primkey-field>
| </entity>
|
| </enterprise-beans>
| </ejb-jar>
|
jboss.xml
| <?xml version="1.0" encoding="UTF-8"?>
|
| <!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS//EN"
"http://www.jboss.org/j2ee/dtd/jboss.dtd">
|
| <jboss>
| <enterprise-beans>
|
| <session>
| <ejb-name>InterestBean</ejb-name>
| <jndi-name>itmp/Interest</jndi-name>
| </session>
|
| <entity>
| <ejb-name>ShipBean</ejb-name>
| <jndi-name>itmp/Ship</jndi-name>
| </entity>
|
| </enterprise-beans>
| </jboss>
|
jbosscmp-jdbc.xml
| <?xml version="1.0" encoding="UTF-8"?>
|
| <!DOCTYPE jbosscmp-jdbc PUBLIC "-//Jboss//DTD JBOSSCMP-JDBC 4.0//EN"
"http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_4_0.dtd">
|
| <jbosscmp-jdbc>
| <enterprise-beans>
|
| <entity>
| <ejb-name>ShipBean</ejb-name>
| <table-name>ITMP_SHIP</table-name>
|
| <cmp-field>
| <field-name>pk</field-name>
| <column-name>PK</column-name>
| </cmp-field>
|
| <cmp-field>
| <field-name>name</field-name>
| <column-name>NAME</column-name>
| </cmp-field>
|
| </entity>
|
| </enterprise-beans>
| </jbosscmp-jdbc>
|
The ShipBean is working fine its included in the deployment descriptors for
completeness, the same problem has been isolated without the ship bean. Interestingly
the following lines appear in the log.
| 2004-10-28 17:30:14,442 DEBUG [org.jboss.ejb.StatelessSessionContainer] Creating
jboss.j2ee:jndiName=itmp/Interest,service=EJB
| 2004-10-28 17:30:14,443 DEBUG [org.jboss.ejb.StatelessSessionContainer] Mapped
calculateCompoundInterest HASH 1715638511 to
| public double
itmp.interest.InterestBean.calculateCompoundInterest(double,double,double)
| 2004-10-28 17:30:14,443 DEBUG [org.jboss.ejb.StatelessSessionContainer] Mapped
Container method remove HASH -1842617161
| 2004-10-28 17:30:14,443 DEBUG [org.jboss.ejb.StatelessSessionContainer] Mapped
Container method getHandle HASH 1182305581
| 2004-10-28 17:30:14,444 DEBUG [org.jboss.ejb.StatelessSessionContainer] Mapped
Container method getEJBHome HASH -993218923
| 2004-10-28 17:30:14,444 DEBUG [org.jboss.ejb.StatelessSessionContainer] Mapped
Container method getPrimaryKey HASH -131865408
| 2004-10-28 17:30:14,444 DEBUG [org.jboss.ejb.StatelessSessionContainer] Mapped
Container method isIdentical HASH 285457048
| 2004-10-28 17:30:14,444 DEBUG [org.jboss.ejb.StatelessSessionContainer] Mapping
create
| 2004-10-28 17:30:14,444 DEBUG [org.jboss.ejb.StatelessSessionContainer] Mapping
remove
| 2004-10-28 17:30:14,444 DEBUG [org.jboss.ejb.StatelessSessionContainer] Mapping
remove
| 2004-10-28 17:30:14,444 DEBUG [org.jboss.ejb.StatelessSessionContainer] Mapping
getEJBMetaData
| 2004-10-28 17:30:14,444 DEBUG [org.jboss.ejb.StatelessSessionContainer] Mapping
getHomeHandle
|
It appears the container doesn't map the 'public String foo(String s)' method and
fails as a result during invocation by the client. This problem has occured several
times with different package names, method names from different jar's (we are in a
classroom environment).
Any ideas why foo isn't mapped by the container?
Thanks in advance,
Iain
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3853145#3853145
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3853145
-------------------------------------------------------
This Newsletter Sponsored by: Macrovision
For reliable Linux application installations, use the industry's leading
setup authoring tool, InstallShield X. Learn more and evaluate
today. http://clk.atdmt.com/MSI/go/ins0030000001msi/direct/01/
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user