|
Problem(Abstract) |
An application running in WebSphere® Application Server V5
or V6 may receive the following exception when it calls create on an EJB
home interface object:
java.lang.NoSuchMethodException:
org.omg.stub.javax.ejb._EJBHome_Stub.create()
at java.lang.Class.getMethod(Class.java:1078)
... |
|
|
|
Cause |
The problem typically occurs when an EJB client
application does a JNDI lookup of an EJB home interface but does not
perform a narrow operation. The javax.ejb.EJBHome class does not define a
create() method, and as a result, the NoSuchMethodException occurs. The
EJB 2.0 and 2.1 specifications require (in
section 6.10) that a narrow be performed after the JNDI lookup of an EJB
home interface, before create() is called. |
|
|
Resolving the
problem |
An example of how the EJB client code should perform the
narrow is as follows:
Object home = initialContext.lookup(beanName);
EJBHome ejbHome = (EJBHome) PortableRemoteObject.narrow
((org.omg.CORBA.Object) home, EJBHome.class);
In this example, EJBHome is the name of the EJB home interface.
After changing the EJB client application code to perform the narrow, the
NoSuchMethodException will no longer occur when calling create on the EJB
home interface. |
|
|
|
|
Cross Reference information |
Segment |
Product |
Component |
Platform |
Version |
Edition |
Application Servers |
Runtimes for Java Technology |
Java SDK |
|
|
|
|
|
|