In previous posts I described converting the examples of chapters 2 and 3 of my book from Glassfish to Weblogic 10.3. In this post I describe the conversions of chapters 4 to 10.
The conversions of chapter4 (Object/Relational Mapping), chapter 5 (JPQL), chapter 6 (Entity Manager) and chapter 7 (Transactions) from Glassfish to Weblogic presented no problems at all. However in chapter 8 (Messaging) the creation of JMS resources such as queues and topics is a bit different. JMS resources can be configured using the administrator console or from the command line using the ant wlconfig task. It is also possible to configure JMS resources using the weblogic.Admin utility or the Weblogic scripting tool (WLST). I used the wlconfig task as it was closest to the approach I used with Glassfish. JMS resources are configured using MBeans. An MBean is a Java class which is used for managing, controlling and monitoring a resource. MBeans form a hierarchy with the Weblogic server MBean being the parent of the JMS MBeans we create. First, nested within the wlconfig tag, we use the query tag to get a reference to the examplesServer MBean and store it in the examplesServer property; we will make use of this property shortly.
<query domain="wl_server" type="Server" name="examplesServer" property="examplesServer"/> Weblogic has two preconfigured domains: medrec and wl_server. We choose to use wl_server. Within wl_server is a preconfigured Weblogic server called examplesServer which we will use. A Weblogic server is a Weblogic instance running in its own JVM and with its own configuration. Next we create a JMSServer MBean and its dependent JMSQueue and JMSTopic MBeans using the create tag: <create type="JMSServer" name="BankJMSServer"> <set attribute="Targets" value="${examplesServer}"/> <create type="JMSQueue" name="BankServiceJMSQueue"> <set attribute="JNDIName" value="BankServiceJMSQueue"/> </create> <create type="JMSTopic" name="BankServiceJMSTopic"> <set attribute="JNDIName" value="BankServiceJMSTopic"/> </create> </create> We use the set tag and "Targets" attribute together with the examplesServer property we obtained from the earlier query tag to specify the Weblogic server. Next we create a JMSConnectionFactory as follows: <create type="JMSConnectionFactory" name="BankServiceConnectionFactory"> <set attribute="Targets" value="${examplesServer}"/> <set attribute="JNDIName" value="BankServiceConnectionFactory"/> <set attribute="XAConnectionFactoryEnabled" value="true"/> </create> You don't always need to create a JMSConnectionFactory, you can just use the default JMSConnectionFactory preconfigured with Weblogic. However my existing Glassfish source code refers to the BankServiceConnectionFactory, so I included this step. Chapter 9 (EJB Timer Service) again presented no problems. However in chapter 10 (Interceptors) I did encounter an issue with Interceptor classes. Labs 2 and 3 use the following interceptor class: public class Auditor { @PersistenceContext(unitName="BankService") private EntityManager em; @AroundInvoke public Object audit(InvocationContext invctx) throws Exception {
. . . The interceptor class is referred to in the BankServiceBean as follows:
@Stateless
@Interceptors(Auditor.class)
public class BankServiceBean implements BankService {
@PersistenceContext(unitName="BankService")
private EntityManager em;
...
This presented no problems in Glassfish. With Weblogic I got a runtime error on the lines of
" ... Dependency injection failure: can't find the bean definition about class interface javax.persistence.EntityManager. No unique bean of type javax.persistence.EntityManager is defined ... "
This was resolved by giving a JNDI name to the EntityManager in the BankServiceBean as follows:
@Stateless(mappedName="BankService") @Interceptors(Auditor.class) public class BankServiceBean implements BankService { @PersistenceContext(name = "BankPC", unitName="BankService") private EntityManager em;
...
We then use a JNDI lookup in the interceptor class to obtain the EntityManager as follows:
public class Auditor { @AroundInvoke public Object audit(InvocationContext invctx) throws Exception { try { InitialContext ctx = new InitialContext(); EntityManager em = (EntityManager)ctx.lookup("java:comp/env/BankPC"); ... That's it for now. In my next post I'll deal with the remaining chapters on EJB Web Services and Security respectively. Authentication in particular is somewhat application server specific so I expect difficulties in this area.
Prior to co-founding WebLogic, Inc., in September 1995, Paul Ambrose and Carl Resnikoff had developed (pre-JDBC) Oracle, Sybase, and Microsoft SQL Server database-drivers for Java under the name dbKona, as well as a "three tier" server to permit applets to connect to these databases.
This WebLogic 1.48 server had the name T3Server (a bastardization of "3-Tier Server"). Concurrently, Pitman and Pasker had worked on network-management tools written in Java. Pasker had written an SNMP stack in Java and a W32 native method for ICMP ping, while Pitman worked on applets to display the management data.
The 1.48 server version had (among other hidden features) the ability to extend it by modifying a dispatcher and adding a handler for different types of messages. Pasker talked Ambrose into sending him the source code for the server, and Pasker extended it so that applets could make SNMP and PING requests on the network, and display the results.
At this point, the founders worked together to pursue what eventually became the "Application Server".
BEA Systems acquired WebLogic, Inc. in 1998, following which it became BEA WebLogic. Oracle acquired BEA in 2008, following which it became Oracle WebLogic.
Posted by: buy viagra | January 08, 2010 at 01:22 PM
This WebLogic 1.48 server had the name T3Server is really very good. I like it. Please keep it up because the internet needs someone like you spreading the word.
Posted by: דומיין בעברית | July 19, 2011 at 02:35 AM
WebLogic 1.48 server is the three tier architecture server which is very famous and also known as the T3Server.
Posted by: payday loans | July 28, 2011 at 11:10 PM
This Web Logic 1.48 server had the name T3Server (a bastardization of "3-Tier Server"). Concurrently, Pitman and Pasker had worked on network-management tools written in Java.
Posted by: paydayloans | July 30, 2011 at 04:42 AM
Thank you for sharing to us.there are many person searching about that now they will find enough resources by your post.I would like to join your blog anyway so please continue sharing with us
Posted by: viagra | August 01, 2011 at 07:41 PM
This is an excellent site for nail fungus .
ZetaClear
Posted by: zetaClear | December 16, 2011 at 07:19 PM