oppor7plus微信双开可以微信指纹支付吗

JMS+Oracle&Advanced&Queue(AQ)用法实践
&作者:杨大友,余川 测试员:王健
开发工具:Oracle Jdeveloper 10131
软硬件环境:
操作系统linux redhat 3.0 数据库为Oracle 10G 10.0.2
应用服务器为SOA Application Server 10131
开发语言:java
关于体系结构,说多了也让人觉得晕.我直接示例一个做法,至于理解,就慢慢看书吧!
创建Oracle AQ
首先以超级用户登陆数据库,修改必要参数,建立AQ用户,并给权限.我是使用sqlplus
Conn sys/******@SID as sysdba
Alter system set AQ_TM_PROCESSES=6
Alter system set JOB_QUEUE_PROCESSES=10
Create user aq identified by aq1234 default tablespace users
temporary tablespace temp quot
Grant connect,
Grant aq_administrator_
Grant execute on dbms_
Grant execute on dbms_
Grant enqueue any queue,deq
在这插一句,这样创建只是为了便于操作,大家在外面使用应该再创建用户,只需要授予connect,resource,操作dbms_aqadm和dbms_aq的权限就足够了.如果你想用一个用户操作另外一个用户的queue(比如aq1操作aq创建的queue),那么只需要执行下面的命令:
Conn aq/aq1234@sid
dbms_aqadm.grant_queue_privilege(‘enqueue’,’aq_queue’,’aq1’,false);
解释:第一个参数是权限,可以有三个值,enqueue,dequeue,all(all就是前面两个都有).第二个参数是queue的名字,第三个参数的把权限给哪个人,第四个的意思,暂不明白,就不说.
下面就是建立queue
tables和queue的时间了.用oem来创建是最简单的,大家自己看一下,我把用命令创建的过程说下:
Conn aq/aq1234@sid
--create a queue table.
BEGIN&&&&&&&
dbms_aqadm.create_queue_table(&&&&&&&&&
queue_table=&'JMSTEST_QT',&&&&&&&&&
queue_payload_type=&'SYS.AQ$_JMS
_MESSAGE',&&&&&&&&&
multiple_consumers =&
false,&&&&&&&&&
comment =& 'Queue Table For Resource Provider');
--create a queue
dbms_aqadm.create_queue
queue_name =&
'JMSTEST',&&&
queue_table =& 'JMSTEST_QT');&
--start this queue
EXECUTE dbms_aqadm.start_queue (queue_name=&'JMSTEST')
建立JMS目标
打开SOA应用服务器.默认安装应该是
登陆名:oc4jadmin 密码:***
我在这里只谈一下数据库持久的JMS
我的是kevin.user
点这个应用服务器进入,先创建一个OC4J,名字为JMS(当然,这个名字你自己取).启动这个OC4J实例.
然后到主页,点JMS,然后是管理.把这些全部展开,可以看到服务这个节点.,先选择JDBC资源配置.然后创建一个新的数据源,选择本机数据源,其他默认进入下一步.填上名称,JNDI位置,JDBC
URL,用户名和口令,就是aq和aq1234.然后完成,测试一下,看通不通.
我的名称是”demodb”,JNDI位置是”jms/demodb”.
然后在企业消息传送服务节点下有个数据库持久性.现在来配置这个.
点部署,资源适配器模块名就取一个名字吧,下面选择第二个,就可以选到你刚才配置的JDBC数据源了.确定.我取的模块名是jmstest.
然后回到刚才的OC4J页面,有个节点是JMS目标,就选这个.如果是基于文件的和基于内存的,就要选JMS连接工厂
点了JMS目标后,选新建,取个目标名字吧,我的是JMSTEST,持久性选基于数据库的持久性,如果前面没有配数据库持久性,这里就不能选.确定就创建好了.下面进入编程阶段.
开发应用程序
我用的JD建了一个servlet发送消息,收消息就是一个onMessage方法,自己研究了.
import java.io.IOE
import java.io.PrintW
import javax.jms.M
import javax.jms.Q
import javax.jms.QueueC
import javax.jms.QueueConnectionF
import javax.jms.QueueS
import javax.jms.QueueS
import javax.jms.S
import javax.naming.C
import javax.naming.InitialC
import javax.servlet.*;
import javax.servlet.http.*;
public class SendMsg extends HttpServlet {
&&& private
static final String CONTENT_TYPE = "text/ charset=GBK";
&&& public
void init(ServletConfig config) throws ServletException {
super.init(config);
&&& public
void service(HttpServletRequest request,
&&&&&&&&&&&&&&&&&&&&&&&
HttpServletResponse response) throws ServletException, IOException
{response.setContentType(CONTENT_TYPE);
PrintWriter out = response.getWriter();
&&&&out.println("&html&");
out.println("&head&&title&SendMsg&/title&&/head&");
out.println("&body&");
&&&&&&&&&&&
//get the initial context
&&&&&&&&&&&
Context jndiContext=new InitialContext();
&&&&&&&&&&&
//lookup the queuetable and create the queueconnectionfactory
&&&&&&&&&&&
QueueConnectionFactory
queueCF=(QueueConnectionFactory)jndiContext.lookup("java:comp/resource/demodb/QueueConnectionFactories/JMSTEST_QT");
&&&&&&&&&&&
//create a connection to the queuetable
&&&&&&&&&&&
QueueConnection
queueconnection=queueCF.createQueueConnection();
&&&&&&&&&&&
//start the connection
&&&&&&&&&&&
queueconnection.start();
&&&&&&&&&&&
//create a session to the queue
&&&&&&&&&&&
QueueSession
queuesession=queueconnection.createQueueSession(true,Session.AUTO_ACKNOWLEDGE);
&&&&&&&&&&&
//create a queue
&&&&&&&&&&&
queue=(Queue)jndiContext.lookup("java:comp/resource/demodb/Queues/JMSTEST");
&&&&&&&&&&&
//create an object through which this program enqueues
&&&&&&&&&&&
QueueSender sender=queuesession.createSender(queue);
&&&&&&&&&&&
//create a Text message to be enqueued
&&&&&&&&&&&
Message msg=queuesession.createTextMessage("hello kevin!");
&&&&&&&&&&&
//enqueue the message in the queue
&&&&&&&&&&&
sender.send(msg);
&&&&&&&&&&&
&&&&&&&&&&&
queuesession.close();
catch(Exception ex) {
&&&&&&&&&&&
ex.printStackTrace();
out.println("&/body&&/html&");
out.close();
也可以直接在数据库端看看你发的消息,用一个存储过程.
deqopt dbms_aq.dequeue_options_t;
mprop dbms_aq.message_properties_t;
msgid RAW(16);
payload SYS.AQ$_JMS_MESSAGE;
deqopt.navigation := DBMS_AQ.FIRST_MESSAGE;
deqopt.wait := 1;
dbms_aq.dequeue(
queue_name =& 'jmstest',
dequeue_options =& deqopt,
message_properties =& mprop,
payload =& payload,
msgid =& msgid
dbms_output.put_line('The Message Sent to the Queue is: ' ||
payload.TEXT_VC);
结果: The Message Send to the Queue is: hello,Kevin!
忘记告诉配置文件的问题了,罪过罪过,补上!
在程序开发完成后,有个文件projectname-oc4j-app.xml文件,在里面加上这么一段
&resource-provider
class="oracle.jms.OjmsContext"
name="demodb"&&&
&description& OTN How-to to configure Resource
Provider&/description&&&
&property name="datasource"
value="jdbc/jmsdbDS"&&&
&/property& &/resource-provider&
当然,我的数据源(datasource)和你们的肯定不一样,你们自己建立自己的数据源了.
resource-provider的name选项必须和程序中的java:comp/resource/demodb/QueueConnectionFactories/JMSTEST_QT中的demodb一样,否则程序会报找不到资源的错误.各位好运!!!
以上网友发言只代表其个人观点,不代表新浪网的观点或立场。Driver Support
WebLogic AQ JMS requires a JDBC driver to communicate with the Oracle database. Only the Oracle JDBC 11g thin driver, included in your WebLogic Server installation, is supported for this release. Oracle OCI JDBC Driver and non-Oracle JDBC Drivers are not supported.
Transaction Support
Global XA (JTA) transactions and local JMS transacted session transactions are supported. Global transactions require use of XA based connection factories, while local transactions use non-XA based JMS connection factories.
If you select a non-XA JDBC driver, you can only use WebLogic AQ JMS in local transactions.
If you select an XA JDBC driver, you can use WebLogic AQ JMS in both local and global transactions.
This release does not support non-XA JDBC driver data sources with any of the global transaction options such as Logging Last Resource (LLR), One-Phase Commit (JTS), and Emulated Two-Phase Commit. If Supports Global Transactions is selected, WebLogic Server logs a warning message.
Global transactions are only supported with an XA JDBC driver One-Phase commit optimization. If you use the same XA capable data source for both AQ JMS and JDBC operations, the XA transactional behavior is equivalent to having two connections in a single data source that is treated as a single resource by the transaction manager. Therefore, if the AQ JMS and JDBC operations are invoked under the same JTA transaction, and no other resources are involved in the transaction, the transaction uses One-Phase commit optimization instead of Two-P otherwise read-only optimization is used.
in Programming JMS for Oracle WebLogic Server
Oracle RAC
WebLogic AQ JMS supports Oracle Real Application Clusters (Oracle RAC) with the use of WebLogic Multi Data Sources to provide failover in a Oracle RAC environment. See
in Configuring and Managing JDBC Data Sources for Oracle WebLogic Server.
MBean and Console Support
Except for purposes of interoperating with AQ JMS using a JMS Foreign Server, there are no AQ JMX specific MBeans and no support for configuring AQ JMS in the Administration Console. Use SQL scripts or other tools for AQ administration and monitoring, such as AQ queue table creation/removal, destination creation/removal, and statistics query.
Migrating from OC4J
For information on how to migrate your AQ JMS applications from Oracle OC4J to Oracle WebLogic Server, see
in Oracle Fusion Middleware Upgrade Guide for Java EE.
Configuring WebLogic Server to Interoperate with AQ JMS
The following sections provide information on one method of configuring AQ JMS queues and topics in an Oracle database and configuring a JMS foreign server in WebLogic Server so applications can lookup AQ JMS connection factories and destinations in the WebLogic JNDI context.
After you have prepared your AQ JMS queues and topics, you can perform the remaining configuration tasks using either the WebLogic Console or the WLST command line interface.
Configure Oracle AQ in the Database
Before you can start configuring your WebLogic Server resources, you need ensure that there are AQ JMS queues and topics in your Oracle database. The following sections describe one configuration method:
For more detailed information on using and configuring AQ, see .
Create Users and Grant Permissions
Create users in the database and grant them AQ JMS permissions. Use a database user with administrator privileges to perform the following task:
Using the Oracle SQL*Plus environment, log in with an administrator login.
Create the JMS user schema. For the following example, the user name is jmsuser and the password is jmsuserpwd.
Grant connect, resource TO jmsuser IDENTIFIED BY jmsuserpwd;
Grant the AQ user role to jmsuser.
Grant aq_user_role TO jmsuser;
Grant execute privileges to AQ packages.
Grant execute ON sys.dbms_aqadm TO jmsuser;
Grant execute ON sys.dbms_aq TO jmsuser;
Grant execute ON sys.dbms_aqin TO jmsuser;
Grant execute ON sys.dbms_aqjms TO jmsuser;
Create AQ Queue Tables
Each JMS queue or topic for AQ JMS is backed by an AQ queue table. Each queue table serves as a repository for JMS messages. A JMS queue or topic (see ) is a logical reference to the underlying AQ queue table.
AQ queue tables are created within individual JMS user schemas and can be defined using Oracle SQL*PLUS. For example:
connect jmsuser /
Configuring an AQ queue table requires a minimum of three parameters: the name of the queue table, the payload type, and a flag for whether the AQ queue table accepts multiple consumers. For example:
dbms_aqadm.create_queue_table(
queue_table=&"myQueueTable",
queue_payload_type=&'sys.aq$_jms_text_message',
multiple_consumers=&false
queue_table: The queue table name. Mixed case is supported if the database is 10.0 but the name must be enclosed in double quotes. Queue table names must not be longer than 24 characters.
queue_payload_type: The message type. Use sys.aq$_jms_message to support all JMS message interface types.
multiple_consumers: Set false set true for topics.
For more information on creating queue tables, see
in Oracle Database PL/SQL Packages and Types Reference.
Create a JMS Queue or Topic
AQ JMS queues are the JMS administrative resource for both queues and topics. Once the AQ queue table is created, you can create a AQ JMS queue within individual JMS user schemas using Oracle SQL*PLUS. For example:
connect jmsuser/jmsuserpwd;
The PL/SQL procedure for creating a queue or topic has the following form:
dbms_aqadm.create_queue(
queue_name=&'userQueue',
queue_table=&'myQueueTable'
queue_name is the user defined name for the JMS queue.
queue_table must point to an existing AQ queue table.
For more information on creating queue tables, see
in Oracle Database PL/SQL Packages and Types Reference.
Start the JMS Queue or Topic
Before first use, a AQ JMS queue must be started. Using the JMS user schema, execute the following PL/SQL procedure where queue_name represents the AQ JMS queue name.
connect jmsuser / jmsuserpwd
dbms_aqadm.start_queue(queue_name=&'userQueue'
For more information on starting queues, see
in Oracle Database PL/SQL Packages and Types Reference.
Configure WebLogic Server
The following sections provide information on how to configure WebLogic Server to interoperate with AQ JMS:
Configure a WebLogic Data Source
WebLogic Server applications (such as MDBs, EJBs, and Web apps) that use AQ JMS configure a data source for the Oracle database that provides the AQ JMS service. In most situations, this data source is dedicated to AQ JMS usage because it uses the JMS user and password to connect to the schema in the database. It does support multiple queues and topics if they are created in the schema used in the database connection. When configuring your data source:
Select the Oracle Thin Driver.
Select the driver type based on the type of transactions required for AQ JMS:
Select a non-XA based JDBC driver for use with AQ JMS in local transactions.
Select a XA based JDBC driver for use with AQ JMS in either in global transactions or in local transactions.
When configuring a data source for non-XA drivers, do not select the Supports Global Transactions option. This release does not support non-XA JDBC driver data sources with any of the global transaction options such as LLR, JTS, and Emulate Two-Phase Commit. If the global transaction option is selected, the server instance logs a warning message. Global transactions are supported with XA-based JDBC drivers.
Configure the database user name and password in the data source connection pool configuration. Identity-based connection pools are not supported.
in Configuring and Managing JDBC Data Sources for Oracle WebLogic Server.
in Oracle WebLogic Server Administration Console Help.
Data Source Tuning
Oracle recommends setting shrink-frequency-seconds to a small value in Oracle RAC environments.
For example: shrink-frequency-seconds=10
In the event of a failed connection, this allows a data source to remove the failed connection. See:
in Oracle WebLogic Server Administration Console Help.
in Configuring and Managing JDBC Data Sources for Oracle WebLogic Server.
Configure a JMS System Module
Configure a dedicated JMS system module to host a JMS foreign server for AQ resources. Target the module at the WebLogic Server instances or the cluster that needs to host the foreign JNDI names. See:
in Configuring and Managing JMS for Oracle WebLogic Server.
in Oracle WebLogic Server Administration Console Help.
Configure a JMS Foreign Server
In your JMS Foreign Server configuration:
Specify oracle.jms.AQjmsInitialContextFactory as the JNDI Initial Context Factory.
Configure the JDBC data sources needed for your application environment.
in Oracle WebLogic Server Administration Console Help.
Reference a Data Source
Specify the datasource JNDI property which is the JNDI location of a locally bound WLS data source.
For Example:
&foreign-server&
&initial-context-factory&oracle.jms.AQjmsInitialContextFactory&/initial-context-factory&
&jndi-property&
&key&datasource&/key&
&value&jdbc/aqjmsds&/value&
&/jndi-property&
&/foreign-server&
The value of the datasource JNDI property is the name of the data source configured to access the AQ JMS Oracle database. No other configuration information is required.
Configure JMS Foreign Server Connection Factories
Once you have created a JMS Foreign Server, you can create JNDI mappings for the AQ JMS connection factories in the WebLogic Server JNDI tree. Unlike destinations, AQ JMS does not require connection factories to be redefined in the Oracle database. Instead, a predefined JNDI name is specified when identifying the remote JNDI name for a connection factory. The remote JNDI name for the AQ JMS connection factory is one of the following:
Table 7-1 Remote JNDI names for AQ JMS Connection Factories
&AQ JMS Prefix Value&
JMS Interface
For example, consider two connection factories configured for an AQ JMS Foreign Server:
Table 7-2 AQ JMS Foreign Server Example Connection Factories
Local JNDI Name
RemoteJNDI Name
When a WebLogic application looks up a JMS factory at jms/aq/myCF, the application gets the AQ JMS object which implements the JMS javax.jms.ConnectionFactory interface. When a WebLogic application looks up a JMS factory at aq/orderXaTopicFactory, the application gets the AQ JMS object which implements the JMS javax.jms.XAToicConnectionFactory interface.
To configure a AQ JMS foreign server connection factory, you need to:
Specify Local and Remote JNDI names
The local JNDI name is the name that WebLogic uses to bind the connection factory into the WebLogic JNDI tree. The local JNDI name must be unique so that it doesn't conflict with an other JNDI name advertised on the local WebLogic Server.
The Remote JNDI name is the name that WebLogic passes to AQ JMS to lookup AQ JMS connection factories.
When configuring AQ JMS for use in global transactions, use an XA base otherwise configure a non-XA based connection factory.
No other configuration parameters are required.
"Create foreign connection factories" in Oracle WebLogic Server Administration Console Help.
Configure AQ JMS Foreign Server Destinations
When configuring an AQ JMS foreign destination, you need to configure the following:
Local JNDI name&the name that WLS uses to bind the destination into the WebLogic JNDI tree. The local JNDI name must be unique so that it doesn't conflict with any other JNDI names advertised on the local WebLogic Server instance.
Remote JNDI name&the name that WLS passes to AQ JMS to do a lookup. AQ JMS requires the Remote JNDI name to be in the following syntax:
If the destination is a queue, the remote JNDI name must be Queues/&queue name&.
If the destination is a topic, the remote JNDI name must be Topics/&topic name&
Similar to connection factories, AQ JMS destinations require a remote JNDI name with a prefix to identify the JMS object type. There are two values for destinations:
Table 7-3 AQ JMS Prefix Value of the JMS Interface
AQ JMS Prefix Value
JMS Interface
Unlike AQ JMS connection factory JNDI names, the value for the destination name represents the AQ JMS destination defined in the database. See
For example, consider the two destinations configured for an AQ JMS Foreign Server in the following table:
Table 7-4 Example AQ JMS Foreign Server Destinations
Local JNDI Name
Remote JNDI Name
A WebLogic application looking up the location jms/myQueue references the AQ JMS queue defined by userQueue. Looking up the location AqTopic references the AQ JMS topic defined by myTopic.
in Oracle WebLogic Server Administration Console Help.
Programming Considerations
The following sections provide information on advanced WebLogic AQ JMS topics:
Message Driven Beans
MDBs interoperate with AQ JMS by using a configured foreign server. See
The message driven parameters initial-context-factory and provider-url are not supported as these parameters are supplied as part of the JMS Foreign Server configuration. The destination type for the MDB destination in the ejb-jar.xml file should be configured to either: javax.jms.Queue or javax.jms.Topic. Additional MDB configuration is required to enable container managed transactions, durable topic subscriptions, and other MDB features.
SeeProgramming Message-Driven Beans for Oracle WebLogic Server.
AQ JMS Extensions
AQ JMS extension API's are supported by AQ JMS specific classes. You can invoke the AQ JMS extensions, after casting the standard JMS objects (such as connection factories and destinations) to proprietary AQ JMS classes.
When you use resource references for a AQ JMS connection factory, WebLogic Server wraps the underlying AQ JMS connection factory with a wrapper object. This wrapper object implements the JMS standard API, but it cannot cast it to an AQ JMS class which provides AQ JMS extension APIs. To avoid the wrapping, users can specify the java.lang.Object as the resource type of the resource reference instead of javax.jms.XXXConnectionFactory in the deployment descriptor. This limitation is specific to AQ JMS, as resource references only support extensions that are exposed using Java interfaces. AQ JMS does not define Java interfaces for its extensions. With AQ JMS, avoiding wrapping does not disable automatic JTA transaction enlistment, nor does it prevent pooling, as AQ JMS obtains these capabilities implicitly through its embedded use of WebLogic data sources.
Resource References
If you choose to use the resource references and the resource type is javax.jms.XXXConnectionFactory, WebLogic wraps the AQ JMS objects passed to a user application. If you also use the AQ JMS extension APIs, they must be unwrapped as described in
WebLogic resource reference wrappers do not automatically pool AQ JMS connections. Instead, AQ JMS server-side integration depends on data source connection pooling to mitigate the overhead of opening and closing JMS connections and sessions. WebLogic resource references disable pooling because the AQ JMS provider JMS connection factory is always pre-configured with a client identifier, which in turn, causes WebLogic resource references to disable its pooling feature.
JDBC Connection Utilization
An AQ JMS session holds a JDBC connection until the JMS session is closed, regardless of whether the connection uses a data source or a JDBC URL. Oracle recommends that you close an AQ JMS session if the session becomes idle for an extended period of time. Closing the JMS session releases the JDBC connection back to the WebLogic data source pool (see ) or releases the database and network resources for a JDBC URL.
Oracle RAC Support
The following section provides information on limitations in Oracle RAC environments:
Oracle RAC environments require the configuration of WebLogic Multi Data Sources to provide AQ JMS Oracle RAC failover. See
in Configuring and Managing JDBC Data Sources for Oracle WebLogic Server.
Oracle RAC failover is not supported when using a WebLogic AQ JMS stand-alone client for this release.
To use AQ JMS tracing and debugging, set the following system property: oracle.jms.traceLevel.
The value of this property is an integer ranging from 1 to 6 where a setting of 6 provides the finest level of detail. The trace output is directed to the standard output of the running JVM.
Performance Considerations
In releases prior to Oracle RDBMS 11.2.0.2, statistics on the queue table are locked by default which causes a full table scan for each dequeue operation. To work around this issue, unlock the queue tables and collect the statistics. For example:
exec DBMS_STATS.UNLOCK_TABLE_STATS ('&schema&','&queue table&');
exec DBMS_STATS.gather_table_stats('&schema&','&queue table&');
exec DBMS_STATS.LOCK_TABLE_STATS ('&schema&','&queue table&');
Advanced Topics
The following sections provide information on advanced interoperability topics when WebLogic Server applications interoperate with AQ JMS.
Security Considerations
Stand-alone clients and server-side applications have different security semantics and configuration. If security is a concern, read this section carefully and also reference the WebLogic lock-down document for general information on how to secure a WebLogic Server or Cluster (see ). The following section outlines security considerations for this release:
Configuring AQ Destination Security
ENQUEUE and/or DEQUEUE permission must be configured for the database user in AQ to allow destination lookups as well as to allow enqueues and dequeues.
The following usernames must be given enqueue and/or dequeue permission:
For stand-alone clients:
The configured JMS Foreign Server username, as specified using the java.naming.security.principal property.
For Java code that passes a username using the JMS ConnectionFactory API createConnection() method, this username requires permission.
For server-side applications:
The Database User Name is configured on the WebLogic Data Source.
Do not give permission for a username specified for JDBC Data Source clients that pass a username using the JMS ConnectionFactory API createConnection() method: this username is a WebLogic username, not a database username.
To understand which JDBC connection credentials and permissions that are used for AQ lookups, enqueues, and dequeues, see "Queue Security and Access Control" in .
Access to JNDI Advertised Destinations and Connection Factories
As described earlier, local JNDI names for connection factories and destinations must be configured as part of the JMS Foreign Server configuration task. You can optionally configure security policies on these JNDI names, so access checks occur during JNDI lookup based on the current WebLogic credentials. The current WebLogic credentials depend on the client type.
Once an application's WebLogic JNDI lookup security policy credential check passes for a destination, a JMS Foreign Server destination automatically looks up the destination resources in Oracle AQ using a JDBC connection.
For stand-alone clients, the credential used for the second part of a destination lookup process are based on the username and password that is configured on the JMS Foreign Server.
For server-side application JDBC Data Source clients, the credential used for this second destination lookup is based on the database username and password configured as part of the data source. Note that the credential used to gain access to this data source is the current WebLogic credential. It is possible to configure a WebLogic security policies on the data source. The WebLogic data source Identity Based Connection Pooling feature is not supported for this purpose.
As previously mentioned, the database credential must have AQ JMS enqueue or dequeue permission on a destination in order to be able to successfully lookup the destination. See
Controlling Access to Destinations that are Looked Up using the JMS API
The JMS QueueSession and TopicSession APIs provide an alternative to JNDI for looking up destinations, named createQueue() and createTopic() respectively. See
in Programming JMS for Oracle WebLogic Server.
The createQueue() and createTopic() calls use the database credential associated with the JMS connection. The following sections describe how to set this credential.
Additional Security Configuration for Stand-alone Clients
The following section provides security configuration information for stand-alone clients:
Network communication from a client into WebLogic occurs when establishing a JNDI initial context and when performing any subsequent JNDI lookups. To ensure secure communication and avoid plain text on the wire, use an SSL capable protocol (such as t3s or https). The credentials used for WebLogic login, as well as the JMS Foreign Server credentials that are configured for database login, are passed plain-text on the wire unless SSL is configured.
Network communication is direct from the client to the database when communicating with AQ. This communication is controlled by the JDBC URL configuration, and is in plain text unless the JDBC URL is configured to use SSL. Stand-alone clients communicate directly with the database over a database connection when using the AQ JMS APIs, their JMS requests do not route through a WebLogic server.
WebLogic Server username and password: The network login from a client into WebLogic is performed as part of establishing the JNDI initial context. The username and password properties that are optionally supplied when creating the context become the WebLogic identity (the property names are Context.SECURITY_PRINCIPAL = "java.naming.security.principal" and Context.SECURITY_CREDENTIALS = "java.naming.security.credentials" respectively). This becomes the credential that is checked for subsequent JNDI lookups. The credential is also implicitly associated with current thread, and so becomes the credential used for subsequent WebLogic operations on the same thread, but this is not the credential used for AQ JMS operations.
The javax.jms.ConnectionFactory createConnection() method has an optional username and password. For stand-alone clients, these override the context credentials that were configured as part of the JMS Foreign Server configuration. AQ JMS creates a database connection with the specified user identity. If createConnection() is called without a username and password, then the database connection is created using the username and password that was configured as part of the JMS Foreign Server configuration.
Do not include a username/password directly in the JDBC URL. Instead use the JMS Foreign Server username and password.
Do not configure a username and password on the JMS Foreign Server connection factory. The resulting behavior is unsupported.
Additional Security Configurations for Server-side Applications
The following section provides security configuration information for server-side applications.
Do not configure a java.naming.security.principal or a credential on the JMS Foreign Server unless the same JMS Foreign Server is also being used to support stand-alone clients.
Do not configure a username and password on the JMS Foreign Server connection factory. The resulting behavior is unsupported.
Network communication from the server to the database (server-side applications) is controlled by data source configuration, and is in plain text unless the data source is configured to use SSL.
The javax.jms.ConnectionFactory createConnection() method has an optional username and password. For server-side JMS AQ applications, the method assumes the username is for a WebLogic user and authenticates it with the WebLogic server. This behavior deviates from other kinds of JMS AQ clients, where the username is instead treated as a database user. When configured with a WebLogic data source, AQ JMS delegates the authentication to the WebLogic data source and AQ JMS inherits the WebLogic user semantics.
When an AQ JMS foreign server is configured with a WebLogic data source, the data source is exposed to general-purpose JDBC usage. Oracle recommends that you secure the data source as described in
in Configuring and Managing JDBC Data Sources for Oracle WebLogic Server.
WebLogic Server username and password: WebLogic credentials are checked when accessing secured names in JNDI, and accessing secured data sources. Server side applications automatically assume the same WebLogic credentials as the caller that invoked the application, or, in the case of MDBs, this credential is configurable as part of the MDB configuration.
The WebLogic data source Identity Based Connection Pooling feature is not supported.
JNDI context credentials: Specifying credentials as part of setting up a JNDI context within a server-side application is usually not necessary, and is not normally recommended. This creates a new credential that overrides the application's current credentials. In other words, the username and password properties that are optionally supplied when creating the context become the WebLogic identity and replace any current identity (the property names are Context.SECURITY_PRINCIPAL = "java.naming.security.principal" and Context.SECURITY_CREDENTIALS = "java.naming.security.credentials" respectively). The optional new credential is implicitly associated with current thread, and so becomes the credential used for subsequent WebLogic operations on the same thread, such as JNDI lookups. The new credential is not the credential used for AQ JMS operations.
WebLogic Messaging Bridge
A WebLogic Messaging Bridge communicates with the configured source and target bridge destinations. For each mapping of a source destination to a target destination, you must configure a messaging bridge instance. Each messaging bridge instance defines the source and target destination for the mapping, a message filtering selector, a QOS, transaction semantics, and various reconnection parameters.
If you have AQ foreign destinations that are not local to the server running the application or MDBs sending and receiving messages, you must configure a messaging bridge instance on the server that is local to the AQ foreign destinations. A local database connection is used in the process of sending and receiving messages from AQ destinations.
For more information on the WebLogic Messaging Bridge, see
in Configuring and Managing the Messaging Bridge for Oracle WebLogic Server.
Create a Messaging Bridge Instance
The section provides the major steps in creating a messaging bridge between AQ destinations configured as foreign destinations in one domain and applications/MDBs running in another domain:
Create the bridge instance on the server where AQ destinations configured as foreign destinations.
Create source and target bridge destinations.
Select Other JMS in the default Messaging Provider drop down when a Foreign AQ JMS destination is specified for a source or target destination.
Deploy a resource adapter.
Create a messaging bridge instance.
The Messaging Bridge Exactly-Once quality of service requires a data source configured with the XA based JDBC driver and must use an AQ JMS connection factory that implements an XA JMS connection factory interface. See
Target the messaging bridge.
The Administration Console assists you in creating a messaging bridge by deploying an appropriate resource adapter and setting the values of some attributes. Consider changing messaging bridge settings to better suit your environment. See
in Oracle WebLogic Server Administration Console Help
Stand-alone WebLogic AQ JMS Clients
You can create WebLogic AQ JMS stand-alone clients that can lookup AQ JMS connection factories and destinations defined by a JMS Foreign Server using a JDBC URL. The client must have the following jars on the client-side classpath: aqapi.jar, ojdbc6.jar, orai18n.jar and one of the following WebLogic client jars: wlthint3client.jar, wlclient.jar, or wlfullclient.jar.
For applications running outside the WebLogic Server's JVM:
A configured WebLogic JMS Foreign Server references the database's URL, as well as other JDBC driver configurations. See
Local JNDI names are defined for AQ JMS connection factories and destinations as part of the WebLogic JMS Foreign Server configuration. These JNDI names are configured to map to existing AQ connection factories and destinations.
Stand-alone clients reference local JNDI names. Unlike applications that run on WebLogic Server, stand-alone clients need to ensure that the driver and AQ client are on the classpath.
Configure a Foreign Server using a Database's JDBC URL
Specify the db_url, java.naming.security.principal JNDI properties and a password in jndi-properties-credentials.
For Example:
&foreign-server&
&initial-context-factory&oracle.jms.AQjmsInitialContextFactory&/initial-context-factory&
&jndi-properties-credential-encrypted&{3DES}g8yFFu1AhP8=&/jndi-properties-credential-encrypted&
&jndi-property&
&key&java.naming.security.principal&/key&
&value&j2ee&/value&
&/jndi-property&
&jndi-property&
&key&db_url&/key&
&value&jdbc:oracle:thin:@{hostname}:{port}:{sid}&/value&
&/jndi-property&
&/foreign-server&
The value of the db_url JNDI property is the JDBC URL used to connect to the AQ JMS Oracle database.
The value of the java.naming.security.principal is the database user name AQ JMS uses to connect to the database.
jndi-properties-credentials contains the database password.
No other configuration properties are required.
Limitations when using Stand-alone WebLogic AQ JMS Clients
The following section provides limitations to consider when creating and using stand-alone WebLogic JMS clients. This release does not support:
Use of a WebLogic AQ JMS stand-alone client to automatically participate in global transactions managed by WLS.
Connection pooling for WebLogic AQ JMS stand-alone clients.
Looking up JMS objects defined by an AQ JMS foreign server using a data source.
Related Documentation
The following section provides links to related documentation:
in Programming JMS for Oracle WebLogic Server
Scripting on this page enhances content navigation, but does not change the content in any way.

我要回帖

更多关于 oppor9s最便宜多少钱 的文章

 

随机推荐