File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes How to deploy a Simple EJB application? 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 "How to deploy a Simple EJB application?" Watch "How to deploy a Simple EJB application?" New topic
Author

How to deploy a Simple EJB application?

Mallik Avula
Ranch Hand

Joined: Nov 30, 2006
Posts: 86
HI Friends
i am new to EJB's, i created one simple application and that contains only one session bean.
i created Home Interface : MyHome.java
Remote Interface: MyRemote.java
session bean class: MyBean.java
Deployment descriptor:ejb-jar.xml
i want to deploy it on JBoss 4.1 server.
My Application structure is:
SampleProj
->src
->com.sample
->MyBean.java
->MyHome.java
->MyRemote.java
->META-INF
->ejb-jar.xml

Can anybody tell me the steps to deploy on JBoss server
i am not using any IDE.

thanks in advance.


Thanks & Regards<br />Mallik Avula<br />SCJP1.4
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

JBoss is pretty easy. Just compile your classes, jar the files up and copy it to the deploy directory of your JBoss server.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Mallik Avula
Ranch Hand

Joined: Nov 30, 2006
Posts: 86
HI paul
Thank for your interest.
In my Jboss server there is no 'deploy' directory.
Can i create it, in the same hierarchy of bin, lib etc ?

This is Ejb application, so can we create Jar for that or .ear..!?
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Sounds like you have a bad install. The deploy directory contains all the stuff that is deployed in your server, and this includes things JBoss needs to do its basic operations (such as deploying EJBs). Reinstall JBoss.

EJB applications are deployed as Jars.
[ January 07, 2008: Message edited by: Paul Sturrock ]
Mallik Avula
Ranch Hand

Joined: Nov 30, 2006
Posts: 86
HI Paul
ya there is some problem with jboss, so i reinstalled then it is working.
i deployed the application, to test that one, i created one servlet, where i am calling that ejb.
this is the code snippet :

Object obj = null;


try{
InitialContext ic = new InitialContext();
obj = ic.lookup("java:com/sample/MyHome");
MyHome home = (MyHome)PortableRemoteObject.narrow(obj, MyHome.class);

MyRemote myRemote = home.create();
myRemote.doThis();
}catch(Exception e)
{
e.printStackTrace();
}

but it is throwing :

javax.naming.NameNotFoundException: com not bound


how to solve this
thanks in advance.
Bill Shirley
Ranch Hand

Joined: Nov 08, 2007
Posts: 457
you're using EJB 2.x,

when I'm using 3.0, i use

which returns the MyRemote interface/stub,

i suspect you need to remove the path,
whatever else you might have to do,
i do not know (not being a EJB 2.1 JNDI user)


Bill Shirley - bshirley - frazerbilt.com
if (Posts < 30) you.read( JavaRanchFAQ);
Mallik Avula
Ranch Hand

Joined: Nov 30, 2006
Posts: 86
Hi friends
thank you Bill and Paul
Can you guide me how to bind the Ejb's to JNDI?
any tutorail on that?
i would like to do it by coding, not using any tool.

thanks in advance
Lave Kulshreshtha
Ranch Hand

Joined: Oct 21, 2007
Posts: 106
Hi,
Along with ejb-jar.xml you also need to give EJB entries in application server specific xml file. Please refer to documentation of JBoss server. This xml file will be stored in same place as of ejb-jar.xml. The information available in application server specific xml file is used to create a JNDI binding on server.

After writting this file packge your application as jar file and deploy it to server again.

-Lave


SCJP 1.4, SCWCD 1.4, SCBCD 1.3, ITIL V3 Foundation Certification
Dilshan Edirisuriya
Ranch Hand

Joined: Apr 22, 2006
Posts: 299
Check this link

http://www.informit.com/articles/article.aspx?p=384904&rl=1


Dilshan Edirisuriya SCJP1.4, SCWCD1.4, SCBCD 5
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to deploy a Simple EJB application?
 
Similar Threads
Getting Error while runnning Session Bean Client
Problem in local refrence
problems with JNDI name lookup
SB has problem looking up the EB via JNDI.
EJB3 Session bean and JBoss 5