• 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

Regarding Deploying Ejb in Weblogic server 5.1

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have just started doing ejbs.. i wrote first example using statelessSessionBean .. aim is to print "hello world"..for this i have written remote interface,home interface, session bean and client .. but the problem is that i dont know how to write "ejb-jar.xml" file and also "weblogic-ejb-jar.xml" file so please help me out with step by step guide to deploying ejb in weblogic server 5.1 and how to create "ejb-jar.xml file" and "weblogic-ejb-jar.xml" file manaually along with the entire solution for deploying.
E-mail:sood_vibhor@yahoo.com
thanks
vibhor
 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Vibhor,
Please refer to examples directory of weblogic 5.1.Copy one ejb-jar.xml,weblogic-jar.xml files to your directory.Change the same as per your requirement.
Following is the ejb-jar.xml for a stateless session bean
<?xml version="1.0"?>
< !DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN' 'http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd'>
<ejb-jar>
<small-icon>images/green-cube.gif</small-icon>
<enterprise-beans>
<session>
<small-icon>images/orange-cube.gif</small-icon>
<ejb-name>statelessSession</ejb-name>
<home>examples.ejb.basic.statelessSession.TraderHome</home>
<remote>examples.ejb.basic.statelessSession.Trader</remote>
<ejb-class>examples.ejb.basic.statelessSession.TraderBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<env-entry>
<env-entry-name>WEBL</env-entry-name>
<env-entry-type>java.lang.Double </env-entry-type>
<env-entry-value>10.0</env-entry-value>
</env-entry>
<env-entry>
<env-entry-name>INTL</env-entry-name>
<env-entry-type>java.lang.Double </env-entry-type>
<env-entry-value>15.0</env-entry-value>
</env-entry>
<env-entry>
<env-entry-name>tradeLimit</env-entry-name>
<env-entry-type>java.lang.Integer </env-entry-type>
<env-entry-value>500</env-entry-value>
</env-entry>
</session>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>statelessSession</ejb-name>
<method-intf>Remote</method-intf>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>
Here's the weblogic-jar.xml

<?xml version="1.0"?>
< !DOCTYPE weblogic-ejb-jar PUBLIC '-//BEA Systems, Inc.//DTD WebLogic 5.1.0 EJB//EN' 'http://www.bea.com/servers/wls510/dtd/weblogic-ejb-jar.dtd'>
<weblogic-ejb-jar>
<weblogic-enterprise-bean>
<ejb-name>statelessSession</ejb-name>
<caching-descriptor>
<max-beans-in-free-pool>100</max-beans-in-free-pool>
</caching-descriptor>
<jndi-name>statelessSession.TraderHome</jndi-name>
</weblogic-enterprise-bean>
</weblogic-ejb-jar>

and here's the build file you have run after creating above files
It's .cmd file
@REM Copyright (c) 2000 BEA Systems, Inc. All Rights Reserved.
@REM Adjust these variables to match your environment
if "" == "%JAVA_HOME%" set JAVA_HOME=\java
if "" == "%WL_HOME%" set WL_HOME=\weblogic
set MYSERVER=%WL_HOME%\myserver
set MYCLASSPATH=%JAVA_HOME%\lib\classes.zip;%WL_HOME%\classes;%WL_HOME%\lib\weblogicaux.jar;%MYSERVER%\clientclasses
@REM Create the build directory, and copy the deployment descriptors into it
mkdir build build\META-INF build\images
copy *.xml build\META-INF
copy *.gif build\images
@REM Compile ejb classes into the build directory (jar preparation)
javac -d build -classpath %MYCLASSPATH% Trader.java TraderHome.java TradeResult.java TraderBean.java
@REM Make a standard ejb jar file, including XML deployment descriptors
cd build
jar cv0f std_ejb_basic_statelessSession.jar META-INF examples images
cd ..
@REM Run ejbc to create the deployable jar file
java -classpath %MYCLASSPATH% -Dweblogic.home=%WL_HOME% weblogic.ejbc -compiler javac build\std_ejb_basic_statelessSession.jar %MYSERVER%\ejb_basic_statelessSession.jar
@REM Compile ejb interfaces & client app into the clientclasses directory
javac -d %MYSERVER%\clientclasses -classpath %MYCLASSPATH% Trader.java TraderHome.java TradeResult.java Client.java
This is for the Trader Example.Please check your jdk path in the build.cmd file.
I hope this will give you lot of inputs for further exploring the EJB.Wish you Happy Exploring EJB.
Bye,
Mahesh
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic