- This topic has 3 replies, 2 voices, and was last updated 21 years, 6 months ago by Scott Anderson.
-
AuthorPosts
-
rondouthitMemberWhen using the EJB wizard and subsequently Xdoclet — basically following the getting started guide, the remote EJB interface is bound to a concrete class — not an interface.
When I try to deploy, JBoss gives me the following error:
java.rmi.ServerException: Could not bind home; nested exception is:
java.lang.IllegalArgumentException: com.cyberclubhouse.StockTraderBean is not an interface]I’m using Eclipse Version: 2.1.0 Build id: 200302211557
Myeclipse 2.5.1, Java 1.4.1My bean was generated (before Xdoclet) by the wizard with the following XDoclet tags:
/**
* XDoclet-based stateless session bean. The class must be declared
* <code>public</code>, according to the EJB specification.<br>
*
* To generate code:
* <br>
* <ul>
* <li> Add Standard EJB module to XDoclet project properties
* <li> Customize XDoclet configuration
* <li> Run XDoclet
* </ul>
* <br>
* Please see the included XDoclet Overview
* and the XDoclet Reference in the help system for details
*
* @ejb.bean name = “StockTraderBean”
* type = “Stateless”
* display-name = “StockTraderBean”
* description = “StockTraderBean EJB”
* view-type = “remote”
* jndi-name = “ejb/StockTraderBeanHome”
*/
public class StockTraderBean implements SessionBean
{/** The SessionContext */
private SessionContext context;
….After running XDoclet, it generated StockTraderBeanHome.java:
public interface StockTraderBeanHome
extends javax.ejb.EJBHome
{
public static final String COMP_NAME=”java:comp/env/ejb/StockTraderBean”;
public static final String JNDI_NAME=”ejb/StockTraderBeanHome”;public test.StockTraderBean create()
throws javax.ejb.CreateException,java.rmi.RemoteException;}
and then StockTraderBeanSession.java:
public class StockTraderBeanSession
extends test.StockTraderBean
implements javax.ejb.SessionBean
{
public void ejbActivate() throws javax.ejb.EJBException
{
super.ejbActivate();
}
….and the following ejb-jar.xml file:
<ejb-jar >
<description><![CDATA[No Description.]]></description>
<display-name>Generated by XDoclet</display-name><enterprise-beans>
<!– Session Beans –>
<session >
<description><![CDATA[StockTraderBean EJB]]></description>
<display-name>StockTraderBean</display-name><ejb-name>StockTraderBean</ejb-name>
<home>test.StockTraderBeanHome</home>
<remote>test.StockTraderBean</remote>
<ejb-class>test.StockTraderBeanSession</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type></session>
….
Scott AndersonParticipantYou have two problems. First, you’re using a pre-release version of Eclipse 2.1.0, not the final release. For XDoclet to function properly you must be using the final release of either 2.1.0 or 2.1.1, so you’ll need to upgrade your Eclipse installation.
The second problem is that the package you selected for your EJB, does not end with .ejb (ie. com.whatever.ejb). The default mappings in XDoclet look for packages with an .ejb suffix and generate the code in a package that ends with .ejb.interfaces. You can either change your XDoclet configuration mappings or the package name. Since you’re just working on an example, I’d suggest changing the package name. Additionally, the default XDoclet mappings expect your source folder to be named ‘src’ so if this is not the case you probably want to fix that as well by either renaming your existing folder or changing the XDoclet configuration.
However, you really need to restart with a clean installation of Eclipse 2.1.1 and MyEclipse 2.5.1 to avoid many future problems.
–Scott
MyEclipse Support
rondouthitMemberThanks — the package name (.ejb) was the problem.
Scott AndersonParticipantThanks — the package name (.ejb) was the problem.
Good deal. You still need to update your Eclipse installation with a released version however. Using a pre-release will cause additional problems, guaranteed.
–Scott
MyEclipse Support -
AuthorPosts