weblogic

简介:

WebLogic是美国Oracle公司出品的一个application server,确切的说是一个基于JAVA EE架构的中间件,WebLogic是用于开发、集成、部署和管理大型分布式Web应用、网络应用和数据库应用的Java应用服务器,将Java的动态功能和Java Enterprise标准的安全性引入大型网络应用的开发、集成、部署和管理之中;

WebLogic是美商Oracle的主要产品之一,系并购BEA得来,是商业市场上主要的JavaJ2EE)应用服务器软件(application server)之一,是世界上第一个成功商业化的J2EE应用服务器已推出到12c(12.1.3) 版,而此产品也延伸出WebLogic PortalWebLogic Integration等企业用的中间件(但当下Oracle主要以Fusion Middleware融合中间件来取代这些WebLogic Server之外的企业包),以及OEPE(Oracle Enterprise Pack for Eclipse)开发工具;

 

 

JMSJava消息服务(Java Message Service)应用程序接口,是一个Java平台中关于面向消息中间件(MOM)的API,用于在两个应用程序之间,或分布式系统中发送消息,进行异步通信,Java消息服务是一个与具体平台无关的API,绝大多数MOM提供商都对JMS提供支持;

 

JMSJava Messaging Service)是Java平台上有关面向消息中间件(MOM)的技术规范,它便于消息系统中的Java应用程序进行消息交换,并且通过提供标准的产生、发送、接收消息的接口简化企业应用的开发,翻译为Java消息服务。

 

JMS是一种与厂商无关的 API,用来访问消息收发系统消息,它类似于JDBCJava Database Connectivity),这里,JDBC 是可以用来访问许多不同关系数据库的 API,而 JMS 则提供同样与厂商无关的访问方法,以访问消息收发服务,许多厂商都支持 JMS,包括 IBM  MQSeriesBEA Weblogic JMS service Progress  SonicMQ JMS 使您能够通过消息收发服务(有时称为消息中介程序或路由器)从一个 JMS 客户机向另一个 JMS客户机发送消息;

 

消息是 JMS 中的一种类型对象,由两部分组成:报头和消息主体;

报头由路由信息以及有关该消息的元数据组成;

消息主体则携带着应用程序的数据或有效负载;

根据有效负载的类型来划分,可以将消息分为几种类型,它们分别携带:

简单文本(TextMessage)、可序列化的对象 (ObjectMessage)、属性集合 (MapMessage)、字节流 (BytesMessage)、原始值流 (StreamMessage),还有无有效负载的消息 (Message)

 

JMS由以下元素组成:

JMS提供者(连接面向消息中间件的,JMS接口的一个实现,提供者可以是Java平台的JMS实现,也可以是非Java平台的面向消息中间件的适配器);

JMS客户(生产或消费基于消息的Java的应用程序或对象);

JMS生产者(创建并发送消息的JMS客户);

JMS消费者(接收消息的JMS客户);

JMS消息(包括可以在JMS客户之间传递的数据的对象);

JMS队列(一个容纳那些被发送的等待阅读的消息的区域。与队列名字所暗示的意思不同,消息的接受顺序并不一定要与消息的发送顺序相同,一旦一个消息被阅读,该消息将被从队列中移走);

JMS主题(一种支持发送消息给多个订阅者的机制)

 

JMS对象模型包含如下几个要素:

1)连接工厂。连接工厂(ConnectionFactory)是由管理员创建,并绑定到JNDI树中。客户端使用JNDI查找连接工厂,然后利用连接工厂创建一个JMS连接。

2JMS连接。JMS连接(Connection)表示JMS客户端和服务器端之间的一个活动的连接,是由客户端通过调用连接工厂的方法建立的。

3JMS会话。JMS会话(Session)表示JMS客户与JMS服务器之间的会话状态。JMS会话建立在JMS连接上,表示客户与服务器之间的一个会话线程。

4JMS目的。JMS目的(Destination),又称为消息队列,是实际的消息源。

5JMS生产者和消费者。生产者(MessageProducer)和消费者(Message Consumer)对象由Session对象创建,用于发送和接收消息。

6JMS消息通常有两种类型:

点对点(Point-to-Point)。在点对点的消息系统中,消息分发给一个单独的使用者。点对点消息往往与队列(javax.jms.Queue)相关联。

