Well, you have to specify WLS 7.0, but it works fine on WLS 8.1 just the same.. This should save you about 2 weeks of work.....You buy me a beer later :-D
build.properties: ================= ejb.version = 2.0 xdoclet.verbose = true gen_src.docs.dir = ${gen_src.dir}/docs #weblogic.version = 8.1 weblogic.version = 7.0 weblogic.database.type = ORACLE weblogic.datasource = ICE_DATA_SOURCE weblogic.createtables = False weblogic.validateDbSchemaWith=TableQuery weblogic.validateXml = True # Deploy settings deploy.adminurl = http://${serverip}:6099 deploy.user = wls_username_here deploy.password = wls_password_here deploy.source = ${ice.ear} app = ice dir.weblogic = ${weblogic.home.81}/server/lib jar.weblogic = weblogic.jar The Ant script to generate the XDoclet code: ============================================ <target name="generate-ejbdoclet" > <echo>==================================================================</ec ho> <echo>| (generate-EJBdoclet) |</echo> <echo>| Run EJBDoclet code generation |</echo> <echo>==================================================================</ec ho> <ejbdoclet ejbspec="${ejb.version}" addedTags="@xdoclet-generated at ${TODAY},@copyright WellsFargo,@author mknutson,@version xxx" destdir="${gen_src.ejb.dir}" excludedtags="@version,@author" mergeDir="${src.merge.dir}" verbose="${xdoclet.verbose}" > <fileset dir="${src.ejb.dir}" includes="**/*.jar" /> <fileset dir="${src.ejb.dir}"> <include name="**/*.java"/> </fileset> <valueobject pattern="{0}Dto" destDir="${gen_src.common.dir}" /> <remoteinterface destDir="${gen_src.ejb.dir}" /> <localinterface destDir="${gen_src.ejb.dir}" /> <homeinterface destDir="${gen_src.ejb.dir}" /> <localhomeinterface destDir="${gen_src.ejb.dir}" /> <entitypk destDir="${gen_src.ejb.dir}" /> <entitycmp destDir="${gen_src.ejb.dir}" /> <entityfacade destDir="${gen_src.ejb.dir}" /> <session destDir="${gen_src.ejb.dir}" /> <utilobject destDir="${gen_src.ejb.dir}" cacheHomes="true" includeGUID="true" /> <deploymentdescriptor destDir="${gen_src.conf.ejb.dir}" mergedir="${src.merge.dir}" /> <weblogic databaseType="${weblogic.database.type}" poolname="${weblogic.datasource}" version="${weblogic.version}" createtables="${weblogic.createtables}" validateDbSchemaWith="${weblogic.validateDbSchemaWith}" destdir="${gen_src.conf.ejb.dir}/" xmlencoding="UTF-8" validateXml="${weblogic.validateXml}" /> <apachesoap destDir="${gen_src.common.dir}" /> <strutsform destdir="${gen_src.servlets.common.dir}" /> </ejbdoclet> </target> The Entity Bean from which to get the generated code: ===================================================== package com.wf.bd.ice.account; /** * The Entity bean represents a Account Entity * * @author Eileen Smith * * @ejb.bean * name="BankAccount" * display-name="BankAccount Entity for ICE" * cmp-version="2.x" * type="CMP" * view-type="local" * local-jndi-name="local/com.wf.bd.ice.account.BankAccountLocal" * primkey-field="bankAccountPK" * schema="BankAccount" * * @ejb.pk * class="java.lang.String" * * @ejb.value-object * name="BankAccount" * * @struts.form * name="Action" * extends="org.apache.struts.validator.ValidatorForm" * include-pk="true" * include-all="true" * * @ejb.util * generate="physical" * * @ejb.transaction * type="Required" * * @ejb.transaction-type * type="Container" * * @ejb.permission * unchecked="true" * * @weblogic.data-source-name ${weblogic.datasource} * * @ejb.persistence * table-name="T_ICE_BANKACCOUNT" * **/ public abstract class BankAccountBean implements javax.ejb.EntityBean { private javax.ejb.EntityContext myEntityCtx; // ------------------------------------------------------------------------- // Properties (Getters/Setters) // ------------------------------------------------------------------------- /** * Retrieve the BankAccount's bankAccountPK for use as a primaryKey. * * @ejb.pk-field * @ejb.interface-method * @ejb.persistence column-name="bankAccountPK" **/ public abstract String getBankAccountPK(); /** * No interface method for setBankAccountPK(..). See page 130 of the EJB 2.0 specification: * "Once the primary key for an entity bean has been set, the Bean Provider must * not attempt to change it by use of set accessor methods on the primary key * cmp-fields. The Bean provider should therefore not expose the set accessor * methods for the primary key cmp-fields in the component interface of the * entity bean.". A work around would be to remove and then an re-create the bean. */ public abstract void setBankAccountPK( String pBankAccountPK ); /** * Manage the BankAccount's accountSequence * * @ejb.interface-method * @ejb.persistence column-name="ACCOUNTSEQUENCE" **/ public abstract int getAccountSequence(); public abstract void setAccountSequence( int pAccountSequence ); /** * Manage the BankAccount's routingTransitNumber * * @ejb.interface-method * @ejb.persistence column-name="ROUTINGTRANSITNUMBER" **/ public abstract long getRoutingTransitNumber(); public abstract void setRoutingTransitNumber( long pRoutingTransitNumber ); /** * Manage the BankAccount's bankId * * @ejb.interface-method * @ejb.persistence column-name="BANKID" **/ public abstract long getBankId(); public abstract void setBankId( long pBankId ); /** * Manage the BankAccount's accountNumber * * @ejb.interface-method * @ejb.persistence column-name="ACCOUNTNUMBER" **/ public abstract String getAccountNumber(); public abstract void setAccountNumber( String pAccountNumber ); /** * Manage the BankAccount's accountType * * @ejb.interface-method * @ejb.persistence column-name="ACCOUNTTYPE" **/ public abstract String getAccountType(); public abstract void setAccountType( String pAccountType ); /** * Manage the BankAccount's balance * * @ejb.interface-method * @ejb.persistence column-name="BALANCE" **/ public abstract long getBalance(); public abstract void setBalance( long pBalance ); /** * Manage the BankAccount's institutionName * * @ejb.interface-method * @ejb.persistence column-name="INSTITUTIONNAME" **/ public abstract String getInstitutionName(); public abstract void setInstitutionName( String pInstitutionName ); /** * Manage the BankAccount's wellsFargoAccount * * @ejb.interface-method * @ejb.persistence column-name="WELLSFARGOACCOUNT" **/ public abstract boolean getWellsFargoAccount(); public abstract void setWellsFargoAccount( boolean pWellsFargoAccount ); // ------------------------------------------------------------------------- // DTO Methods // ------------------------------------------------------------------------- /** * Manage the BankAccount's DTO/Form object * * @ejb.interface-method **/ public abstract com.wf.bd.ice.account.BankAccountDto getBankAccountDto(); /** * @ejb.interface-method **/ public abstract void setBankAccountDto( com.wf.bd.ice.account.BankAccountDto pBankAccountDto ); // ------------------------------------------------------------------------- // Framework Callbacks // ------------------------------------------------------------------------- /** * Create a TestEntity based on the supplied TestEntity Value Object. * * @param pBankAccountDto The name used to create the BankAccount. * * @throws javax.ejb.EJBException If no new unique ID could be retrieved this will * rollback the transaction because there is no * hope to try again * @throws javax.ejb.CreateException Because we have to do so (EJB spec.) * * @ejb.interface-method view-type="local" * @ejb.create-method view-type="local" **/ public String ejbCreate( com.wf.bd.ice.account.BankAccountDto pBankAccountDto ) throws javax.ejb.EJBException, javax.ejb.CreateException { setBankAccountPK( BankAccountUtil.generateGUID(pBankAccountDto) ); return null; } /** * String Value of this CreditApplication Entity * * @ejb.interface-method * **/ public String toString() { try { return ( getBankAccountDto().toString() ); } catch( Exception e ) { return ""; } } // ------------------------------------------------------------------------- // EJB Callbacks // ------------------------------------------------------------------------- /** * EJB Post Create method * @param pBankAccountDto * @throws javax.ejb.EJBException * @throws javax.ejb.CreateException */ public void ejbPostCreate( com.wf.bd.ice.account.BankAccountDto pBankAccountDto ) throws javax.ejb.EJBException, javax.ejb.CreateException { /* Update the EJB as the CMR information cannot be set at create time: java.lang.IllegalStateException: A CMR field cannot be set in ejbCreate; this should be done in the ejbPostCreate method instead [EJB 2.0 Spec. 10.5.2]. */ setBankAccountDto( pBankAccountDto ); } public void setEntityContext( javax.ejb.EntityContext lContext ) { myEntityCtx = lContext; } public void unsetEntityContext() { myEntityCtx = null; } public void ejbActivate() { } public void ejbPassivate() { } public void ejbLoad() { } public void ejbStore() { } public void ejbRemove() throws javax.ejb.RemoveException { } } //The End... A Session Bean from which to get the generated code: ===================================================== package com.wf.bd.ice.sequence; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Bean implementation class for Enterprise Bean: SequenceManager * * @ejb.bean name="SequenceManager" * display-name="Sequence Manager Generator Session Bean" * type="Stateless" * view-type="both" * jndi-name="ejb/com.wf.bd.ice.sequence.SequenceManager" * local-jndi-name="local/com.wf.bd.ice.sequence.SequenceManagerLocal" * * @ --jboss.container-configuration name="Standard Stateless SessionBean" * * @ejb.util generate="physical" * * @ejb.permission unchecked="true" * */ public class SequenceManagerBean implements javax.ejb.SessionBean { private class SequenceEntry { SequenceLocal sequence = null; long last = 0; public int getBlockSize() { try { return sequence.getBlockSize(); } catch(Exception e){return 1;} } } // ------------------------------------------------------------------------- // Members // ------------------------------------------------------------------------- /** The <code>Log</code> instance for this application. */ private Log log = LogFactory.getLog(SequenceManagerBean.class); /** Hashtable to cache sequence entries for re-use. */ private java.util.Hashtable seqEntries = new java.util.Hashtable(); /** If there is an error getting a sequence entity, how many times should we re-try? */ private int retryCount = 5; /** The actual Sequence (local) Home Interface. */ // private SequenceLocalHome sequenceLocalHome = null; /** Our own Session Context. */ private javax.ejb.SessionContext mySessionCtx; // ------------------------------------------------------------------------- // Interface Methods // ------------------------------------------------------------------------- /** * Get next sequence number * * @ejb.interface-method view-type="both" */ public java.lang.Long getNextNumber(java.lang.String seqName) throws Exception { try { /*if(sequenceLocalHome == null) { if(log.isInfoEnabled()) { log.info("getsequenceLocalHome()"); } SequenceLocalHome sequenceLocalHome = (SequenceLocalHome) com.baselogic.middleware.j2ee.ServiceLocator.getInstance() .getEJBLocalHome(com.baselogic.middleware.j2ee.services.CommonServices.SEQUE NCE_ENTITY_LOCAL_HOME); }*/ if(log.isInfoEnabled()) { log.info("get SeqEntry Object: [" + seqName + "]"); } SequenceEntry sequenceEntry = (SequenceEntry)seqEntries.get(seqName); if(sequenceEntry == null) { // add seq entry to the sequence table if(log.isInfoEnabled()) { log.info("add seq entry to the sequence table"); } sequenceEntry = new SequenceEntry(); SequenceLocalHome sequenceLocalHome = SequenceUtil.getLocalHome(); try { sequenceEntry.sequence = sequenceLocalHome.findByPrimaryKey( seqName ); } // catch(javax.ejb.FinderException e) catch(java.lang.Exception e) { // if we couldn't find it, then create one. if(log.isInfoEnabled()) { log.info("if we couldn't find the sequence, then create one."); //log.info(e.getMessage()); //log.info(e.getClass()); } try { sequenceEntry.sequence = sequenceLocalHome.create( seqName ); } catch(javax.ejb.CreateException ce) { throw ce; } } if(log.isInfoEnabled()) { log.info("Add newly created sequence to our cache: " + seqName); } seqEntries.put(seqName, sequenceEntry); } else { if(log.isInfoEnabled()) { log.info("seqEntry was NOT null"); } } if( ( sequenceEntry.last % sequenceEntry.getBlockSize() ) == 0) { for(int retry = 0; true; retry++) { try { sequenceEntry.last = (sequenceEntry.sequence).getNextNumberBlock(); break; } catch(java.lang.Exception e) { if(retry < retryCount) { // we hit a concurrency exception, so // try again... if(log.isInfoEnabled()) { log.info("we hit a concurrency exception, so, try again..."); } wait(5); continue; } else { //We have tried too many times... throw new Exception(e); } } } } if(log.isDebugEnabled()) { log.debug("increment sequenceEntry.last by 1: " + sequenceEntry.last); } sequenceEntry.last = sequenceEntry.last + 1; if(log.isDebugEnabled()) { log.debug("return sequenceEntry.last: " + sequenceEntry.last); } return new java.lang.Long(sequenceEntry.last); } catch(javax.ejb.CreateException e) { if(log.isErrorEnabled()) { log.error("CreateException " + e.getMessage()); } throw new Exception(e); } catch(java.lang.Exception e) { if(log.isErrorEnabled()) { log.info("Exception " + e.getMessage()); } e.printStackTrace(); throw new Exception(e); } } // ------------------------------------------------------------------------- // EJB Callbacks // ------------------------------------------------------------------------- /** * ejbCreate * * @throws javax.ejb.CreateException * * @ejb.create-method view-type="both" */ public void ejbCreate() throws javax.ejb.CreateException { } /** * getSessionContext */ public javax.ejb.SessionContext getSessionContext() { return mySessionCtx; } /** * setSessionContext */ public void setSessionContext(javax.ejb.SessionContext ctx) { mySessionCtx = ctx; } /** * ejbActivate */ public void ejbActivate() { } /** * ejbPassivate */ public void ejbPassivate() { } /** * ejbRemove */ public void ejbRemove() { } } // The End... Deploy ant target to deploy the beans ====================================== <target name="deploy-to-wls" > <echo>==================================================================</ec ho> <echo>| (deploy-wls) |</echo> <echo>| Deploy ICE to the WebLogic Server |</echo> <echo>==================================================================</ec ho> <java classname="weblogic.Deployer" fork="true" failonerror="true"> <arg line=" -verbose -debug -adminurl ${deploy.adminurl} -user ${deploy.user} -password ${deploy.password} -name ${app} -source ${deploy.source} -activate -targets ${app}"/> <classpath> <pathelement path="${dir.weblogic}/${jar.weblogic}"/> </classpath> </java> </target> ------------------------------------------------------- This SF.Net email is sponsored by: Oracle 10g Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE. http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click _______________________________________________ xdoclet-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/xdoclet-user