Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / JavaBeans / September 2004

Tip: Looking for answers? Try searching our database.

xdoclet help w/ sessionbean

Thread view: 
Willian Irving Zumwalt - 24 Sep 2004 00:11 GMT
Hey all,

Does anyone see anything wrong w/ this session bean. I'm pretty new to
XDoclet and having various problems in compiling or loading. So now
I'm just trying a very basic example. I get the following compile
errors below it.

/**
*
* @ejb.bean
*      name="comp/History"
*      type="Stateless"
*      view-type="remote"
*      jndi-name="ejb/comp/History"
*
* @ejb.home
*      extends="javax.ejb.EJBHome"
*      remote-class="com.place.management.ejb.session.HistoryHome"
*
* @ejb.interface
*      extends="javax.ejb.EJBObject"
*      remote-class="com.place.management.ejb.session.History"
*/

public class HistoryBean implements SessionBean
{
   private transient SessionContext context = null;

   public void setSessionContext(SessionContext ctx) {
       context = ctx;
   }

   public void unsetSessionContext() throws EJBException {
       context = null;
   }

   /**
    * @ejb.create-method
    */

   public void ejbCreate() throws CreateException { }

   /**
    * @ejb.home-method
    */

   public void ejbRemove() throws EJBException { }

   /**
    * @ejb.home-method
    */

   public void ejbPassivate() { }

   /**
    * @ejb.home-method
    */

   public void ejbActivate() { }

   /**
    * @ejb.home-method
    */

   public void ejbRemove() { }
}

--- jboss server output ---

   [javac] Compiling 42 source files to /home/myProject/build/classes
   [javac] /home/myProject/src/com/place/management/ejb/session/HistoryBean.java:74:
ejbRemove() is already defined in
com.place.management.ejb.session.HistoryBean
   [javac]     public void ejbRemove() { }
   [javac]                     ^
   [javac] /home/myProject/build/gen/com/place/management/ejb/session/HistoryHome.java:29:
remove() is already defined in
com.place.management.ejb.session.HistoryHome
   [javac]    public void remove()
   [javac]                ^
   [javac] 2 errors
William Zumwalt - 24 Sep 2004 03:32 GMT
Apologies, wrong error, typo in the original. Here is my real problem.

Hey all,

Does anyone see anything wrong w/ this session bean. I'm pretty new to
XDoclet and having various problems in compiling or loading. So now
I'm just trying a very basic example. I get the following compile
errors below it.

/**
*
* @ejb.bean
*      name="comp/History"
*      type="Stateless"
*      view-type="remote"
*      jndi-name="ejb/comp/History"
*
* @ejb.home
*      extends="javax.ejb.EJBHome"
*      remote-class="com.place.management.ejb.session.HistoryHome"
*
* @ejb.interface
*      extends="javax.ejb.EJBObject"
*      remote-class="com.place.management.ejb.session.History"
*/

public class HistoryBean implements SessionBean
{
   private transient SessionContext context = null;

   public void setSessionContext(SessionContext ctx) {
       context = ctx;
   }

   public void unsetSessionContext() throws EJBException {
       context = null;
   }

   /**
    * @ejb.create-method
    */

   public void ejbCreate() throws CreateException { }

   /**
    * @ejb.home-method
    */

   public void ejbRemove() throws EJBException { }

   /**
    * @ejb.home-method
    */

   public void ejbPassivate() { }

   /**
    * @ejb.home-method
    */

   public void ejbActivate() { }
}

--- Here is the server output error that I don't understand ...

...
21:25:49,635 INFO  [EjbModule] Deploying comp/History
21:25:49,821 ERROR [StatelessSessionContainer] Initialization failed
jboss.j2ee:jndiName=ejb/comp/History,service=EJB
java.lang.NoSuchMethodException:
org.jboss.ejb.StatelessSessionContainer.removeHome() at
java.lang.Class.getMethod(Class.java:978)
at
org.jboss.ejb.StatelessSessionContainer.setupHomeMapping(StatelessSession
Container.java:488)
at
org.jboss.ejb.StatelessSessionContainer.createService(StatelessSessionCon
tainer.java:142)
at
org.jboss.system.ServiceMBeanSupport.jbossInternalCreate(ServiceMBeanSupp
ort.java:237)
at
org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanS
upport.java:219)
at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorI
mpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at
org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java
:60)
Marek Lange - 24 Sep 2004 07:47 GMT
> Apologies, wrong error, typo in the original. Here is my real problem.
>     /**
>      * @ejb.home-method
>      */
>
>     public void ejbRemove() throws EJBException { }

>     /**
>      * @ejb.home-method
>      */

>     public void ejbPassivate() { }
>
>     /**
>      * @ejb.home-method
>      */

>     public void ejbActivate() { }

Try to cut alle the @ejb.home-method tags here and see waht happens.

-marek
Willian Irving Zumwalt - 24 Sep 2004 19:57 GMT
Thanks, that fixed it, but I'm not sure why. I thought those were home
methods and should have been declared as such. In fact, I'm still
sorta sure of that.

> > Apologies, wrong error, typo in the original. Here is my real problem.
> >     /**
[quoted text clipped - 18 lines]
>
> -marek
Darryl L. Pierce - 25 Sep 2004 01:55 GMT
> Thanks, that fixed it, but I'm not sure why. I thought those were home
> methods and should have been declared as such. In fact, I'm still
> sorta sure of that.

You're not specifying the _view-type_:

/**
* @ejb.home-method view-type="[type]"
*/

where [type] is "local", "remote" or "both".

Signature

/**
* @author Darryl L. Pierce <mcpierce@myrealbox.com>
* @see    The Infobahn Offramp <http://mcpierce.mypage.org>
* @quote  "Lobby, lobby, lobby, lobby, lobby, lobby..." - Adrian Monk
*/

Marek Lange - 27 Sep 2004 17:14 GMT
>>Thanks, that fixed it, but I'm not sure why. I thought those were home
>>methods and should have been declared as such. In fact, I'm still
[quoted text clipped - 7 lines]
>
> where [type] is "local", "remote" or "both".

Remote is default IMHO. Not mandatory.

-marek
Darryl L. Pierce - 28 Sep 2004 10:54 GMT
>> You're not specifying the _view-type_:
>>
[quoted text clipped - 5 lines]
>
> Remote is default IMHO. Not mandatory.

Local is the default. Check
<http://xdoclet.sourceforge.net/xdoclet/tags/ejb-tags.html#%40ejb_home-method__0__1_>
and lookup the entry for @ejb.home-method for more information.

Signature

/**
* @author Darryl L. Pierce <mcpierce@myrealbox.com>
* @see    The Infobahn Offramp <http://mcpierce.mypage.org>
* @quote  "Lobby, lobby, lobby, lobby, lobby, lobby..." - Adrian Monk
*/



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.