发布/订阅(Publish/Subscribe)。发布/订阅消息系统支持一个事件驱动模型,消息生产者和消费者都参与消息的传递。生产者发布事件,而使用者订阅感兴趣的事件,并使用事件。该类型消息一般与特定的主题(javax.jms.Topic)关联。

wKioL1hl8dCieJyPAABaRWxzapw545.jpg

 

Java消息服务应用程序结构支持两种模型(点对点或队列模型;发布者/订阅者模型)

在点对点或队列模型下(一个生产者向一个特定的队列发布消息,一个消费者从该队列中读取消息。这里,生产者知道消费者的队列,并直接将消息发送到消费者的队列。这种模式被概括为:只有一个消费者将获得消息;生产者不需要在接收者消费该消息期间处于运行状态,接收者也同样不需要在消息发送时处于运行状态;每一个成功处理的消息都由接收者签收);

发布者/订阅者模型(支持向一个特定的消息主题发布消息。0或多个订阅者可能对接收来自特定消息主题的消息感兴趣。在这种模型下,发布者和订阅者彼此不知道对方。这种模式好比是匿名公告板。这种模式被概括为:多个消费者可以获得消息;在发布者和订阅者之间存在时间依赖性,发布者需要建立一个订阅(subscription),以便客户能够订阅,订阅者必须保持持续的活动状态以接收消息,除非订阅者建立了持久的订阅,在那种情况下,在订阅者未连接时发布的消息将在订阅者重新连接时重新发布);

使用Java语言,JMS提供了将应用与提供数据的传输层相分离的方式。同一组Java类可以通过JNDI中关于提供者的信息,连接不同的JMS提供者。这一组类首先使用一个连接工厂以连接到队列或主题,然后发送或发布消息。在接收端,客户接收或订阅这些消息。

 

JMS有两种传递消息的方式,标记为NON_PERSISTENT的消息最多投递一次,而标记为PERSISTENT的消息将使用暂存后再转送的机理投递,如果一个JMS服务离线,那么持久性消息不会丢失但是得等到这个服务恢复联机时才会被传递,所以默认的消息传递方式是非持久性的,即使使用非持久性消息可能降低内务和需要的存储器,并且这种传递方式只有当你不需要接收所有的消息时才使用;

虽然JMS规范并不需要JMS供应商实现消息的优先级路线,但是它需要递送加快的消息优先于普通级别的消息,JMS定义了从09的优先级路线级别,0是最低的优先级而9则是最高的,更特殊的是04是正常优先级的变化幅度,而59是加快的优先级的变化幅度。举例来说:topicPublisher.publish (message, DeliveryMode.PERSISTENT, 8, 10000);//Pub-Sub  queueSender.send(message,DeliveryMode.PERSISTENT, 8, 10000);//P2P  这个代码片断,有两种消息模型,映射递送方式是持久的,优先级为加快型,生存周期是10000 (以毫秒度量)。如果生存周期设置为零,这则消息将永远不会过期。当消息需要时间限制否则将使其无效时,设置生存周期是有用的。

JMS定义了五种不同的消息正文格式,以及调用的消息类型,允许你发送并接收以一些不同形式的数据,提供现有消息格式的一些级别的兼容性。

· StreamMessage -- Java原始值的数据流

· MapMessage--一套名称-值对

· TextMessage--一个字符串对象

· ObjectMessage--一个序列化的 Java对象

· BytesMessage--一个未解释字节的数据流

 

JMS编程模型:

ConnectionFactory 接口(连接工厂,用户用来创建到JMS提供者的连接的被管对象,JMS客户通过可移植的接口访问连接,这样当下层的实现改变时,代码不需要进行修改,管理员在JNDI名字空间中配置连接工厂,这样,JMS客户才能够查找到它们。根据消息类型的不同,用户将使用队列连接工厂QueueConnectionFactory,或者主题连接工厂TopicConnectionFactory,可以通过JNDI来查找ConnectionFactory对象);

Connection 接口(连接,连接代表了应用程序和消息服务器之间的通信链路(对TCP/IP socket的包装),在获得了连接工厂后,就可以创建一个与JMS提供者的连接,根据不同的连接类型,连接允许用户创建会话,以发送和接收队列和主题到目标;Connection可以产生一个或多个Session。跟ConnectionFactory一样,Connection也有两种类型:QueueConnectionTopicConnection);

Destination 接口(目标,目标是一个包装了消息目标标识符的被管对象,消息目标是指消息发布和接收的地点,或者是队列Queue,或者是主题TopicJMS管理员创建这些对象,然后用户通过JNDI发现它们,和连接工厂一样,管理员可以创建两种类型的目标,点对点模型的队列,以及发布者/订阅者模型的主题);

Session 接口(会话,表示一个单线程的上下文,用于发送和接收消息,由于会话是单线程的,所以消息是连续的,就是说消息是按照发送的顺序一个一个接收的,会话的好处是它支持事务,如果用户选择了事务支持,会话上下文将保存一组消息,直到事务被提交才发送这些消息,在提交事务之前,用户可以使用回滚操作取消这些消息,一个会话允许用户创建消息,生产者来发送消息,消费者来接收消息;Session是我们操作消息的接口,可以通过session创建生产者、消费者、消息等,Session提供了事务的功能,当我们需要使用session发送/接收多个消息时,可以将这些发送/接收动作放到一个事务中,同样,也分QueueSessionTopicSession);

MessageConsumer 接口(消息消费者,由会话创建的对象,用于接收发送到目标的消息,消费者可以同步地(阻塞模式),或(非阻塞)接收队列和主题类型的消息;消息消费者由Session创建,用于接收被发送到Destination的消息,两种类型:QueueReceiverTopicSubscriber,可分别通过sessioncreateReceiver(Queue)createSubscriber(Topic)来创建,当然,也可以sessioncreatDurableSubscriber方法来创建持久化的订阅者);

MessageProducer 接口(消息生产者,由会话创建的对象,用于发送消息到目标,用户可以创建某个目标的发送者,也可以创建一个通用的发送者,在发送消息时指定目标;消息生产者由Session创建,并用于将消息发送到Destination,同样,消息生产者分两种类型:QueueSenderTopicPublisher,可以调用消息生产者的方法(sendpublish方法)发送消息);

Message 接口(消息,是在消费者和生产者之间传送的对象,也就是说从一个应用程序传送到另一个应用程序,一个消息有三个主要部分:消息头(必须,包含用于识别和为消息寻找路由的操作设置);一组消息属性(可选,包含额外的属性,支持其他提供者和用户的兼容,可以创建定制的字段和过滤器(消息选择器));一个消息体(可选,允许用户创建五种类型的消息(文本消息,映射消息,字节消息,流消息和对象消息);消息接口非常灵活,并提供了许多方式来定制消息的内容);

MessageListener消息监听器(如果注册了消息监听器,一旦消息到达,将自动调用监听器的onMessage方法,EJB中的MDBMessage-Driven Bean)就是一种MessageListener);

 

要使用Java消息服务,你必须要有一个JMS提供者,管理会话和队列(既有开源的提供者也有专有的提供者):

开源的提供者包括:Apache ActiveMQJBoss 社区所研发的 HornetQJoramCoridanMantaRayThe OpenJMS GroupOpenJMS

专有的提供者包括:BEABEA WebLogic Server JMSTIBCOSoftwareEMSGigaSpaces TechnologiesGigaSpacesSoftwired2006iBusIONA TechnologiesIONA JMSSeeBeyondIQManager20058月被Sun Microsystems并购)、webMethodsJMS+ -my-channelsNirvanaSonic SoftwareSonicMQSwiftMQSwiftMQIBMWebSphere MQ

 

注:

JNDIJava Naming and Directory InterfaceJava命名和目录接口,是SUN公司提供的一种标准的Java命名系统接口,JNDI提供统一的客户端API,通过不同的访问提供者接口JNDI服务供应接口(SPI)的实现,由管理者将JNDI API映射为特定的命名服务和目录系统,使得Java应用程序可以和这些命名服务和目录服务之间进行交互;目录服务是命名服务的一种自然扩展,两者之间的关键差别是目录服务中对象不但可以有名称还可以有属性(例如,用户有email地址),而命名服务中对象没有属性;

集群JNDI实现了高可靠性JNDI,通过服务器的集群,保证了JNDI的负载平衡和错误恢复,在全局共享的方式下,集群中的一个应用服务器保证本地JNDI树的独立性,并拥有全局的JNDI树,每个应用服务器在把部署的服务对象绑定到自己本地的JNDI树的同时,还绑定到一个共享的全局JNDI树,实现全局JNDI和自身JNDI的联系;

JNDI是一个应用程序设计的API,为开发人员提供了查找和访问各种命名和目录服务的通用、统一的接口,类似JDBC都是构建在抽象层上,现在JNDI已经成为J2EE的标准之一,所有的J2EE容器都必须提供一个JNDI的服务;

JNDI可访问的现有的目录及服务有:DNSXNam Novell目录服务、LDAPLightweightDirectory Access Protocol)、CORBA对象服务、文件系统、Windows XP/2000/NT/Me/9x的注册表、RMIDSMLv1&v2NIS

JNDI优点(包含了大量的命名和目录服务,使用通用接口来访问不同种类的服务;可以同时连接到多个命名或目录服务上;建立起逻辑关联,允许把名称同Java对象或资源关联起来,而不必知道对象或资源的物理ID);

JNDI程序包(javax.naming命名操作;javax.naming.directory目录操作;javax.naming.event在命名目录服务器中请求事件通知;javax.naming.ldap提供LDAP支持;javax.naming.spi允许动态插入不同实现);

利用JNDI的命名与服务功能来满足企业级API对命名与服务的访问,诸如EJBJMSJDBC 2.0以及IIOP上的RMI通过JNDI来使用CORBA的命名服务;

JNDI架构提供了一组标准的独立于命名系统的API,这些API构建在与命名系统有关的驱动之上,这一层有助于将应用与实际数据源分离,因此不管应用访问的是LDAPRMIDNS、还是其他的目录服务;换句话说,JNDI独立于目录服务的具体实现,只要有目录的服务提供接口(或驱动),就可以使用目录;

关于JNDI要注意的重要一点是,JNDI提供了应用编程接口APIapplication programming interfaceAPI提供了Java应用程序访问各种命名和目录服务的功能)和服务提供者接口SPIservice providerinterfaceSPI提供了任意一种服务的提供者使用的功能),这一点的真正含义是,要让应用与命名服务或目录服务交互,必须有这个服务的JNDI服务提供者,这正是JNDI SPI发挥作用的地方,服务提供者基本上是一组类,这些类为各种具体的命名和目录服务实现了JNDI接口——很像JDBC驱动为各种具体的数据库系统实现了JDBC接口一样;作为一个应用开发者,我们不必操心JNDI SPI的具体实现,只需要确认要使用的每一个命名或目录服务都有服务提供者;

用途(命名或目录服务使用户可以集中存储共有信息,这一点在网络应用中是重要的,因为这使得这样的应用更协调、更容易管理,例如,可以将打印机设置存储在目录服务中,以便被与打印机有关的应用使用;我们大家每天都不知不觉地使用了命名服务,命名系统中的对象可以是DNS记录中的名称、应用服务器中的EJB组件(Enterprise JavaBeans Component)LDAP(LightweightDirectory Access Protocol)中的用户Profile;目录服务是命名服务的自然扩展,两者之间的关键差别是目录服务中对象可以有属性(例如,用户有email地址),而命名服务中对象没有属性,因此在目录服务中,你可以根据属性搜索对象,JNDI允许你访问FS中的文件,定位远程RMI注册的对象,访问像LDAP这样的目录服务,定位网络上的EJB组件

对于象LDAP客户端、应用launcher、类浏览器、网络管理实用程序,甚至地址薄这样的应用来说,JNDI是一个很好的选择);

 

安装:

#groupadd weblogic

#passwd weblogic

#useradd -g weblogic weblogic   #weblogic会自动提示使用普通用户安装)

#chown -R weblogic.weblogic /home/weblogic

#vim /etc/profile.d/java   #(安装配置jdk及环境变量)

export JAVA_HOME=/usr/java/jdk1.8.0_51

export PATH=$PATH:$JAVA_HOME/bin

exportCLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

#. !$

#java -jar fmw_12.1.3.0.0_wls.jar

安装目录-->安装类型(Weblogic Server-->条件检查页面(安全更新页面,选“我不希望收到有关配置”,点继续-->安装概要页面-->安装进度页面-->配置向导页面-->设置管理员账号-->域模式(选“开发”)和JDKweblogic自动识别系统已配置的JDK-->高级配置页面(选“管理服务器”)-->管理服务器页面(默认)-->概要配置页面(显示域配置信息)-->配置成功页面

 

 

#cd /home/weblogic/Oracle_Home/user_projects/domains/base_domain/bin

#nohup ./startWeblogic.sh &   #admin server启动)

#nohup ./startManagedWeblogic.sh <server_name> <t3://admin_ip:admin_port> &   #managed server启动)

#./stopManagedWeblogic.sh   #(停止时,先停managed server,再停adminserver

#./stopWeblogic.sh

 

注:若在console启动managed server,必须配置NodeManager进程和Machine组件,并将console中的Managed Server Target对应到Machine中;一般在3台以上主机组成的Domain中,尽量少用Machine配置,减少配置层次有利于系统的稳定;console中停止所有Servershutdown有两种:when work completesForce Shutdown Now

 

 

http://IP:7001/console

配置JMS factoryqueue

Services-->Messaging-->JMS Servers-->NewCreate a New JMS Server,输入Nametest_JMSServer-0-->Createa New StoreTypefile store,输入Name-->finish

Services-->Messaging-->JMS Modules-->New(输入名称,Next-->选择serverNext-->finish

Services-->Messaging-->JMS Modules-->New-->New-->选择Connection factory-->Next-->NameJNDI Name-->next-->finish

New-->Queue-->Next-->NameJNDI Name-->next-->Create a New Subdeployment-->SubdeploymentName-->OK-->选中JMS servers-->finish

左侧导航栏,点Activate changes

 

spring JMS配置:

1jndi模板;2、连接工厂;3、发送队列;4、消息转换;5JMS template6、接收队列;

 

1Jndi模版

 <!-- JNDI上下文模板 -->

 <bean id="jndiTemplate"class="org.springframework.jndi.JndiTemplate">

 <property name="environment">

 <props>

 <!-- your weblogic url -->

 <propkey="java.naming.provider.url">t3://localhost:7001</prop>

 <prop key="java.naming.factory.initial">weblogic.jndi.WLInitialContextFactory</prop>

 <!--weblogic username and password -->

 <propkey="java.naming.security.principal">weblogic</prop>

 <propkey="java.naming.security.credentials">weblogic</prop>

 </props>

 </property>

 </bean>

  2、连接工厂

 <!-- 连接工厂配置 -->

 <bean id="jmsConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">

 <property name="jndiName">

 <value>ConnectionFactory</value>

 </property>

 <property name="jndiTemplate">

 <ref bean="jndiTemplate" />

 </property>

 </bean>

  3、发送队列  <!-- 发送队列配置 -->

 <bean id="destinatinForSender"class="org.springframework.jndi.JndiObjectFactoryBean">

 <property name="jndiTemplate">

 <ref bean="jndiTemplate" />

 </property>

 <property name="jndiName">

 <value>Queue</value>

 </property>

 </bean>

  4、消息转换

 <!-- JMS 简单消息转换 -->

 <bean id="jmsConverter"  class="org.springframework.jms.support.converter.SimpleMessageConverter"/> 5JMS template配置

 <!-- JMS template配置 -->

 <bean id="jmsTemplateSender" class="org.springframework.jms.core.JmsTemplate">

 <property name="connectionFactory">

 <ref bean="jmsConnectionFactory" />

 </property>

 <property name="defaultDestination">

 <ref bean="destinatinForSender" />

 </property>

 <property name="messageConverter">

  <refbean="jmsConverter" />

 </property>

 </bean>

  6、接受队列配置

 <!-- 接收队列配置 -->

 <bean id="destinatinForReceiver" class="org.springframework.jndi.JndiObjectFactoryBean">

 <property name="jndiTemplate">

 <ref bean="jndiTemplate" />

 </property>

 <property name="jndiName">

 <value>Queue</value>

 </property>

 </bean>

 <bean id="jmsTemplateReceiver"class="org.springframework.jms.core.JmsTemplate">

 <property name="connectionFactory">

 

 

 

weblogic

一、

1install

2learn how to createa new custom domain template

create a customized domain template usingthe domain template builder so as to have the flexibiligty for creating domainsfor multiple developmentor,test and production environments.

http://www.oracle.com/us/corporate/acquisitions/bea/index.html

3create a new domainusing the custom domain templateusing the administration console

a domain is the basic administration unitfor weblogic server;

a domain always includes one weblogicserver instance that is configured as an administration server;

all other optional weblogic serverinstances in a domain one called managed servers;

 

the J2EE architecture

wKiom1hl8qWBpEPiAADJ9Qt6vyU175.jpg

 

 

二、

using the administration console

建立machine

configuring machinethe administration server uses the machine definition with the node manager application to start remote weblogic server instances; is a computer that hosts weblogic servers);

建立managed server

configuring managed serversmanaged servers can be configured using:domain;configuration wizard;administration console;command line(WLST,weblogic scripting tool));

发布应用

查看日志

use sample domain:wl_server

 

 

三、

using weblogic scripting tool,WLST

command line tools are useful(for automating administration using scripts;as an alternative to the administration console);

WLST provides a command line interface that:configures WLS instance and domains;manages and persists WLS configuration changes;

WLST enables you to:retrieve domain configuration and run-time information;edit the domain configuration and persist the changes in config.xml;automate configuration tasks and application deployment;

 

simplified command-line access:WLST includes the capabilities of (weblogic Admin(depecated in 9.X); weblogic deployer; wlconfig Ant tasks; configuration wizard(silent mode));

it allows you to navigate the WLS MBeantree like a filesystem;

to access WLST(in a non-secure environment,use:java weblogic WLST);

to access WLST(in a secure environment,use:java -Dweblogic.security.SSL.ignoreHostnameVerification=true-Dweblogic.security.TrustKeyStore=DemoTrustweblogic.WLST);

 

WLST Command requirements:

use causes sensitive names and arguments of commands;

use arguments enclosed in single or doublequotes;

precede the quoted string by r while specifying backslash in s string(example: read Template(r'c:\mytemplate.jar'));

 

note these invalid characters in objectnames while using WLST offline:

period(.);

forward slash(/);

backward slash(\);

 

you cannot access security information through WLST while updating a domain;

display help,example:wls:/mydomain/serverConfig>help('disconnect')

 

 

四、

发布

 

 

五、

in weblogci 10.0, a server instance need not be bound to a single network address,or a single port number/secure port,a network channel provides this functionality. a network channel is a configurable resource that defines the attributes of a network connection to weblogic server;

 

a network channel can define:

the protocol the connection supports;

the listen address;

the listen ports for secure and non-secure communication;

connection properties such as the login timeout value and maximum message sizes;

whether or not the connection supports tunneling;

whether the connection can be used to communicate with other weblogic server instances in the domain,or used only for communication with clients;

 

to configure a network channel:

select the server to which you want to configure network channels;

select the protocols tab;

select the channels tab;

click New;

Enter the general configuration values forthe new network channel;

click Save and Activate Changes;

 

snmp:

weblogic server provides the ability to communicate with enterprise-wide management systems using simple Network Management Protocol(SNMP) and enables you to integrate the management of weblogic servers into an SNMP-compliant management system to give you a single view of the various software and hardware resources of your entire system;

SNMP traps provide a notification mechanism where by an SNMP agent,such as weblogic administration server, can notify an SNMP manager when an event of interest has taken place.

As you will see in this lab,weblogic server provides serval predefined traps for server strartup and shutdown

 

 

六、

JNDI

the java naming and directory interface isan API for accessing different naming and directory services uniformly;

this is a major step forward because:

different services use vastly different naming schemes,java applications will be able to navigate seamlessly across databases,files,directories,objects and networks;

 

JNDI comes with two interfaces:

application programing interface(API),youcan use the API in an application to access a naming and directory service;

the service provider interface(SPI),you canuse the SPI to program a new service to be used as a naming and directory service;

 

in weblogic server,JNDI servers as a respository and lookup service for J2EE objects including:

EJB homestubs;

JDBC datasources;

JMS connection factories,queues and topics;

RMI stubs;

 

JNDI strucuture:

wKioL1hl9JbAt0ynAAB8j-u2590397.jpg

 

JNDI tree:

wKiom1hl9KKQP7b1AABw2fPzpoM142.jpg

 

contexts and subcontexts:

subcontexts are referenced through dot delimiters(.);

subcontexts must be created before objectsare placed into them;

typicaly when objects are bound to the JNDI tree,subcontexts are automatically created based on the JNDI name;

for example:

com.bea.examples

com.bea.examples.ejb

com.bea.examples.ejb.SomeObject

 

JNDI for administrators:

administrators need to understand JNDI because it will be their job to:

verify objects are bound in the JNDI tree;set security on contexts within the JNDI tree;

as an administrator you may be wondering why you need to understand about JNDI,however,you will be respon sible for verifying that an object was bound into the JNDI tree and setting security within the JNDI tree;

 

listing JNDI contents:

WLST providers a command line utility forviewing JNDI binding;

jndi() changes to the jndi tree and ls()list the bindings;

 

>java D:\bea\user_projects\domains\bbk\bin\weblogic.WLST

>connect("weblogic","weblogic","t3://localhost:7001")

>jndi()

>cd('AdminServer')

>ls()

 

module review:

in this module we discussed:

naming and directory services; thehigh-level architecture of JNDI;

terminology used in naming and directoryservices;

how to view the JNDI tree in weblogicserver;

 

 

七、

startup and shutdown classes

road map:

what are startup and shutdown classes andhow do they work;

deploying a startup or shutdown class using the administration console;

a startup class is a class that is loaded and executed when weblogic server boots;

 

you can use a startup class to:

initialize objects in memory;

reconstruct a JNDI tree;

load critical values from the database;

recover the system to the state that existed before shutdown;

a shutdown class is a class that gets executed when weblogic server is shutting down; shutdown classes are usually used to free resources obtained by startup classes;

when are startup classes loaded? by default, startup classes are loaded after the J2EE deployment units;

J2EE deployment units load in this order:JDBC,JMS,connectors,EJBs,web application;

if "run before application deployments" is checked ,then startup class are loaded right before deploying JDBC Data Sources;

 

 

八、

JMS, java message service

setting up JMS application:

at the end of this module, you will be able to:

understand how weblogic server JMS is implemented;

configure JMS administrator objects using the administration console;

configure persistent messages;

use the WLS administration console tominitor JMS;

 

road map:

(1)

weblogic server JMS administration;

messaging fundamental;

point to point(PTP) and publish-subscribe(pub/sub)domains;

configuring JMS objects;

fine-tuning WLS JMS;

 

PTP queue:

many producers can serialize message to multiple receivers in a queue;

注:message are delivered to one client

wKioL1hl9VSiZWDUAABTRAPqhas375.jpg

 

pub/sub topics:

publishing and subscribing to a topic decouples producers from consumers;

注:message are delivered to more than on client

wKiom1hl9WPz5wCOAABkKyk9Low188.jpg

 

weblogic server JMS features:

PTP and pub/sub domain;

guaranteed and transactional message delivery;

durable subscribers;

distributed destinations;

recovery from failed servers;

 

JMS architecture:

connecting

注:to send messages,these are required: connection; session;destination;

wKioL1hl9XaAdGTKAABtXb8A_p4136.jpg

 

JMS resources:

JMS resources are managed as either system modules or application modules:

wKioL1hl9YHgPg3vAABKArrKxXg872.jpg

 

raod map:

(2)

configuring persistent messaging:

persistent and non-persistent messages;

persistent backing stores using theconsole;

durable subscriptions;

durable subscriptions using the console;

 

how a durable subscription works:

if a subscriber client is active,messageare delivered normally;

when the client becomes active again,its IDis used to retrieve and redeliver messages.

wKiom1hl9Y7SDbU5AACF8bXFXkM716.jpg

 

configure a durable subscription:

to configure durable subscriptions,anadministrator must:

create and configure a JMS store;

configure connection factories or destinationsas persistent;

associate the JMS store with the JMSserver;

 

the JMS store can be configured to use either:

a file store;

a JDBC store(a connection pool);

 

road map:

(3)

monitoring JMS in WLS:

using the administration console to track JMS statistics

 

 

九、

JMS topic操作

 

 

十、

transactions

configuring and monitoring transactions:

configuing transactions;monitoring transaction;the transaction log;

a transaction is a mechanism to handle groups of operations as though they were one;

either all operations in a transaction occur or none at all;

operations involved in a transaction might rely on multiple servers and databases;

ACID properties of a transaction:

a transaction is formally defined by the set of properties known by the acronym ACID:

Atomicity (a transaction is done or undone completely,in the event of afailure,all operations and procedures are undone and all data rolls back to its previous state);

Consistency (a transaction transforms a system from one consistent state to another consistent state);

Isolation (each transaction occurs independently of other transactions occurring at the same time);

Durability (completed transactions remain permanent,even during system failure);

 

transferring without transactions:

A(successful transfer);

B(unsuccessful transfer,account are left is an inconsistent state);

wKiom1hl9Z7gcjTpAABZV6cvwM4239.jpg

 

the two-phase commit protocol:

the two-phase commit(2PC) protocol uses two steps to commit changes within a distributed transation:

phase 1 asks RMs to prepare to make the changes;

phase 2 asks RMs to commit and make the changes permanent,or to rollback the entire transaction;

a global transaction ID(XID) is used to track all changes associated with a distributed transaction.

 

extended architecture protocol(XA):

is the interface used between WLS and RMs;

implements the 2PC protocol;

allows programs to control RMs that are involed in distributed transactions;

 

transaction and resource managers:

a transaction manager coordinates multiple resource managers;

the 2PC protocol is used to coordinate the transaction;

the XA protocol implements 2PC;

wKioL1hl9aiAGKlHAACDh7OEzF4698.jpg

 

java transaction API(JTA):

WLS uses JTA to implement and managetransaction;

WLS JTA provides the following support:

it creates a unique transaction identifier(XID);

it supports an optional transaction name;

it tracks objects involved in transactions;

it notifies database of transactions;

it orchestrates 2PC using XA;

it executes rollbacks;

it executes automatic recovery procedures when failure;

it manages time-outs;

 

configuing the transaction log:

each server has a transaction log that stores informantion about committed transactions coordinated by the server that may not have been completed,weblogic server uses the transaction log when recovering from system crashes or network failures;

you cannot directly view the transaction log as the records are in a binary format;

T-log files must be migrated if migratingto a new machine;

 

transacted messaging:

a JMS client can use JTA to participate ina distributed transaction;

alternatively,a JMS client can demarcate transactions local to the JMS session through a transacted session;

participation in a transaction is optional;

 

 

十一、

managing users and groups

 



本文转自 chaijowin 51CTO博客,原文链接:http://blog.51cto.com/jowin/1887652,如需转载请自行联系原作者

相关实践学习
RocketMQ一站式入门使用
从源码编译、部署broker、部署namesrv,使用java客户端首发消息等一站式入门RocketMQ。
消息队列 MNS 入门课程
1、消息队列MNS简介 本节课介绍消息队列的MNS的基础概念 2、消息队列MNS特性 本节课介绍消息队列的MNS的主要特性 3、MNS的最佳实践及场景应用 本节课介绍消息队列的MNS的最佳实践及场景应用案例 4、手把手系列:消息队列MNS实操讲 本节课介绍消息队列的MNS的实际操作演示 5、动手实验:基于MNS,0基础轻松构建 Web Client 本节课带您一起基于MNS,0基础轻松构建 Web Client
相关文章
|
9月前
|
负载均衡 Java 应用服务中间件
Weblogic的了解、安装及其使用(三)
Weblogic的了解、安装及其使用
447 0
|
9月前
|
Oracle Java 关系型数据库
Weblogic的了解、安装及其使用(二)
Weblogic的了解、安装及其使用
300 0
|
9月前
|
开发框架 Kubernetes 监控
Weblogic的了解、安装及其使用(一)
Weblogic的了解、安装及其使用
713 0
|
Oracle Java 关系型数据库
Weblogic搭建
学习Weblogic搭建。
254 0
Weblogic搭建
|
Java 应用服务中间件 Apache
|
XML SQL 开发框架
Weblogic安装与配置详解
Weblogic安装与配置用Eclipse MyEclipse WebLogic8.1开发第一个Web程序1.安装jreEclipse虽然由java开发,但本身并不自带jre。所以你必须先自己安装,去http://java.sun.com/downloads下载最新J2SE1.4.2_03的jre安装文件j2re-1_4_2_03-windows-i586-p.exe。安装成功后,重启机器,并将jre的bin文件夹路径添加到系统环境变量PATH中,如:C:\Program Files\Java\j2re1.4.2_03\bin。
392 0
|
XML SQL 开发框架
weblogic教程:配置MyEclipse的WebLogic服务器
weblogic教程:配置MyEclipse的WebLogic服务器 。 MyEclipse默认的应用服务器为JBoss3,这里我们使用WebLogic8.1。启动Eclipse,选择“窗口首选项”菜单,打开首选项对话框。展开MyEclipse下的Application Servers结点,点击JBoss 3,选中右面的Disable单选按钮,停用JBoss 3。然后点击WebLogic 8,选中右边的Enable单选按钮,启用WebLogic服务器。同时下面的配置
192 0
|
Oracle Java 关系型数据库
|
应用服务中间件 关系型数据库 Oracle

热门文章

最新文章