Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to deploy a Simple EJB application?

 
Mallik Avula
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JBoss is pretty easy. Just compile your classes, jar the files up and copy it to the deploy directory of your JBoss server.
 
Mallik Avula
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 457
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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)
 
Mallik Avula
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Dilshan Edirisuriya
Ranch Hand
Posts: 299
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check this link

http://www.informit.com/articles/article.aspx?p=384904&rl=1
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic