• 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 ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

How to deploy EJB? any website for tutorial?

Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am new in EJB. I don't know how to deploy beans in weblogic 7.0 or 8.0.
is any website can tutorial? Thanks.
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are multiple ways to deploy EJB in WL 7.0.
1. Hot - deploy (just copy the ear file in the application folder)
2. Admin console (click on EJB node in left panel & select configure a new EJB)
3. WLBuilder (a GUI tool you can use for building EAR and deploying)
4. weblogic.Admin command (not sure about this)
The details can be found at BEA website
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have prepared a step by step procedure to Deploy a EJB on weblogic 6 & 7 and it works on weblogic 8 also if u feel any problem pls send me mail with details.
1.Create a directory where you are going to write all your session beans(Applicable to both Stateless and stateful ).
2.If your session beans are to be in a package then a good option would be to use JCreator for compilation otherwise you have to compile always with the �d option and have to create complicated batch files with classpath settings.
3.For eg. if you have a package statement like -
package examples.SessionBeans;
Then you need to have a directory called examples inside which you need to have a directory called SessionBeans or some Name.
4.Inside the SessionBeans directory put your Home Interface, Remote Interface and Bean classes.
5.Inside the SessionBeans directory create a directory called "META-INF". Note that all the letters should be in capital.
6.In the META-INF directory put your ejb-jar.xml. This you will get along with any sample code.u can search in bea folder also.
7. You need to create another file called weblogic-ejb-jar.xml with the following lines
<?xml version="1.0"?>
<!DOCTYPE weblogic-ejb-jar PUBLIC "-//BEA Systems, Inc.//DTD WebLogic 6.0.0 EJB//EN" "http://www.bea.com/servers/wls600/dtd/weblogic-ejb-jar.dtd">
The ejb name that you specify should be same as the one you specify in the ejb-jar.xml. The jndi-name is the one you should use when looking up the home from the JNDI tree.
8. Create a jar file from one level above the package structure where your class files are.
For eg. if your classes are in a package called examples.SessionBeans, the jar file should be created from one directory above the examples directory.
9.Open the jar file in winzip and make sure the directory structure is OK and the XML files are inside the META-INF directory.
10. You now need to do an ejb compilation. Though this is not mandatory it is very useful as it checks your bean�s validity. If your ejbc goes through successfully you can be sure that your bean will be deployed successfully.
The command for ejbc is as follows
java weblogic.ejbc -g -classpath %CLASSPATH% -compiler javac <src-file> <dest-file>
For ease of use, create a batch file called ejbc.bat and put the following lines in it
set classpath=C:\bea\weblogic700\server\lib\weblogic.jar;
java weblogic.ejbc -g -classpath %CLASSPATH% -compiler javac %SOURCE_JAR% %DEST_JAR%
Make sure the classpath is OK.
The bat file can be used as follows
ejbc <Source-bean-jar> <Source-bean-deployable-jar>
For eg.
ejbc UserBean.jar UserBeanDeployable.jar
11. You now have a Enterprise Java bean that is ready to be deployed !!!
12. In Weblogic 7.0 put the jar file created as a result of the ejbc in the following directory
C:\bea\samples\server\config\examples\applications. For Weblogic 6.0 or 6.1 there should be a similar directory called applications where you place your code.
13. Start the Weblogic server. Note that you can put the file here even after you have started the server, any files that are added to this directory are automatically deployed, any that are removed are undeployed and any file whose time stamp changes will be redeployed.
14. If you have a client that you need to run to call the methods of this bean do so with the following class file.
set classpath=.;c:\bea\weblogic700\server\lib\weblogic.jar;
java -Djava.naming.factory.initial=weblogic.jndi.TengahInitialContextFactory -Djava.naming.provider.url=t3:// <Client-java-class>
You can set the Initial context factory and naming provider url even inside your code if you want but this is a better way. The �D option basically sets a System property.
15.You have now deployed and tested a Session Bean
pls don't do step 10 i mean EJB COmpilation if ur a Beginner.
After ur bean will be Deployed u can check from the Console or the CMD prompt of server where ur Beans name will appear.
i would suggest u to follow Ed Roman book n do first "Hello World" Example so that u Deploy n test. u can get a book of EDRoman Mastering ejb from www.theserverside.com.
eric lee
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks everyone, i will try that.
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic