• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Bear Bibeault
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • salvin francis
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
Bartenders:
  • Jj Roberts
  • Carey Brown
  • Scott Selikoff

session bean create error() can anyone plzz help me out...

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI,
I am trying to write a basic session bean for my application and I am getting a create error. Can anyone plzz help me outt...


here is my session bean class:-


import java.rmi.RemoteException;

import javax.ejb.EJBException;
import javax.ejb.SessionBean;
import javax.ejb.SessionContext;

import javax.ejb.CreateException;

/**
* XDoclet-based session bean. The class must be declared
* public according to the EJB specification.
*
* To generate the EJB related files to this EJB:
* - Add Standard EJB module to XDoclet project properties
* - Customize XDoclet configuration for your appserver
* - Run XDoclet
*
* Below are the xdoclet-related tags needed for this EJB.
*
* @ejb.bean name="TruckInv"
* display-name="Name for TruckInv"
* description="Description for TruckInv"
* jndi-name="ejb/TruckInv"
* type="Stateless"
* view-type="both"
*/
public class TruckInvBean implements SessionBean {

/** The session context */
private SessionContext context;

public TruckInvBean() {
super();
// TODO Auto-generated constructor stub
}

/**
* Set the associated session context. The container calls this method
* after the instance creation.
*
* The enterprise bean instance should store the reference to the context
* object in an instance variable.
*
* This method is called with no transaction context.
*
* @throws EJBException Thrown if method fails due to system-level error.
*/
public void setSessionContext(SessionContext newContext)
throws EJBException {
context = newContext;
}

public void ejbRemove() throws EJBException, RemoteException {
// TODO Auto-generated method stub

}

public void ejbActivate() throws EJBException, RemoteException {
// TODO Auto-generated method stub

}

public void ejbPassivate() throws EJBException, RemoteException {
// TODO Auto-generated method stub

}

/**
* An ejbCreate method as required by the EJB specification.
*
* The container calls the instance?s <code>ejbCreate</code> method whose
* signature matches the signature of the <code>create</code> method invoked
* by the client. The input parameters sent from the client are passed to
* the <code>ejbCreate</code> method. Each session bean class must have at
* least one <code>ejbCreate</code> method. The number and signatures
* of a session bean?s <code>create</code> methods are specific to each
* session bean class.
*
* @throws CreateException Thrown if method fails due to system-level error.
*
* @ejb.create-method
*
*/
public void ejbCreate() throws CreateException {
int i=1;
}

/**
* An example business method
*
* @ejb.interface-method view-type = "remote"
*
* @throws EJBException Thrown if method fails due to system-level error.
*/
public String Hello() throws EJBException {
String msg="hello";
return msg;
}

}




Here is the home interface

public interface TruckInvHome
extends javax.ejb.EJBHome
{
public static final String COMP_NAME="java:comp/env/ejb/TruckInv";
public static final String JNDI_NAME="ejb/TruckInv";

public dekalb.warehouse.TruckInv create()
throws javax.ejb.CreateException,java.rmi.RemoteException;

}

here is the remote interface

public interface TruckInv
extends javax.ejb.EJBObject
{
/**
* An example business method
* @throws EJBException Thrown if method fails due to system-level error. */
public java.lang.String Hello( )
throws java.rmi.RemoteException;

}

Here is my struts action class which invokes the bean:-

import javax.naming.*;
import dekalb.warehouse.TruckInv;
import dekalb.warehouse.TruckInvHome;

public class AddTruckInventory extends Action
{
public AddTruckInventory()
{
}
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws SQLException, Exception
{
try{
Properties properties = new Properties();
properties.put("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
properties.put("java.naming.factory.url.pkgs","org.jboss.naming rg.jnp.interfaces");
properties.put("java.naming.provider.url", "jnp://localhost:1099");
properties.put("jnp.disableDiscovery", "true");
InitialContext context = new InitialContext(properties);
Object object = context.lookup(TruckInvHome.JNDI_NAME);
servlet.log("line 2");
TruckInvHome TIH = (TruckInvHome)PortableRemoteObject.narrow(object,TruckInvHome.class);
servlet.log("line 3");
TruckInv TI = TIH.create();
servlet.log("Line 4");
String msg=TI.Hello();
request.setAttribute("msg", msg);
}
catch (Exception e)
{
servlet.log("Error"+e);
}
servlet.log("In Add Truck Inventory");
return (mapping.findForward("success"));

}
}

I am getting an error at create line and the error is as follows:-

Errorjava.lang.IllegalStateException: Failed to find method for hash:-6291078846837982252 available={4121927297169232143=public abstract void javax.ejb.EJBHome.remove(javax.ejb.Handle) throws java.rmi.RemoteException,javax.ejb.RemoveException, -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, 4881862667832849002=public abstract dekalb.warehouse.TruckInv dekalb.warehouse.TruckInvHome.create() throws javax.ejb.CreateException,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, 8594593460157411074=public abstract javax.ejb.EJBObject javax.ejb.Handle.getEJBObject() throws java.rmi.RemoteException, 5741447652058033148=public abstract java.lang.String dekalb.warehouse.TruckInv.Hello() throws java.rmi.RemoteException}
 
Wink, wink, nudge, nudge, say no more, it's a tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic