Weblogic 10 Ejb3 Message Bean 配置 Weblogic JMS 配置 Weblogic 10 EJB3 例子安装 收藏
Weblogic 10 Ejb3 Message Bean 配置 Weblogic JMS 配置 Weblogic 10 EJB3 例子安装
今天研究EJB3,在JBOSS环境上玩了一把,但是WAS 6.1不支持EJB3,不爽啊,就到Weblogic下面再玩玩吧。一看Weblogic 10 的安装目录里面有个EJB3的很强大的例子,嗯,心想,这个不错,省事啊,直接安装得了。
但是令人不爽的问题是很多的,Weblogic 10 的JMS配置跟Weblogic 8 的不一样,配置了N下,也还是不能用,后台报错。
不管了,现在我们安装把,出问题了,然后就改呗,也是一个让大家学习的过程。
1,笨蛋式安装开始。
然后点击NEXT,缺省选择
然后点击NEXT,缺省选择
然后点击NEXT,缺省选择
然后点击完成。
靠,这下问题来了。
系统报错,报pointbase 什么manager找不到,什么问题呢,我把这个安装包给解压了开来,打开
domain.jar/META-INF/persistence.xml的内容有如下片段。
一看,我明白了,原来这个默认的玩意配置的数据库是这个玩意啊,我机器上有现成的mysql,我改成mysql试试吧。把以上内容改成
重新打包回去,然后继续发布。嗯,这下好了,没这个错误了。
我们看看mysql数据库里面发生了什么??
应用给表创建了以上我选择的表了,说明利用mysql还是可以的。
但是后台有以下输出。
<2009-7-19 上午12时15分10秒 CST>
ect to the JMS destination: weblogic.examples.ejb30.ExampleQueue. The Error was:
weblogic.jms.common.JMSException: javax.naming.NameNotFoundException: Unable to resolve 'weblogic.jms.backend.JMSServer-
0'. Resolved 'weblogic.jms.backend'; remaining name 'JMSServer-0'
Nested exception: weblogic.jms.common.JMSException: javax.naming.NameNotFoundException: Unable to resolve 'weblogic.jms.
backend.JMSServer-0'. Resolved 'weblogic.jms.backend'; remaining name 'JMSServer-0'
Nested exception: weblogic.jms.common.JMSException: javax.naming.NameNotFoundException: Unable to resolve 'weblogic.jms.
backend.JMSServer-0'. Resolved 'weblogic.jms.backend'; remaining name 'JMSServer-0'
Nested exception: javax.naming.NameNotFoundException: Unable to resolve 'weblogic.jms.backend.JMSServer-0'. Resolved 'we
blogic.jms.backend'; remaining name 'JMSServer-0'>
119047 reviewService INFO [[STANDBY] ExecuteThread: '4' for queue: 'weblogic.kernel.Default (self-tuning)'] openjpa.
jdbc.JDBC - Shutting down connection pool.
<2009-7-19 上午12时15分33秒 CST>
ect url is /console/console.portal?_nfpb=true&_pageLabel=AppDeploymentsControlPage.>
<2009-7-19 上午12时15分47秒 CST>
ect url is /console/console.portal?_nfpb=true&_pageLabel=AppDeploymentsControlPage.>
<2009-7-19 上午12时26分30秒 CST>
ect to the JMS destination: weblogic.examples.ejb30.ExampleQueue. The Error was:
Can not get distribute destination information. The destination JNDI name is weblogic.examples.ejb30.ExampleQueue, the p
rovider URL is null>
0 reviewService INFO [[STANDBY] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'] openjpa.Runti
me - Starting BEA Kodo 4.2.0load03
0 reviewService INFO [[STANDBY] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'] openjpa.jdbc.
JDBC - Using dictionary class "org.apache.openjpa.jdbc.sql.MySQLDictionary".
<2009-7-19 上午12时26分31秒 CST>
ect url is /console/console.portal?_nfpb=true&_pageLabel=AppApplicationOverviewPage&AppApplicationOverviewPortlethandle=
com.bea.console.handles.AppDeploymentHandle%28%22com.bea%3AName%3DreviewService%2CType%3DAppDeployment%22%29.>
<2009-7-19 上午12时27分30秒 CST>
n to the JMS resource named weblogic.examples.ejb30.QueueConnectionFactory from the EJB "ReviewListenerBean" inside appl
ication "reviewService". The server will attempt the connection again later. The error was javax.jms.JMSException: [JMSP
ool:169803]JNDI lookup of the JMS connection factory weblogic.examples.ejb30.QueueConnectionFactory failed: javax.naming
.NameNotFoundException: Unable to resolve 'weblogic.examples.ejb30.QueueConnectionFactory'. Resolved 'weblogic.examples.
ejb30'; remaining name 'QueueConnectionFactory'>
一看就明白了。JMS没有配置。那我们去给Weblogic 配置JMS吧,我打开
public class ReviewListenerBean implements ReviewListener {
//The JNDI name of the Queue Connection Factory referenced here is specified by the mappedName attribute of @Resource,
//which can be overwritten in weblogic-ejb-jar.xml.
@Resource(name = "jms/mdbQCF", mappedName = "weblogic.examples.ejb30.QueueConnectionFactory")
private QueueConnectionFactory mdbQCF;
//The JNDI name of the Queue referenced here is specified by the mappedName attribute of @Resource,
//which can be overwritten in weblogic-ejb-jar.xml.
@Resource(name = "jms/mdbQueue", mappedName = "weblogic.examples.ejb30.ExampleQueue")
知道了需要配置的QueueFactory是 weblogic.examples.ejb30.QueueConnectionFactory
Queue是 weblogic.examples.ejb30.ExampleQueue
2,配置JMS。
第一步,创建一个JMS Server
点击New
新增一个JMS Server,
点击NEXT ,默认选项
点击NEXT,选择TARGET为当前的Server,如果是默认的Domain的话,应该是AdminServer
然后点击FINISH。成功创建JMS Server.
第二步,创建 JMS Modules。
点击Domain Structure -- Services -- Messaging--JMS Modules
然后点击NEW 按钮。
NEXT ,默认选项,
NEXT, Targets 选择 AdminServer.
然后NEXT, FINISH.
点击新建的 SystemModule-0,路径如下所示。
Home >Summary of JMS Servers >Summary of Store-and-Forward Agents >JMS Modules >Summary of JMS Bridge Destinations >Summary of Servers >Summary of Security Realms >Summary of Deployments >Summary of JMS Servers >JMS Modules >SystemModule-0
然后点击New
点击NEXT
全部填写 weblogic.examples.ejb30.QueueConnectionFactory
点击NEXT
点击 “Advanced Targeting”
点击“Create a New Subdeployment”
然后点击 OK,下面有 Targets : 全不选。切记,别选。
然后点击 Finish。
点击 weblogic.examples.ejb30.QueueConnectionFactory 到Transactions Tab页,勾选 XA Connection ......选项,SAVE
然后同样的方式新建队列。
点击NEXT,名称全部写 weblogic.examples.ejb30.ExampleQueue
点击NEXT,然后 Subdeployments 选择刚才新建的那个。
然后点击Finish完成。
然后重启动server吧。
然后在IE 里面输入
http://localhost:7001/reviewService
欣赏WEBLOGIC自带的sample吧,
如果这里页面是404错误,那应该是应用没有启动,需要到控制台把应用启动下就OK了。
本文的 主要讲解的JMS的配置问题。
作者 keyboardsun
转载请标明出处:http:/blog.csdn.net/keyboardsun
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/keyboardsun/archive/2009/07/19/4360606.aspx
1.
进入weblogic admin console,点击菜单中Serivices-Messaging-JMS Servers,点击New按钮,如下图:
输入JMS Server名称(任意名称,如JMSServer-OCS,Persistent Store为none,如下图
点击Next,选择Target为Server,如下图
点击Finish后,回到主页面,点击Active Changes,如下图:
点击菜单Services-Messaging-JMS Modules,点击New按钮,如下图
输入Module名称,如SystemModule-OCS,点击next,如下图:
选中Target为server名称,如下图:
点击Finish按钮,回到主页面,如下图:
回到主页面后,点击Active Changes,如下图:
点击进入刚创建完成的module中,点击new按钮,如下图:
在出现的Create JMS Module Resources页面中,选中Connection Factory,再点击next,如下图:
输入Connection Factory的名称,如ConnectionFactory-OCS,JNDI名称为jms.ConnectionFactory.OCS,如下图
点击Finish,回到主页面,点击Active Changes,如下图:
点击进入刚创建完成的module中,点击new按钮,如下图:
在Create Resoure页面选择Queue,然后点击next,如下图:
输入Queue的名称,如Queue-OCS,JNDI名称为jms.Queue.OCS,点击next,如下图:
在此页面中点击“Create a new subdeployment”,如下图:
输入subdeployment名称,如subdeploy-OCS,点击OK,如下图:
在此页面中选中刚创建的subdeployment,Target中选中刚创建的JMS Server,点击Finish,如下图:
回到主页面,点击Active Changes按钮,如下图:
Services -> JDBC -> Data Sources 选择具体的Data Sources进入设置页面,选择Connection Pool链接
设置
Initial Capacity:25
Maximum Capacity:50
Capacity Increment:5
设置完成后保存并生效
¥29.8
¥9.9
¥59.8