Hi, 

I have been messing around with XDoclet trying to get my first EJB Doclet to
work for a few days with no success.  I'm sure the thing I'm doing wrong is
simple.  Here is the file I'm trying to generate ejb-jar.xml and all of the
interfaces from (from the XDoclet Samples)
============================================================================
====================================
package test.ejb;

import test.interfaces.Customer;
import test.interfaces.CustomerHome;

import javax.ejb.EJBException;
import javax.ejb.FinderException;
import javax.ejb.SessionBean;
import javax.ejb.SessionContext;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import java.rmi.RemoteException;
import java.util.Collection;
import java.util.Iterator;

/**
 * This Bean serves as an example of a session bean that does not require a
subclass to
 * be generated, but is included in the deployment descriptor generation. It
is a _very_ simple
 * stupid example.
 *
 * @ejb.bean
 *    generate="false"
 *    jndi-name="ejb/bank/SecurityOfficer"
 *    name="SecurityOfficer"
 *    type="Stateless"
 * @ejb.ejb-ref
 *    ejb-name="SecurityOfficer"
 * @ejb.permission
 *    role-name="SecurityOfficer"
 * @ejb.interface
 *    generate="false"
 * @ejb.home
 *    generate="false"
 * @ejb.util
 *    generate="false"
 * @jboss.container-configuration
 *    name="Standard Stateless SessionBean"
 * @jboss.ejb-ref-jndi
 *    jndi-name="ejb/bank/Customer"
 *    ref-name="bank/Customer"
 *
 * @jonas.bean ejb-name="SecurityOfficer"
 *             jndi-name="SecurityOfficerHome"
 * @jonas.ejb-ref ejb-ref-name="ejb/SecurityOfficer"
 *                jndi-name="SecurityOfficer"
 */
public class SecurityOfficerBean implements SessionBean {
    // SessionBean implementation -----------------------------------

    private SessionContext sessionContext;

    /**
     */
    public void setSessionContext(SessionContext context) {
        this.sessionContext = context;
    }

    /**
     */
    public void ejbRemove() {
        ;
    }

    /**
     */
    public void ejbActivate() {
        ;
    }

    /**
     */
    public void ejbPassivate() {
        ;
    }

    /**
     */
    public void patrolBank() {
        System.out.println("Patrolling bank.");

        try {
            CustomerHome home = (CustomerHome) new
InitialContext().lookup("java:comp/env/ejb/bank/Customer");
            Collection customers = home.findAll();
            for (Iterator customersInBank = customers.iterator();
customersInBank.hasNext();) {
                Customer customer = (Customer) customersInBank.next();
                customer.talkTo();
            }
        }
        catch (NamingException e) {
            throw new EJBException("Unable to find any customers: " +
e.getMessage());
        }
        catch (RemoteException e) {
            throw new EJBException("Unable to find any customers: " +
e.getMessage());
        }
        catch (FinderException e) {
            throw new EJBException("Unable to find any customers: " +
e.getMessage());
        }
    }

}
  
============================================================================
====================================
and here is my ant script
============================================================================
====================================
<project name="xdoclet" basedir="." default="all">

<property name="build.dir" value="build"/>
<property name="java.dir" value="src"/>
<property name="generated.java.dir" value="generated"/>


<path id="project.class.path">
        <fileset dir="C:\\applications\\xdoclet-bin-1.2b3.zip\\lib\\">
                <include name="*.jar"/>
        </fileset>
        <fileset dir="C:\\applications\\WebSphere\\AppServer\\lib\\">
                <include name="j2ee.jar"/>
        </fileset>
</path>

<target name="init" >
  <taskdef
     name="ejbdoclet"
     classname="xdoclet.modules.ejb.EjbDocletTask"
     classpathref="project.class.path"/>
  <taskdef
     name="webdoclet"
     classname="xdoclet.modules.web.WebDocletTask"
     classpathref="project.class.path"/>
</target>


<target name="ejbdoclet" depends="init">

    <tstamp>
        <format property="TODAY" pattern="d-MM-yy"/>
    </tstamp>

    <ejbdoclet
                        destdir="${generated.java.dir}"
                        excludedtags="@version,@author"
                        addedtags="@xdoclet-generated at ${TODAY}"
                        ejbspec="2.0">
        
        <fileset dir="${java.dir}">
            <include name="**/*Bean.java"/>
        </fileset>
                <!--
        <dataobject/>
                
        <packageSubstitution packages="persistence"
substituteWith="interfaces"/>
                -->
        <remoteinterface pattern="{0}Remote"/>
        <localinterface pattern="{0}"/>

        <homeinterface />
        <localhomeinterface/>

                <!--
        <entitypk/>
        <entitycmp/>
        -->

        <deploymentdescriptor destdir="${build.dir}/ejb/META-INF"/>

        <jboss version="3.0"
            securityDomain="java:/jaas/samples"
            preferredRelationMapping="relation-table"
            datasource="java:/DefaultDS"
            datasourcemapping="Hypersonic SQL"
            destdir="${build.dir}/ejb/META-INF" />

    </ejbdoclet>

</target>


<target name="all" depends="ejbdoclet"/>

</project>


============================================================================
====================================

My directory structure looks like this:

============================================================================
====================================

-XDoclet
        -build
                -ejb
                        -META-INF
        -src
                -test
                        -ejb
                                *SecurityOfficerBean.java
        -generated
        *build.xml

============================================================================
====================================
Can anyone see what I'm doing wrong?  No interfaces are generated and my
xmls are just template code.  I get this output from Ant:
============================================================================
====================================
Buildfile: build.xml

init:

ejbdoclet:
[ejbdoclet] 0 [main] INFO XDocletMain.start  - Running <remoteinterface/>
[ejbdoclet] 281 [main] INFO XDocletMain.start  - Running <localinterface/>
[ejbdoclet] 297 [main] INFO XDocletMain.start  - Running <homeinterface/>
[ejbdoclet] 297 [main] INFO XDocletMain.start  - Running
<localhomeinterface/>
[ejbdoclet] 297 [main] INFO XDocletMain.start  - Running
<deploymentdescriptor/>

[ejbdoclet] Generating EJB deployment descriptor (ejb-jar.xml).
[ejbdoclet] 609 [main] INFO XDocletMain.start  - Running <jboss/>

all:

BUILD SUCCESSFUL
Total time: 3 seconds

============================================================================
====================================

Thanks in advance!,

Jim Bender
Fifth Third Bank
(513)534-3603





This e-mail transmission contains information that is confidential and may be 
privileged.   It is intended only for the addressee(s) named above. If you receive 
this e-mail in error, please do not read, copy or disseminate it in any manner. If you 
are not the intended recipient, any disclosure, copying, distribution or use of the 
contents of this information is prohibited. Please reply to the message immediately by 
informing the sender that the message was misdirected. After replying, please erase it 
from your computer system. Your assistance in correcting this error is appreciated.


-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user

Reply via email to