ejb compile error, please help

Does anybody knows why i got following error, I copy from word to word from book but I am keep getting same error message over an over

please help

thx in advance

DiceEJB.java [17:1] class DiceEJB must be declared abstract. It does not define public abstract void ejbPassivate() throws javax.ejb.EJBException,java.rmi.RemoteException from class javax.ejb.SessionBean

public class DiceEJB implements SessionBean, Serializable {

^

1 error

[code]

import java.lang.Object;

import javax.ejb.SessionBean;

import javax.ejb.SessionContext;

import java.rmi.RemoteException;

import java.lang.Math;

import java.util.Random;

import java.io.*;

/**

* Title:

* Description:

* Copyright:Copyright (c) 2001

* Company:

* @author

* @version 1.0

*/

public class DiceEJB implements SessionBean, Serializable {

public int[] Roll() {

Random rng = new Random();

int diceArray = new int[5];

for(int i =0; i < diceArray.lenght;i++){

diceArray[i] =(Math.abs(rng.nextInt()) % 6) +1;

}

return diceArray;

}

public DiceEJB(){}

public void ejbCreate() {}

public void ejbRemove() {}

public void ejbActivate() {}

public void setSessionContext(SessionContext sc) {}

private void writeObject(ObjectOutputStream oos) throws IOException {

oos.defaultWriteObject();

}

private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException {

ois.defaultReadObject();

}

}

[code]

[1956 byte] By [liberticide] at [2007-9-26 3:54:31]
# 1

Hi,

if you look at your error message you will see the problem. In your code you've missed to implement

public void ejbPassivate {}

so your code looks like this

import java.lang.Object;

import javax.ejb.SessionBean;

import javax.ejb.SessionContext;

import java.rmi.RemoteException;

import java.lang.Math;

import java.util.Random;

import java.io.*;

/** * Title: * Description: * Copyright:Copyright (c) 2001 * Company: * @author * @version 1.0 */

public class DiceEJB implements SessionBean, Serializable

{

public int[] Roll()

{

Random rng = new Random();

int[] diceArray = new int[5];

for(int i =0; i < diceArray.length;i++)

{

diceArray = (Math.abs (rng.nextInt()) % 6) +1;

}

return diceArray;

}

public DiceEJB(){}

public void ejbCreate() {}

public void ejbRemove() {}

public void ejbActivate() {}

public void ejbPassivate() {}

public void setSessionContext (SessionContext sc)

{}

private void writeObject(ObjectOutputStream oos) throws IOException

{

oos.defaultWriteObject();

}

private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException

{

ois.defaultReadObject();

}

}

bye

babbela at 2007-6-29 12:43:45 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2
thx for your help, I have been try to run this programs for a month already. once again thax for all helps from this forum.
liberticide at 2007-6-29 12:43:45 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...