---
title: "Weblogic 10 Ejb3 Message Bean 配置 Weblogic JMS 配置 Weblogic 10 EJB3 例子安装 "
author: "keyboardsun"
date: "2009-07-28T17:09:01Z"
tags: []
slug: "weblogic-10-ejb3-message-bean-weblogic-jms-weblogic-10-ejb3"
draft: false
lastmod: "2009-07-28T17:09:01Z"
id: 434675
url: "https://keyboardsun.iteye.com/blog/434675"
---

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,笨蛋式安装开始。

 

![直接默认安装](http://p.blog.csdn.net/images/p_blog_csdn_net/keyboardsun/EntryImages/20090719/j1.jpg)

 

然后点击NEXT,缺省选择

然后点击NEXT,缺省选择

然后点击NEXT,缺省选择

然后点击完成。

靠，这下问题来了。

系统报错，报pointbase 什么manager找不到，什么问题呢，我把这个安装包给解压了开来，打开

domain.jar/META-INF/persistence.xml的内容有如下片段。

 

    &lt;properties&gt;  
      &lt;property name="kodo.ConnectionURL" value="jdbc:pointbase:server://localhost:9092/demo"/&gt;  
      &lt;property name="kodo.ConnectionDriverName" value="com.pointbase.jdbc.jdbcUniversalDriver"/&gt;  
      &lt;property name="kodo.ConnectionUserName" value="examples"/&gt;  
      &lt;property name="kodo.ConnectionPassword" value="examples"/&gt;  
      &lt;property name="kodo.jdbc.SynchronizeMappings" value="refresh"/&gt;  
    &lt;/properties&gt;

 

一看，我明白了，原来这个默认的玩意配置的数据库是这个玩意啊，我机器上有现成的mysql，我改成mysql试试吧。把以上内容改成

      &lt;property name="kodo.ConnectionURL" value="jdbc:mysql://localhost:3306/web"/&gt;  
      &lt;property name="kodo.ConnectionDriverName" value="com.mysql.jdbc.Driver"/&gt;  
      &lt;property name="kodo.ConnectionUserName" value="root"/&gt;  
      &lt;property name="kodo.ConnectionPassword" value="admin"/&gt;  
      &lt;property name="kodo.jdbc.SynchronizeMappings" value="refresh"/&gt;

 

重新打包回去，然后继续发布。嗯，这下好了，没这个错误了。

 

我们看看mysql数据库里面发生了什么？？

 

 

![](http://p.blog.csdn.net/images/p_blog_csdn_net/keyboardsun/EntryImages/20090719/J2.jpg)

 

应用给表创建了以上我选择的表了，说明利用mysql还是可以的。

 

但是后台有以下输出。

 

&lt;2009-7-19 上午12时15分10秒 CST&gt; &lt;Warning&gt; &lt;EJB&gt; &lt;BEA-010061&gt; &lt;The Message-Driven EJB: WatchProcessMDB is unable to conn  
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'&gt;  
119047  reviewService  INFO   \[\[STANDBY] ExecuteThread: '4' for queue: 'weblogic.kernel.Default (self-tuning)'] openjpa.  
jdbc.JDBC - Shutting down connection pool.  
&lt;2009-7-19 上午12时15分33秒 CST&gt; &lt;Warning&gt; &lt;netuix&gt; &lt;BEA-423420&gt; &lt;Redirect is executed in begin or refresh action. Redir  
ect url is /console/console.portal?\_nfpb=true&\_pageLabel=AppDeploymentsControlPage.&gt;  
&lt;2009-7-19 上午12时15分47秒 CST&gt; &lt;Warning&gt; &lt;netuix&gt; &lt;BEA-423420&gt; &lt;Redirect is executed in begin or refresh action. Redir  
ect url is /console/console.portal?\_nfpb=true&\_pageLabel=AppDeploymentsControlPage.&gt;  
&lt;2009-7-19 上午12时26分30秒 CST&gt; &lt;Warning&gt; &lt;EJB&gt; &lt;BEA-010061&gt; &lt;The Message-Driven EJB: WatchProcessMDB is unable to conn  
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&gt;  
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".  
&lt;2009-7-19 上午12时26分31秒 CST&gt; &lt;Warning&gt; &lt;netuix&gt; &lt;BEA-423420&gt; &lt;Redirect is executed in begin or refresh action. Redir  
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.&gt;  
&lt;2009-7-19 上午12时27分30秒 CST&gt; &lt;Warning&gt; &lt;JMSPool&gt; &lt;BEA-169808&gt; &lt;There was an error while making the initial connectio  
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'&gt;

 

一看就明白了。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

![](http://p.blog.csdn.net/images/p_blog_csdn_net/keyboardsun/EntryImages/20090719/j3.jpg)

 

点击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](console/console.portal?_nfpb=true&_pageLabel=HomePage1) &gt;[Summary of JMS Servers](console/console.portal?_nfpb=true&_pageLabel=JmsServerJMSServerTablePage) &gt;[Summary of Store-and-Forward Agents](console/console.portal?_nfpb=true&_pageLabel=JmsSAFAgentSAFAgentTablePage) &gt;[JMS Modules](console/console.portal?_nfpb=true&_pageLabel=JmsModulesTablePage) &gt;[Summary of JMS Bridge Destinations](console/console.portal?_nfpb=true&_pageLabel=JmsBridgedestinationJMSBridgeDestinationTablePage) &gt;[Summary of Servers](console/console.portal?_nfpb=true&_pageLabel=CoreServerServerTablePage) &gt;[Summary of Security Realms](console/console.portal?_nfpb=true&_pageLabel=SecurityRealmRealmTablePage) &gt;[Summary of Deployments](console/console.portal?_nfpb=true&_pageLabel=AppDeploymentsControlPage) &gt;[Summary of JMS Servers](console/console.portal?_nfpb=true&_pageLabel=JmsServerJMSServerTablePage) &gt;[JMS Modules](console/console.portal?_nfpb=true&_pageLabel=JmsModulesTablePage) &gt;SystemModule-0

 

然后点击New

![](http://p.blog.csdn.net/images/p_blog_csdn_net/keyboardsun/EntryImages/20090719/j4.jpg)

 

点击NEXT

 

![](http://p.blog.csdn.net/images/p_blog_csdn_net/keyboardsun/EntryImages/20090719/j5.jpg)

 

全部填写 weblogic.examples.ejb30.QueueConnectionFactory

点击NEXT

![](http://p.blog.csdn.net/images/p_blog_csdn_net/keyboardsun/EntryImages/20090719/j6.jpg)

 

点击 “Advanced Targeting”

 

![](http://p.blog.csdn.net/images/p_blog_csdn_net/keyboardsun/EntryImages/20090719/j7.jpg)

 

点击“Create a New Subdeployment”

 

然后点击 OK，下面有 Targets : 全不选。切记，别选。

然后点击 Finish。

 ![](http://p.blog.csdn.net/images/p_blog_csdn_net/keyboardsun/EntryImages/20090719/j8.jpg)

 

点击 weblogic.examples.ejb30.QueueConnectionFactory 到Transactions Tab页，勾选 XA Connection ......选项，SAVE

 

然后同样的方式新建队列。

![](http://p.blog.csdn.net/images/p_blog_csdn_net/keyboardsun/EntryImages/20090719/j9.jpg)

 

点击NEXT,名称全部写 weblogic.examples.ejb30.ExampleQueue

 

点击NEXT,然后 Subdeployments 选择刚才新建的那个。

![](http://p.blog.csdn.net/images/p_blog_csdn_net/keyboardsun/EntryImages/20090719/j10.jpg)

 

然后点击Finish完成。

 

然后重启动server吧。

 

然后在IE 里面输入

 

[http://localhost:7001/reviewService](http://localhost:7001/reviewService)

 

欣赏WEBLOGIC自带的sample吧，

如果这里页面是404错误，那应该是应用没有启动，需要到控制台把应用启动下就OK了。

 

本文的 主要讲解的JMS的配置问题。

 

作者 keyboardsun