It's not a secret anymore!
The moose likes EJB and other Java EE Technologies and the fly likes Developing EJB in J2EE1.4 (New in EJB) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Developing EJB in J2EE1.4 (New in EJB)" Watch "Developing EJB in J2EE1.4 (New in EJB)" New topic

Developing EJB in J2EE1.4 (New in EJB)

sushil patil

Joined: Jul 18, 2005
Posts: 13

I have developed Enterprise Bean Class , Remote Interface ,Home Interface.

With the help of J2EE1.4 Tutorial

I am developing Converter Project


src directory contains all files(interfaces and Bean)

But I am not able compile all these source files using "asant build"

I get following message of following two lines

Buildfile: build.xml does not exist!
Build failed

I think I have not used Proper Directory Structure

Please help me as early as possible

Sushil Patil
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42958
You need to start the build from the directory that contains the build.xml file. If the file is in some other directory, you need to specify where that file is, like "ant -f path/to/file/build.xml".
sushil patil

Joined: Jul 18, 2005
Posts: 13
Thanks for the reply sir but i dont know how to build the build.xml file
Juha Juntunen

Joined: Sep 04, 2003
Posts: 2

you can found ant documents from .


---------------<br />Juha Juntunen
jim stone

Joined: Apr 26, 2005
Posts: 18
cd to the directory that as the src and build directories. There should be a build.xml and file. run asant build in that same directory. Example would be c:/javatutorial/jaxrpc/helloservice. The build xml file would be in the helloservice directory.
sushil patil

Joined: Jul 18, 2005
Posts: 13
My directory structure is
converter folder contains src folder , build.xml ,ConverterApp.ear
src folder contains interface), interface), Bean).

ConverterApp.ear is generated from deploytool in J2EE 1.4 Sun Java System Application Server as per given in J2EE tutorial

// Remote Interface
import javax.ejb.EJBObject;
import java.rmi.RemoteException;
import java.math.*;

public interface Converter extends EJBObject
public BigDecimal dollarToYen(BigDecimal dollars) throws RemoteException;
public BigDecimal yenToEuro(BigDecimal yen) throws RemoteException;

//home interface

import java.rmi.RemoteException;
import javax.ejb.CreateException;
import javax.ejb.EJBHome;

public interface ConverterHome extends EJBHome
Converter create() throws RemoteException, CreateException;

//Enterprise Bean

import java.rmi.RemoteException;
import javax.ejb.SessionBean;
import javax.ejb.SessionContext;
import java.math.*;

public class ConverterBean implements SessionBean
BigDecimal yenRate = new BigDecimal("121.6000");
BigDecimal euroRate = new BigDecimal("0.0077");
public BigDecimal dollarToYen(BigDecimal dollars)
BigDecimal result = dollars.multiply(yenRate);
return result.setScale(2,BigDecimal.ROUND_UP);
public BigDecimal yenToEuro(BigDecimal yen)
BigDecimal result = yen.multiply(euroRate);
return result.setScale(2,BigDecimal.ROUND_UP);
public ConverterBean(){}
public void ejbCreate(){}
public void ejbRemove(){}
public void ejbActivate(){}
public void ejbPassivate(){}
public void setSessionContext(SessionContext sc){}

// build.xml

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE project [ <!ENTITY include SYSTEM "../../../../common-ant.xml"> ]>

Copyright 2004-2005 Sun Microsystems, Inc. All rights reserved.
Use is subject to license terms.

<!-- ======================================================= -->
<!-- Sun Java System Application Server Sample Application build xml -->
<!-- ======================================================= -->

<project name="converter" default="core" basedir=".">

<!-- ======================================================= -->
<!-- App name-dependent settings. -->
<!-- ======================================================= -->

<property name="" value="ConverterApp"/>
<property name="sample.home" value="../../../../"/>
<property name="" value="simple"/>
<property name="application.type.ear" value="true"/>
<property name="echo.non.portable.WEB.AllJSPsCompilable.verifier.usage" value="true"/>

<!-- ======================================================= -->
<!-- Package directory structures of interest. -->
<!-- ======================================================= -->

<property name="app.pkg" value="samples/ejb/converter/"/>
<property name="war.pkg" value="samples/ejb/converter"/>
<property name="jar.pkg" value="samples/ejb/converter"/>

<!-- ======================================================= -->
<!--Java Doc properties . -->
<!-- ======================================================= -->
<property name="javadoc.pkgnames" value="samples.ejb.converter.*" />

<!-- ======================================================= -->
<!--Include common.xml -->
<!-- ======================================================= -->


<!-- ======================================================= -->
<!--Tagets to build and deploy sample application -->
<!-- ======================================================= -->
<target name="core" depends="init_common,core_all_common,create_ear_common"/>
<target name="deploy" depends="select_binary_common, deploy_common"/>
<target name="undeploy" depends="init_common, undeploy_common"/>

<target name="clean" depends="clean_all_common"/>
<target name="javadocs" depends="javadocs_all_common"/>
<target name="verify" depends="select_binary_common,verify_common"/>
<target name="all" depends="core,javadocs,verify, deploy"/>


This build.xml is written by me . I don't know how to write build.xml I tried to write this(build.xml) by reading ant documentation and by seeing other build.xml

now I tried to complile all source files following error occurs

D:\Sun\AppServer\samples\ejb\converter>asant build
Buildfile: build.xml
D:\Sun\common-ant.xml could not be found

BUILD FAILED D:\Sun\common-ant.xml <The system cannot find the file specified>

Total time: 1 second
I agree. Here's the link:
subject: Developing EJB in J2EE1.4 (New in EJB)
jQuery in Action, 3rd edition