Java EJBGen Ant构建成功返回警告未找到EJB文件
我正在使用Java EJBGen Ant构建成功返回警告未找到EJB文件,java,jakarta-ee,ant,ejb,Java,Jakarta Ee,Ant,Ejb,我正在使用apacheant构建持续集成来执行构建 目前我们正面临一些奇怪的蚂蚁警告。我已经将ant任务指向了名为DNAOOperationEJB.java 随附ant构建文件: <ejbgen source="1.6" outputDir="${staging.dir}" descriptorDir="ejbModule\META-INF" forceGeneration="true" ejbSuffix = "." localSuffix
apacheant
构建持续集成来执行构建
目前我们正面临一些奇怪的蚂蚁警告。我已经将ant任务指向了名为DNAOOperationEJB.java
随附ant构建文件:
<ejbgen source="1.6" outputDir="${staging.dir}" descriptorDir="ejbModule\META-INF" forceGeneration="true"
ejbSuffix = "."
localSuffix = "Local"
localHomeSuffix = "LocalHome">
<fileset dir="ejbModule/sample/oss/dna/ejb">
<contains text="@Session"/>
<contains text="@LocalMethod"/>
</fileset>
</ejbgen>
但是从EJBGen生成的文件没有显示在目标文件夹中。我认为这是因为Ant找不到EJBGen文件,如警告所示:找不到EJBGen文件代码>
DNAOOperationEJB.java
的源代码如下:
/*
* GenericSessionBean subclass automatically generated by OEPE.
*
* Please complete the ejbCreate method as needed to properly initialize new instances of your bean and add
* all required business methods. Also, review the Session, JndiName and FileGeneration annotations
* to ensure the settings match the bean's intended use.
*/
@Session(ejbName = "DnAOperationEJB", initialBeansInFreePool = "5", maxBeansInFreePool = "20", transactionType = SessionTransactionType.CONTAINER, defaultTransaction = TransactionAttribute.SUPPORTS)
@JndiName(local = "ejb.DnAOperationEJBLocalHome")
@FileGeneration(remoteClass = Constants.Bool.FALSE, remoteHome = Constants.Bool.FALSE, localClass = Constants.Bool.TRUE, localHome = Constants.Bool.TRUE)
public class DnAOperationEJB extends GenericSessionBean implements SessionBean {
private static final long serialVersionUID = 1L;
private static String className = DnAOperationEJB.class.getName();
/*
* (non-Javadoc)
*
* @see weblogic.ejb.GenericSessionBean#ejbCreate()
*/
public void ejbCreate()
{
// IMPORTANT: Add your code here
}
// @LocalMethod()
@LocalMethod(transactionAttribute = TransactionAttribute.NOT_SUPPORTED)
public Context createContext(String xmlIn, String tID)
{
Log.debug("Executing createContext", className, tID);
try
{
Context ctx = new Context();
ctx.setTransactionID(tID);
ctx.setRequest(xmlIn);
return ctx;
}
catch (Exception e)
{
throw new RuntimeException(e);
}
finally
{
Log.debug("createContext executed", className, tID);
}
}
// @LocalMethod()
@LocalMethod(transactionAttribute = TransactionAttribute.REQUIRES_NEW)
public void executeOperation(Context ctx) throws Exception
{
Log.debug("Executing executeOperation", className, ctx.getTransactionID());
Operation operation = null;
try
{
operation = OSSFactory.newOperation(ctx);
Log.debug("OperationBegin: " + ctx.getRequest().toString(), className, ctx.getTransactionID());
operation.execute();
}
catch(Exception e)
{
Log.exception(e, className, ctx.getTransactionID());
e.printStackTrace();
getSessionContext().setRollbackOnly();
Log.debug("Transaction rolled back", className, ctx.getTransactionID());
throw e;
}
finally
{
if(operation != null)
operation.terminate(false);
Log.debug("executeOperation executed", className, ctx.getTransactionID());
}
}
@LocalMethod(transactionAttribute = TransactionAttribute.NOT_SUPPORTED)
public String generateResponse(Context ctx) throws Exception
{
Log.debug("Executing generateResponse", className, ctx.getTransactionID());
Operation operation = null;
try
{
operation = OSSFactory.newOperation(ctx);
return operation.generateResponse(null);
}
finally
{
if(operation != null)
operation.terminate(false);
Log.debug("generateResponse executed", className, ctx.getTransactionID());
}
}
@LocalMethod(transactionAttribute = TransactionAttribute.NOT_SUPPORTED)
public String generateErrorResponse(Context ctx, Exception exception)
{
Log.debug("Executing generateErrorResponse", className, ctx.getTransactionID());
Operation operation = null;
try
{
operation = OSSFactory.newOperation(ctx);
return operation.generateResponse(exception);
}
catch(Exception e)
{
Log.exception(e, className, ctx.getTransactionID());
e.printStackTrace();
throw new RuntimeException(e);
}
finally
{
if(operation != null)
operation.terminate(false);
Log.debug("generateErrorResponse executed", className, ctx.getTransactionID());
}
}
// @LocalMethod()
@LocalMethod(transactionAttribute = TransactionAttribute.REQUIRES_NEW)
public void terminate (Context ctx)
{
Log.debug("Executing terminate", className, ctx.getTransactionID());
Operation operation = null;
try
{
operation = OSSFactory.newOperation(ctx);
operation.terminate(true);
}
catch(Exception e)
{
Log.exception(e, className, ctx.getTransactionID());
e.printStackTrace();
}
}
}
但是我已经把EJB文件放到ant任务中了
有什么想法、帮助和/或意见吗?找到最佳解决方案后,这种错误就有了解决方案
首先:verbose您的EJBGEN函数
<ejbgen source="1.6" outputDir="${staging.dir}" descriptorDir="ejbModule\META-INF" forceGeneration="true"
verbose="true"
ejbSuffix = "."
localSuffix = "Local"
localHomeSuffix = "LocalHome">
<fileset dir="ejbModule/sample/oss/dna/ejb">
<contains text="@Session"/>
<contains text="@LocalMethod"/>
</fileset>
</ejbgen>
<ejbgen source="1.6" outputDir="${staging.dir}" descriptorDir="ejbModule\META-INF" forceGeneration="true"
verbose="true"
ejbSuffix = "."
localSuffix = "Local"
localHomeSuffix = "LocalHome">
<fileset dir="ejbModule/sample/oss/dna/ejb">
<contains text="@Session"/>
<contains text="@LocalMethod"/>
</fileset>
</ejbgen>
ant build -lib ../lib -v > build.log