• 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

How to deploy a Simple EJB application?

 
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 457
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 299
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Check this link

http://www.informit.com/articles/article.aspx?p=384904&rl=1
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic