• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Developing EJB in J2EE1.4 (New in EJB)

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

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

With the help of J2EE1.4 Tutorial

I am developing Converter Project

D:\Sun\AppServer\Samples\ejb\Converter\src

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
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply sir but i dont know how to build the build.xml file
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

you can found ant documents from http://ant.apache.org .

-Juha
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
cd to the directory that as the src and build directories. There should be a build.xml and build.properties 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
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My directory structure is
D:\Sun\AppServer\samples\ejb\converter
converter folder contains src folder , build.xml ,ConverterApp.ear
D:\Sun\AppServer\samples\ejb\converter\src
src folder contains Converter.java(remote interface),
ConverterHome.java(home interface),
ConverterBean.java(Enterprise Bean).

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



// Remote Interface Converter.java
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 ConverterHome.java

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

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

//Enterprise Bean ConverterBean.java

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="binary.name" value="ConverterApp"/>
<property name="sample.home" value="../../../../"/>
<property name="sample.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 -->
<!-- ======================================================= -->

&include;

<!-- ======================================================= -->
<!--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"/>

</project>

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
java.io.FileNotFoundException: D:\Sun\common-ant.xml <The system cannot find the file specified>

Total time: 1 second
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic