How to setup Weblogic official sample - EJB

1. Download weblogic installer from www.oracle.com



2. Install Weblogic


$ sudo xhost + # in case current user cannot access Xwindow

access control disabled, clients can connect from any host


$ java -jar fmw_12.2.1.0.0_wls.jar


# it needs full installation with samples

# then weblogic isinstalled at $ORACLE_HOME/wlserver

# and the samples isat $ORACLE_HOME/wlserver/samples

# btw, for more details please reference to index.html under

$ORACLE_HOME/wlserver/samples/server



3. Create a Weblogic domain


$ cd $ORACLE_HOME/oracle_common/common/bin

$ sh config.sh #configuration wizard


# create a domain by default at $ORACLE_HOME/user_projects/domains/base_domain



4. Start the domain


$ cd $ORACLE_HOME/user_projects/domains/base_domain

$ startWebLogic.sh &     # start domain


URL - http://localhost:8001/console/



5. Customize example properties


$ cd $ORACLE_HOME/wlserver/samples/server/examples/src

$ vi examples.properties


# for example:

<bea.home=@BEA_HOME

<wl.home=@WL_HOME

---

>bea.home=/home/weblogic/orahome # ORACLE_HOME

>wl.home=${bea.home}/wlserver

13,14c13,14

<wls.hostname=@SERVER_HOST

<wls.port=@LISTEN_PORT

---

>wls.hostname=localhost

> wls.port=8001

16,17c16,17

<wls.username=@DOMAIN_USERNAME

<wls.password=@DOMAIN_USER_PASSWORD

---

>wls.username=scott

>wls.password=tiger000

22c22

<examples.home.dir=@WL_HOME/samples/server/examples

---

>examples.home.dir=${wl.home}/samples/server/examples



6. Prepare data forDerby


$ cd $ORACLE_HOME/wlserver/samples/server

$ . ./setExamplesEnv.sh # set environment variables


$ cd examples/common/ddl

$ ant db.setup.derby    # Generating Derby Data



7. Define Data source in console


Name -examples-demoXA

JNDI Name - examples-dataSource-demoXAPool

Database Type - Derby

Database Driver - Derby's Driver (Type 4 XA) Versions: Any



8. Define Messaging


JMS Servers - examplesJMSServer

JMS Modules - examplesJMSModule


# then define resources under the module

1) Queue

Name- weblogic.examples.ejb30.ExampleQueue

JNDI Name - weblogic.examples.ejb30.ExampleQueue

2) ConnectionFactory

Name - weblogic.examples.ejb30.QueueConnectionFactory

JNDI Name - weblogic.examples.ejb30.QueueConnectionFactory


Note:

A Subdeployment is needed for Queue and Connection Factory, however, I always encounter

following issues, so I have to use a workaround: create 2 Subdeployments respectively for them.

>>>>>

weblogic.management.configuration.ServerMBeanImpl cannot be cast to weblogic.management.configuration.JMSServerMBean

<<<<<

or

>>>>>

TheSubDeploymentMBean examplesSub in deployment examplesJMSModule canonly be targeted to one JMSServerMBean because an entity that canonly be targeted to a single JMS server (for example a queue, topicor quota) has a sub-deployment-name element with value examplesSub

<<<<<



9. Prepare EJB sample


$ cd $ORACLE/wlserver/samples/server/examples/src/examples/ejb/ejb30

$ ant build

$ ant deploy



10. Run the sample


URL - http://localhost:8001/reviewService/





發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章