xdoclet can't generate classes

Discussions

EJB programming & troubleshooting: xdoclet can't generate classes

  1. xdoclet can't generate classes (4 messages)

    xdoclet can't generate classes for the following bean.
    but if i delete content of the dispatch method, then xdoclet works well.

    who can tell me what's the problem?

    /**
     *
     * @ejb.bean name="MessageDispatcher"
     * jndi-name="MessageDispatcherBean"
     * local-jndi-name="LocalMessageDispatcherBean"
     * type="Stateless"
     *
     * @ejb.ejb-ref
     * ejb-name="UserManager"
     * view-type="local"
     * ref-name="ejb/UserManagerLocal"
    **/

    public abstract class MessageDispatcherBean implements SessionBean {

    /**
    * @ejb.interface-method
    * view-type="local"
    **/
    public void dispatch(String message){
    try {
    String[] items = MessageHelper.parseMessage(message);
    //get message head
    int msgid = Integer.parseInt(items[0]);
    int userid = Integer.parseInt(items[1]);
    int sessionid = Integer.parseInt(items[2]);
    long localUserId = Long.parseLong(items[3]);

    //get message body
    String[] body = null;
    if (items.length > 4) {
    body = new String[items.length-4];
    System.arraycopy(items,4,body,0,body.length);
    }

    UserManagerLocalHome umLocalHome = UserManagerUtil.getLocalHome();
    UserManagerLocal um = umLocalHome.create();

    if (msgid != UserAuthMessageHelper.USER_LOGIN_REQ) {
    if (!um.validate(userid,sessionid,localUserId)) {
    System.out.println("invalid user: id="+userid+", sessionid="+sessionid+
    ", localUserId="+localUserId);
    return;
    }
    }
    switch (msgid) {
    case UserAuthMessageHelper.USER_LOGIN_REQ:
    String account = MessageHelper.stringDecode(body[0]);
    String password = MessageHelper.stringDecode(body[1]);
    String custName = MessageHelper.stringDecode(body[2]);
    um.login(localUserId,account,password,custName);
    break;
    case UserAuthMessageHelper.USER_LOGOUT_NOTICE:
    um.logout(userid,localUserId);
    break;
    default:
    System.out.println("unknown message: "+message);
    }
    } catch (CreateException e) {
    e.printStackTrace();
    } catch (Exception e) {
    e.printStackTrace();
    }
    }
    }

    Threaded Messages (4)

  2. xdoclet can't generate classes[ Go to top ]

    Have a look at this chapter.
    http://www.tusc.com.au/tutorial/html/chap3.html

    Vishal(Co-Author of this tutorial.)
  3. xdoclet can't generate classes[ Go to top ]

    I have read the article, but I still don't know what is the problem with my program.
  4. xdoclet can't generate classes[ Go to top ]

    The reason u get yr interface-mehod (Business method) works fine when u delete the contents, beacuse xdoclet generates the neccessry classes for u using recommnded dedign patterns, and in that manner it forces u to use these patterns which really helps yr application to be structured in a very robust way.
    As yr buiness method wil be overrideen in the genarated class, and roughy speaking if u have to write that much lines of code in business method, then u defintely need to restucure yr bean and use different paterns to implement that.

    You might want to read some J2EE patterns and then probably restuucture yr buines method.

    As Xdoclet is all about reducing the no of lines of code a developer has to write and then not worrying about syncronising the deployment descriptors during the development life cycle.

    I hope this helps.
    Vishal.
  5. xdoclet can't generate classes[ Go to top ]

    Should I assign most responsibilities to non-ejb objects and call them in the business methods of ejb?