Monday, September 17, 2012

Blog Three Year Anniversary

I just checked the date. Today is September 17, 2012. This blog site was created on September 12, 2009. So I just passed the three year anniversary by 5 days. Time flies ! The weather is good. Last week it was around 80F with little rain in Pittsburgh. Leaves have turned yellow or red a bit. This week it is getting a little cool. The temperature is around 70F.

Thursday, July 26, 2012

Various Ways for Navigation in JSF 2(draft)

The example is taken from the Icefaces 3 turorial http://wiki.icesoft.org/display/ICE/Getting+Started+with+ICEfaces+3 The file job-applicant.xhtml uses several navigation mechanisms.
  • Use the following:
     <h: button outcome="xyz" .../>
    The web will go directly xyz.xhtml. The URL in the browser is changed to something like ***/xyz.jsf
  • Use the following:
    <h:commandButton action="xyz" ... />
    Go to faces-config.xml to look for the <from-outcome> match for this page. The value in the <to-view-id> tag will be used and the the URL will be changed accordingly.
  • Use the following:
    <h:commandButton action="#{bean.method}" ... />
    Invoke the method of the bean. The return value is a string.
    1. The returned result is the following "abc?faces-redirect=true". In this case, the web will go to abc.xhtml. The URL is changed.
    2. The returned result is the following "abc". In this case, the web will show the content of abc.xhtml. But the URL will not change. So if the current page is xyz.xhtml, the new URL will still be xyz.xhtml instead of abc.xhtml.
    Note that this case of using bean method for the 'action' attribute in h:commandButton is syntactically the same as the case of using string literal for the 'action' attribute in h:commandButton. So maybe the navigation rule is the same. The navigation will first look for the match in faces-config.xml. If a match is not found, then it will just use the value of the 'action' attribute as the page name. It will either redirect to it or forward to it depending on the redirect flag.
  • <h:commandButton listener="#{bean.method}" ... />
    or
    <h:commandButton actionListener="#{bean.method}" ... />
    In these cases, the method returns void. So by default, the page submits to itself. The URL does not change.

Friday, July 13, 2012

Servet, JSF, Weblogic Standards Compliance

The question is can JSF 2 be used in weblogic 10?

The current version of JSF is 2. I think JSF is a layer on top of servlet. So between JSF and the application server, the common ground is the servlet version used. According to this link "http://javaserverfaces.java.net/presentations/20090520-jsf2-datasheet.pdf", JSF 2.0 is compatible with JavaEE 5 application servers, or any server implementing Servlet 2.5. For weblogic 10.3, it has a list of supported standards. From the link "http://docs.oracle.com/cd/E12840_01/wls/docs103/notes/new.html", it supports Java EE version 5.0 and Java EE servlet version 2.5, 2.4, 2.3, and 2.2. So here the common ground is servlet version 2.5, and it should be OK to use JSF 2 in weblogic 10.3.

The following information from wikipedia http://en.wikipedia.org/wiki/Oracle_WebLogic_Server is also helpful.

The table below lists major standards supported by WebLogic Server product version.

Standard WLS 7.0 WLS 8.1 WLS 9.0 WLS 10.0 WLS 10.3 WLS 12c
Java 1.3 1.4 5 5 6 (7 in 10.3.6+) 7
Java EE 1.3 1.3 1.4 5 5 6
Servlet 1.2 2.3 2.4 2.5 2.5 3.0
JSP 1.2 1.2 2.0 2.1 2.1 2.2
EJB 2.0 2.0 2.1 3.0 3.0 3.1
JDBC 2.0 2.0 3.0 3.0 3.0 4.0

Thursday, June 14, 2012

The Different Ways To Specify the Converter and the Validator In JSF

When writing JSP pages in JSF, you can use different ways to specify the converter and/or the validator for an input. If the customer converter/validator does not need any parameters, then the task is easy. But if the customer converter/validator needs to take any parameter, the thing will be more involved.

The Customer Converter

The Customer Converter Without Parameters

In the following, we use the conventional prefix "f" and "h" for the JSF core and html tag libraries respectively. We also assume that there is a customer converter with the ID com.sample.customer.converter.id and the class name com.sample.CustomerConverter. Furthermore, we assume that this converter is used to do the conversion between a string and the object of the class com.sample.CustomerObject.
Method 1
Use the converter ID. The converter ID is declared in the faces-config.xml file.
<h:inputText value="#{someBean.someVar}">
  <f:converter converterId="com.sample.customer.converter.id"/>
</h:inputText>
Method 2
Use the converter attribute:
<h:inputText value="#{someBean.someVar}" converter="com.sample.customer.converter.id" />
Method 3
Implements a method in the back bean to return a converter:
   <h:inputText value="#{someBean.somevar}" converter="#{backBean.converter}" />
Here the backBean class must implement the following method:
  public Converter getConverter(){...}
Method 4
If the converter class CustomerConverter is used for all the conversions between the String and the object of the class CustomerObject, you can specify CustomerConverter as the default for the CustomerOjbect class in faces-config.xml. And that is it. No other things in JSP pages are needed.

In faces-config.xml, do the following:

    <converter>
       <converter-for-class>com.sample.CustomerObject</converter-for-class>
       <converter-class>com.sample.CustomerConverter</converter-class>
    </converter>
In the JSP file, you simply write
<h:inputText value="#{someBean.someVar}" />
Note that here the type of the variable someVar must be the class CustomerObject.

The Customer Converter With Parameters

In this case, you will need to implement the converter class and the tag handler class for the converter. The tag handler class should extend the JSF class ConverterELTag. It should have the method createConverter() that returns an instance of the converter class. You also need to create the customer TLD file for your tag classes.

Note that there is also a way so you can have a customer converter that needs parameters but you do not need to create the tag handler class and TLD files. You can just as simply use the methods described in the section "The Customer Converter Without Parameters". The trick is to pass the parameter to the back bean and get the value of that parameter from the bean when the customer converter does the conversion. The following is an example.

  <h:outputText value="#{someBean.someVar}">
     <f:converter converterId="myConverterId" />
     <f:attribute name="myConverterParameterName" value="someValue" />
  </h:outputText>
Then in the converter, you can get the parameter value as follows:
     parameterValue = component.getAttributes().get("myCoverterParameterName");


The Customer Validator

The Customer Validator Without Parameters

Mehtod 1
   <h:inputText .... >
      <f:validator validatorId="..." />
   </h:inputText>
Method 2
   <h:inputText value="#{someBean.someVar}" validator="#{someBean.validatingMethod}" />
Notice here that the method in the "validator" attribute does not return an object of the validator class. Instead, its return type is void. This is different from the converter case where the corresponding method returns an object of the customer converter class. Here the validation method validates the data and throws a ValidatorException( a Runtime exception ) if it finds any error.

The Customer Validator With Parameters

In this case, you will need to implement the validator class and the tag handler class for the validator. The tag handler class should extend the JSF class ValidatorELTag. It should have the method createValidator() that returns an instance of the validator class. You also need to create the customer TLD file for your tag classes.

References

1. Core JavaServer Faces by David Geary and Cay Horstmann

How to Specify Source Code When Debugging in Eclipse

You can have multiple application projects in Eclipse. You can use Eclipse to start a weblogic server in the debug mode. And then you can debug your web applications deployed to the weblogic server. You may want to debug into the source code of the libraries used in your application. For example, you may want to debug into the jsf-impl.jar. You may use different versions of jsf-impl in different applications. So how to use the source code that matches the library? It is actually easy. The following are the steps.
  1. In eclipse, go to "Run --> Debug configurations...". This will open the configuration screen.
  2. In the screen, the left pane shows a list of the programs. Click on the one you are using. In this example, it is "Oracle Weblogic Server 11gR1 PatchSet 1 at localhost".The right pane will show tabs named "Server", "Source", "Environment", etc.
  3. In that right pane, click on the "Source" tab. You will see a list of the projects and files. These are the source code files that eclipse uses to show in debugging.
  4. In that right pane, you can use the "Add" button to add source code file. You can also have different versions of the source code for a library. In that case, you can use the "Up" and "Down" button to move the positions of the source code file. The one sitting higher will be picked up.

Wednesday, June 13, 2012

JSF and JSP Architecture Models

There are two models for building applications using the JSP and servlet technology.

The Model 1 Architecture

In this model, the target of every request is a JSP page. The JSP page does all the things to answer the request. It can use JavaBeans to access database or other services.

The Model 2 Architecture

This model follows the Model-View-Controller(MVC) design pattern. In this architecture, all the requests are received by the servlets first. The servlets act as the controller. They analyze the request, get the data into JavaBeans, and finally dispatch the requests to JSP pages. The JavaBeans act as the model. And the JSP pages act as the view.

What about JSF?

We know every JSP page is actually a servet. It will be compiled to a servlet class by the web container. Now in the JSF world, with all those JSF lifecyle phases, is it still following the Model 2 architecture? The answer is still "Yes" because the JSP file gives the layout and appearance of the page. But unlike the old jsp/servlet technology where the JSP writes out all the HTML text, in JSF, the servlet generated from the JSP page only produces some simple HTML text such as the header("Content-type", "text/html"). Mostly it just processes the tags and creates the object tree into the Context which are used to build the JSF component tree. Later on the faces servlet gets the component tree from the context and spits out the actual HTML text in the renderers of the components in the component tree.

Roughly speaking, in the traditional Model 2, the servlet does not do much. basically it just dispatches the requests to the JSP pages and its job is done. But in JSF, the servlet will execute the JSF life cycle for every request. At some point in the life cycle, the servlet will dispatch the request to the JSP. The JSP will do its job and save the the work into the conetxt. Then the execution will return to the servlet for the life cycle to finish.

The following is one actual stacktrace from a sample JSF application. It shows an error. But that is not the interest here. From the stacktrace, we can see how the whole thing works together. We can see the following:

  1. The faces servlet acts as the controller. The JSF lifecyle is executed in the controller.
  2. The splitting line in the stacktrace is the one containing the following: com.sun.faces.context.ExternalContextImpl.dispatch. This is where the faces servlet dispatches the request to the JSP page.
  3. After the faces servlet dispatches the request, the servlet generated by the JSP will take over the task. In the example, it is jsp_servlet.__index.class which is generated from the JSP page index.jsp. It is missing in this case. So an error occurs.
  4. The jsp_servlet processes the tags in the JSP page, creates the corresponding objects from the tags and stores them into the pageContext. The jsp_servlet does not write out the actual HTML text from the tags.
  5. Later on in the JSF lifecycle, the JSF renderers will write out the actual HTML text that will be sent to the browser. And these occurs in the faces servlet.
javax.servlet.ServletException: [HTTP:101249][ServletContext@11930454[app:spinner module:spinner path:/spinner spec-version:2.5]]: Servlet class jsp_servlet.__index for servlet /index.jsp could not be loaded because the requested class was not found in the classpath .
java.lang.ClassNotFoundException: jsp_servlet.__index.
 at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:543)
 at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.java:271)
 at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.java:191)
 at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:235)
 at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)
 at weblogic.servlet.internal.RequestDispatcherImpl.invokeServlet(RequestDispatcherImpl.java:502)
 at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:248)
 at  com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:410)
 at com.sun.faces.application.ViewHandlerImpl.executePageToBuildView(ViewHandlerImpl.java:469)
 at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:140)
 at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:110)
 at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
 at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
 at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
 at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
 at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
 at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
 at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
 at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
 at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
 at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3592)
 at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
 at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
 at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2202)
 at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2108)
 at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1432)
 at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
 at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
In the correct version for the example above, the class jsp_servlet._index.class is at the right location. Looking at the actual code, you can see the majority of the class is the methods of the following type:
private boolean _jsp__tagX(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.jsp.PageContext pageContext, javax.servlet.jsp.tagext.JspTag activeTag, com.sun.faces.taglib.html_basic.PanelGridTag parent) throws java.lang.Throwable
    {
The method name is _jsp__tagX, where 'X' is a number. For this particular example, there are 12 such methods. X is from 0 to 11, each corresponding to an actual tag in the JSP file.

A main method in _index.java is the following:

public final class __index extends  weblogic.servlet.jsp.JspBase  implements weblogic.servlet.jsp.StaleIndicator {
...
    public void _jspService(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) 
    throws javax.servlet.ServletException, java.io.IOException {

        javax.servlet.ServletConfig config = getServletConfig();
        javax.servlet.ServletContext application = config.getServletContext();
        javax.servlet.jsp.tagext.JspTag _activeTag = null;
        java.lang.Object page = this;
        javax.servlet.jsp.PageContext pageContext = javax.servlet.jsp.JspFactory.getDefaultFactory().getPageContext(this, request, response, null, true , 8192 , true );
        response.setHeader("Content-Type", "text/html");
        javax.servlet.jsp.JspWriter out = pageContext.getOut();
        weblogic.servlet.jsp.ByteWriter bw = (weblogic.servlet.jsp.ByteWriter)out;
        bw.setInitCharacterEncoding(_WL_ORIGINAL_ENCODING, _WL_ENCODED_BYTES_OK);
        javax.servlet.jsp.JspWriter _originalOut = out;
        javax.servlet.http.HttpSession session = request.getSession( true );
        try {;
            bw.write(_wl_block0Bytes, _wl_block0);
            bw.write(_wl_block1Bytes, _wl_block1);
            bw.write(_wl_block1Bytes, _wl_block1);
            bw.write(_wl_block1Bytes, _wl_block1);

            if (_jsp__tag0(request, response, pageContext, _activeTag, null))
             return;
            bw.write(_wl_block9Bytes, _wl_block9);
        } catch (java.lang.Throwable __ee){
            if(!(__ee instanceof javax.servlet.jsp.SkipPageException)) {
                while ((out != null) && (out != _originalOut)) out = pageContext.popBody(); 
                _releaseTags(pageContext, _activeTag);
                pageContext.handlePageException(__ee);
            }
        }
    }
....

}
The method above calls _jsp_tag0() which will in turn calls _jsp_tag1(), .... The mehtod _jsp_tag0 is for the ViewTag. The method is as follows:
 private boolean _jsp__tag0(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.jsp.PageContext pageContext, javax.servlet.jsp.tagext.JspTag activeTag, javax.servlet.jsp.tagext.JspTag parent) throws java.lang.Throwable
    {
        javax.servlet.jsp.tagext.JspTag _activeTag = activeTag;
        javax.servlet.jsp.JspWriter out = pageContext.getOut();
        weblogic.servlet.jsp.ByteWriter bw = (weblogic.servlet.jsp.ByteWriter) out;
         com.sun.faces.taglib.jsf_core.ViewTag __tag0 = null ;
        int __result__tag0 = 0 ;

        if (__tag0 == null ){
            __tag0 = new  com.sun.faces.taglib.jsf_core.ViewTag ();
            weblogic.servlet.jsp.DependencyInjectionHelper.inject(pageContext, __tag0);
        }
        __tag0.setPageContext(pageContext);
        __tag0.setParent(null);
        __tag0.setJspId("id0");
        _activeTag=__tag0;
        __result__tag0 = __tag0.doStartTag();

        if (__result__tag0!= javax.servlet.jsp.tagext.Tag.SKIP_BODY){
            try {
                if (__result__tag0== javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_BUFFERED) {
                    out = pageContext.pushBody();
                    bw = (weblogic.servlet.jsp.ByteWriter)out;
                    __tag0.setBodyContent(( javax.servlet.jsp.tagext.BodyContent)out);
                    __tag0.doInitBody();
                }
                do {
                    bw.write(_wl_block2Bytes, _wl_block2);

                    if (_jsp__tag1(request, response, pageContext, _activeTag, __tag0))
                     return true;
                    bw.write(_wl_block3Bytes, _wl_block3);

                    if (_jsp__tag2(request, response, pageContext, _activeTag, __tag0))
                     return true;
                    bw.write(_wl_block8Bytes, _wl_block8);
                } while (__tag0.doAfterBody()== javax.servlet.jsp.tagext.IterationTag.EVAL_BODY_AGAIN);
            } finally {
                if (__result__tag0== javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_BUFFERED) {
                    out = pageContext.popBody();
                    bw = (weblogic.servlet.jsp.ByteWriter)out;
                }
            }
        }
        if (__tag0.doEndTag()== javax.servlet.jsp.tagext.Tag.SKIP_PAGE){
            _activeTag = null;
            _releaseTags(pageContext, __tag0);
            return true;
        }
        _activeTag=__tag0.getParent();
        weblogic.servlet.jsp.DependencyInjectionHelper.preDestroy(pageContext, __tag0);
        __tag0.release();
        return false;
    }

Notice that line in red "weblogic.servlet.jsp.DependencyInjectionHelper.inject(pageContext, __tag0);". This looks like to process the tag and save the values into the pageContext. The other methods _jsp_tagX() are similar.

Understanding the Java Stack Trace

The java stacktrace often contains something like "... 10 more Caused by". What does the number in this string mean? The following is the javadoc of the class Throwable. It has a good explanation. It can be found online at http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Throwable.html.

pringStackTrace

public void printStackTrace()
Prints this throwable and its backtrace to the standard error stream. This method prints a stack trace for this Throwable object on the error output stream that is the value of the field System.err. The first line of output contains the result of the toString() method for this object. Remaining lines represent data previously recorded by the method fillInStackTrace(). The format of this information depends on the implementation, but the following example may be regarded as typical:
 java.lang.NullPointerException
         at MyClass.mash(MyClass.java:9)
         at MyClass.crunch(MyClass.java:6)
         at MyClass.main(MyClass.java:3)
This example was produced by running the program:
 class MyClass {
     public static void main(String[] args) {
         crunch(null);
     }
     static void crunch(int[] a) {
         mash(a);
     }
     static void mash(int[] b) {
         System.out.println(b[0]);
     }
 }
The backtrace for a throwable with an initialized, non-null cause should generally include the backtrace for the cause. The format of this information depends on the implementation, but the following example may be regarded as typical:
 HighLevelException: MidLevelException: LowLevelException
         at Junk.a(Junk.java:13)
         at Junk.main(Junk.java:4)
 Caused by: MidLevelException: LowLevelException
         at Junk.c(Junk.java:23)
         at Junk.b(Junk.java:17)
         at Junk.a(Junk.java:11)
         ... 1 more
 Caused by: LowLevelException
         at Junk.e(Junk.java:30)
         at Junk.d(Junk.java:27)
         at Junk.c(Junk.java:21)
         ... 3 more
Note the presence of lines containing the characters "...". These lines indicate that the remainder of the stack trace for this exception matches the indicated number of frames from the bottom of the stack trace of the exception that was caused by this exception (the "enclosing" exception). This shorthand can greatly reduce the length of the output in the common case where a wrapped exception is thrown from same method as the "causative exception" is caught. The above example was produced by running the program:
 public class Junk {
     public static void main(String args[]) { 
         try {
             a();
         } catch(HighLevelException e) {
             e.printStackTrace();
         }
     }
     static void a() throws HighLevelException {
         try {
             b();
         } catch(MidLevelException e) {
             throw new HighLevelException(e);
         }
     }
     static void b() throws MidLevelException {
         c();
     }   
     static void c() throws MidLevelException {
         try {
             d();
         } catch(LowLevelException e) {
             throw new MidLevelException(e);
         }
     }
     static void d() throws LowLevelException { 
        e();
     }
     static void e() throws LowLevelException {
         throw new LowLevelException();
     }
 }

 class HighLevelException extends Exception {
     HighLevelException(Throwable cause) { super(cause); }
 }

 class MidLevelException extends Exception {
     MidLevelException(Throwable cause)  { super(cause); }
 }
 
 class LowLevelException extends Exception {
 }
But be careful about the accuracy here. The following is also from the javadoc about the method
public StackTraceElement[] getStackTrace()
Provides programmatic access to the stack trace information printed by printStackTrace().

Some virtual machines may, under some circumstances, omit one or more stack frames from the stack trace. In the extreme case, a virtual machine that has no stack trace information concerning this throwable is permitted to return a zero-length array from this method. Generally speaking, the array returned by this method will contain one element for every frame that would be printed by printStackTrace.

Reference

1. http://stackoverflow.com/questions/1043378/print-full-call-stack-on-printstacktrace

Tuesday, June 12, 2012

How is a converter wired to a JSF tag?

The following is a piece of sample code in JSF that uses converter:
 <h:inputText id="date" value="#{payment.date}"> 
      <f:convertDateTime pattern="MM/yyyy"/>
 </h:inputText>
The convertDateTime converter is an independent object from the inputText tag handler class. Then how does the inputText tag know to use the convertDateTime converter to process the date value? The secret is in the component class. We know the tag handler class has an API method
   public String getComponentType() {...}
 
that tells its component class. The component class has an API method
   public String getRenderType(){...}
 
that tells the renderer class. The renderer class has the API method
   public Object getConvertedValue(FacesContext context,
                                       UIComponent  component,
                                    Object       submittedValue)
   {...}
 
that converts the value. So it is the responsibility of the renderer class to convert the value. For example, the standard component class UIInput uses the specified converter. If you need to create a customer renderer, you will need to set the converter in the renderer.

Monday, June 11, 2012

How Are the JSF Tags Processed In The JSF Lifecycle

When the browser first connects to a jsp page, JSF will execute two phases Restore_View and Render_Response. It creates the view in the Restoer_View phase. But here it is just an empty ViewRoot and it is put into the facescontext. In the Render_Response phase, JSF will creates the actual UI components and build the view. It will also save the view into the session using the class com.sun.faces.application.StateManagerImpl. Here is what happens in the Render_Response phase.

(A) It calls ViewHandlerImpl.executePageToBuildView(...)

  1. The servlet reads the page.
  2. The page contains JSF tags. Each tag has an associated tag handler class. As tags are read, the tag handler classes are executed.
  3. The tag handlers collaborate with each other to build a component tree.
Now let's see some more details in step 2. How are those tag handler classes identified and retrieved? A jsp page declares the tag libraries it used in the beginning of the page. It may use one of the following two formats:
  • <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
  • <jsp:root xmlns:h="http://java.sun.com/jsf/html">
The uri value is used as the identifier by the servlet to locate the TLD file. The TLD file defines its uri value inside itself. The servlet will search for the TLD files at the standard locations to find the matching TLD file.

The TLD file also declares the class name for the tag. That is the tag handler to be invoked. The servlet can just use to class name to load the class.

The tag handler has an instance field for each attribute and the corresponding setter method. When the tag is processed, each tag attribute value is converted to a ValueExpression object, and the setter method is called.

The tag handler also knows the corresponding component class. It has the following method:

public String getComponentType(){...}
The implementation of the tag handler class returns a type value. However this type value is not necessarily the classname of the component class. It is used as an ID to find the class name in the faces-config.xml file. An example is as follows:
<component>
  <component-type>
     com.foo.Xyz
  </component-type>
  <component-class>
     com.foo.UIXyz
  </component-class>
</component>
The tag handler class uses the setProperties(UIComponent component) method to save the attribute values into the component class.

Note: A tag handler may not have a component class. For example, the <f:view> tag has the tag handler class com.sun.faces.taglib.jsf_core.ViewTag. Its getComponentType() method is as follows:

 /**
     * This should never get called for PageTag.
     */
 public String getComponentType() {
        assert (false);
        throw new IllegalStateException();
    }
The javadoc of this class says the following:
/**
 * All JSF component tags must be nested within a f:view tag.  This tag
 * corresponds to the root of the UIComponent tree.  It does not have a
 * Renderer. It exists mainly to provide a guarantee that all faces
 * components reside inside of this tag.
 */

The JSF tags implement the JSP Tag interface. So basically this is the JSP technology. What is different in JSF is that many of the JSF tags have associated component class. And these component classes are put together to form a component tree, which is a center piece in JSF technology.

In the JSP technology, a JSP tag can also have attributes. The tag implementation also needs the setter method for each of the attributes. When the JSP engine encounters the attributes in the tag, it calls the setter methods. Then when the doStartTag() method or other methods of the Tag interface is called, it can print out the attribute value or do anything related to the attribute. In JSF, there are also the setter methods for the attributes. But the tag handler has a new method setProperties(), where the attributes are saved to the component class of the tag.

So compared to the JSP technology, the basic strategy of JSF seems to be that instead of processing the tags and the attributes immediately, it temporarily saves the attribute values into the component tree, and then processes these values in different phases in the JSF lifecycle.

All the above happens in step (A). Now the next step is step (B).

(B) It calls ViewHandlerImpl.renderView(....) to render the page

In this step, all text in the JSP file that is not a JSF tag is passed through. The component classes execute the following render mehtods to produce the HTML text:

  1. encodeBegin()
  2. encodeChildren()
  3. encodeEnd()
These methods basically print out the HTML text.They use the attributes that the tag handlers have saved into them in step (A).

Next the encoded page is sent to the browser.

The browser displays the page. The user fills in the form fields and submits the page.

The JSF framework calls the RestoreView phase and then the ApplyRequestValues phase.

In the ApplyRequestValues phase, the decode() method of the component classes are executed. What does the decode() method do? The method will use the FacesContext to get the request parameter, process it, and calls the method setSubmittedValue(Object). This method is inherited from the class javax.faces.component.UIInput. Notice that this method takes only one parameter. So it seems that an UIInput tag can only deal with one value.

So the submitted value is stored in the component regardless if it is valid or not. But the decode() method will set a flag if it is valid. Subsequently in the JSF life cycle, the value will be converted and validated by the JSF framework.

The component class sets the converter for itself. It can also set its renderer.

References

1. Core JavaServer Faces second edition
2. http://java.sun.com/javaee/javaserverfaces/reference/docs/customRenderKit.html

Monday, May 21, 2012

The basic Code of Ajax

When developing web application using Ajax and JavaScript, the following are the three ways to start the Ajax code.
  • Use the "button" button. The following is some sample JSF code:
      <h:commondButton type="button" value="xyz" onclick="myAjaxFunction();" />
    
    Notice the button's type is "button", which means it is a push button and not a submit button. When a user activates that button, JSF does not submit the surrounding form. You can also use other non-button tags such as inputText to invoke Ajax. As long as an event causes a JavaScript event handler to run, you can put the Ajax code in that event handler to do the work.
  • Use the "submit" button. The following is some sample code used by IceFaces:
       <input type="submit" value="Submit" onclick="iceSubmit(form,this,event);return false;" />
    
    Notice that here the onclick function has to return false to disable the form submission.
  • Use the "submit" button, the JSF action, and the onclick function. The following is the sample code.
       <h:commandButton value="xyz"
     action="#{yourBean.doSomething}" onclick="return myAjaxFunction();" />
    
    Notice that this is a "submit" button because the default type of commandButton is "submit". But if the onclick function returns the value "false", the form will not be submitted, and the JSF "action" won't be invoked. If it returns true, the form will be submitted and the JSF "action" will be executed on the server side.
Now how to make the Ajax call in the web browser and get the response from the server? Basically you need to create a request object ( XMLHttpRequest for a non-IE browser or ActiveXObject for IE) , specify the parameters needed by the HTTP protocol( URL, HTTP method, etc) and send the request. You also attach a handler to the request object that will process the response from the server. There is the built-in function in the request object that will repeatedly invoke the handler with the news of the request's progress. In the handler, you check the status value and perform the action if the status indicates the response is ready.

So the special request object (XMLHttpRequest or ActiveXObject) is not just an object to send the request to the server, it is also an object that will process the response from the server using its built-in mechanism.

The sample code is below.


function myAjaxFunction(){
   var xhr;
   if (window.XMLHttpRequest){
      xhr = new XMLHttpRequest();
   }else if ( window.ActiveXObject){
      xhr = new ActiveXObject("Microsoft.XMLHTTP");
   }

   xhr.onreadystatechange = myHandler;
   xhr.open("GET", "myUrl", true);
   xhr.send(null);
}

function myHandler(){
  if ( xhr.readState == 4 ){
     if ( xhr.status == 200 ){
         var fooComponent = window.document.getElementById("fooComponentId");
         fooComponent.innerHTML = xhr.responseText;
     }
  }
}

In the above code, the URL value "myUrl" can be any URL value you want. For example, you can use "xyz.ajax". And you can use ".ajax" as the suffix for all the URLs used in Ajax. And then on the server side, you can map all such URLs to a servlet that will process all the Ajax requests. The following is a sample servlet for the Ajax request.
   public class AjaxServlet extends HttpServlet {
        public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{
            response.setContentType("Text/plain");
            response.setHeader("Cache-Control", "no-cache");
            response.setStatus(HttpServletResponse.SC_OK);
            response.getWritter().write("some content text here");
        }
 
   }

Friday, May 11, 2012

A Case Of Debugging On JSF

The getWriter() Error

Recently I was investigating a simple JSF web application that was deployed to weblogic 10 and got the following error
]] Root cause of ServletException.
java.lang.IllegalStateException: strict servlet API: cannot call getWriter() after getOutputStream()
 at weblogic.servlet.internal.ServletResponseImpl.getWriter(ServletResponseImpl.java:309)
 at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:186)
 at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:108)
 at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:266)
 at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:159)
 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
 at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
......
Since the first line says about weblogic, I thought it must be some problem caused by the weblogic. Later on, I found the error was actually caused by the isf-impl.jar library. The second line in the stack trace is
com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:186)
The class ViewHandlerImpl is from jsf-impl-1.2.jar (Implementation-Version: 1.2-b20-FCS). The method renderView() has the following code at line 186:
 responseWriter = newWriter.cloneWithWriter(response.getWriter());
The variable "response" here is the vendor implementation specific. And here it is the weblogic ServletResponseImpl. When it calls getWriter(), error happens. The problem here is actually not the class ServletResponseImpl. The ViewHandlerImpl should not have called resonse.getWriter(). After I changed the jar from jsf-impl-1.2.jar to jsf-impl-1.2_15.jar, the application worked fine. I checked the source code of ViewHandlerImpl.java in the new jar. This time there is no call to the response.getWriter().

A lesson from this is that the final place that gives error is not necessarily the place where the error needs to be fixed. Sometimes the error is caused by the upper stream class that does not follow the rule.

Another Stack Trace

The following is the starcktrace of another error related to the jar jsf-impl-1.2.jar. I listed it here so we can see the steps that lead to the compiling of a jsp page
Error 500--Internal Server Error 
weblogic.servlet.jsp.CompilationException: Failed to compile JSP /CustomerSearch.jsp
CustomerSearch.jsp:23:128: The method setVar(String) in the type DataTableTag is not applicable for the arguments (ValueExpression)
   
                                                                                                                               ^--------^

 at weblogic.servlet.jsp.JavelinxJSPStub.reportCompilationErrorIfNeccessary(JavelinxJSPStub.java:226)
 at weblogic.servlet.jsp.JavelinxJSPStub.compilePage(JavelinxJSPStub.java:162)
 at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.java:246)
 at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.java:191)
 at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:235)
 at weblogic.servlet.internal.ServletStubImpl.onAddToMapException(ServletStubImpl.java:408)
 at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:318)
 at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)
 at weblogic.servlet.internal.RequestDispatcherImpl.invokeServlet(RequestDispatcherImpl.java:502)
 at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:248)
 at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:414)
 at com.sun.faces.application.ViewHandlerImpl.executePageToBuildView(ViewHandlerImpl.java:455)
 at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:139)
 at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:108)
 at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:266)
 at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:159)
 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
 at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
 at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
 at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
 at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
 at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
 at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
 at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
 at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3592)
 at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
 at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
 at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2202)
 at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2108)
 at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1432)
 at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
 at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
 
We can see that the weblogic uses its own classes to compile the jsp page from the following line and the lines before it:
at weblogic.servlet.jsp.JavelinxJSPStub.compilePage
(JavelinxJSPStub.java:162)
My conclusion is the following.
  1. Weblogic has its own JSP compiler implementation to compile a JSP file.
  2. When weblogic compiles a JSP page, it refers to the tld file to generate the java code for the tags used in the JSP page. The tld files can be contained in the jsf-impl jar file. However Weblogic does not need the java class files in the jsf-impl jar file. It just needs the tld file as the specification to generate the java code for JSP.
  3. The jsf-impl jar file contains both the tld file and the tag class files.
  4. In the error case shown in the stacktrace above, the java code generated by the weblogic JSP compiler and the tld file html_basic.tld in jsf-impl-1.2.jar does not match the tag class DataTableTag.class in jsf-impl-1.2.jar. So error occurs.

More on the TLD File

According to the book "Core JavaServer Faces, 2nd edition", page 373, the JSF implementation searches for TLD files in the following locations:
  • The WEB-INF directory or one of its subdirectories
  • The META-INF directory or any JAR file in the WEB-INF/lib directory
In the jsp file, you use one of the following formats to declare the tag library:
  <%@ tablib uri="http://java.sun.com/jsf/core" prefix="f" %>
or something like the following
  <html 
 xmlns:f="http://java.sun.com/jsf/core"
 >
You can see that it does not specify the location of the TLD file. So how does the server find the exact TLD file that matches the declaraion? The answer is to use the URI. In this case, the URI is http://java.sun.com/jsf/core. The TLD file has to define the URI attribute. The following is from the jsf-core.tld file:

  <tlib-version>1.0</tlib-version>
  <jsp-version>1.2</jsp-version>
  <short-name>f</short-name>
  <uri>http://java.sun.com/jsf/core</uri>
  <description>
    The core JavaServer Faces custom actions that are independent of
    any particular RenderKit.
  </description>

Friday, April 6, 2012

Rethink of the Browser URL

I am reading some network stuff such as Oracle Net used in Oracle database driver, the linux nc command, firewall rules, etc. Basically with so many kinds of network protocols and services, the underneath layer is the same TCP/IP layer. Depending on which network layer you are changing, the effects will apply to all the services above that layer. So if a firewall rule is on the network layer, all the upper layer services such as HTTP, FTP, etc will be affected.

Now looking at the brower URL, http://www.google.com for example. The "www.google.com" part is basically an IP address so it is in the network layer. The "http" part is the application layer. So these two are the bricks of this whole URL thing that the brower needs. Of course, the brower needs a port number. But it can just use the default number 80.

One interesting thing I read about the linux "nc" command is that you can submit an email manually like the following:
$ nc localhost 25 << EOF
           HELO host.example.com
           MAIL FROM: 
           RCPT TO: 
           DATA
           Body of email.
           .
           QUIT
           EOF
So you just need to use the correct format of a given protocol on the designated port to use the service that uses the protocol.

Wednesday, March 21, 2012

How To Log access.log in Weblogic Without Delay

We use Weblogic 10.3.2 here. By default, the access.log will not be updated immediately when a new http request is sent from the client. And currently there is no place in weblogic console where you can change this behavior. The way to work around this is to modify the config.xml file. The following needs to be inserted in between the <server> and </server> tag:
<web-server>
        <web-server-log>
          <buffer-size-kb>0</buffer-size-kb>
        </web-server-log>
    </web-server>

However, it has to be inserted at the correct location. Otherwise it will make config.xml invalid. The following is an example of the correct location:
<server>
    <name>AdminServer</name>
    <ssl>
      <enabled>true</enabled>
      <hostname-verifier xsi:nil="true"></hostname-verifier>
      <hostname-verification-ignored>false</hostname-verification-ignored>
      <export-key-lifespan>500</export-key-lifespan>
      <client-certificate-enforced>true</client-certificate-enforced>
      <listen-port>7022</listen-port>
      <two-way-ssl-enabled>true</two-way-ssl-enabled>
      <ssl-rejection-logging-enabled>true</ssl-rejection-logging-enabled>
      <inbound-certificate-validation>BuiltinSSLValidationOnly</inbound-certificate-validation>
      <outbound-certificate-validation>BuiltinSSLValidationOnly</outbound-certificate-validation>
      <allow-unencrypted-null-cipher>false</allow-unencrypted-null-cipher>
      <use-server-certs>false</use-server-certs>
    </ssl>
    <listen-port>7021</listen-port>
    <listen-port-enabled>true</listen-port-enabled>

    <web-server>
      <web-server-log>
        <buffer-size-kb>0</buffer-size-kb>
      </web-server-log>
    </web-server>

    <listen-address></listen-address>
    <java-compiler>javac</java-compiler>
    <client-cert-proxy-enabled>false</client-cert-proxy-enabled>
  </server>

In the above, it is for the AdminServer. I think this can be done for other servers.

Tuesday, March 13, 2012

Linux Kernel Space, Context Switch, etc

I am reading some stuff on Linux. Just want to summarize some information here.

Linux is a monolithic kernel; that is, the linux kernel executes in a single address space entirely in kernel mode. Linux dose not differentiate between threads and normal processes. A thread is merely a process that shares certain resources with other processes.

In Linux, each processor is doing exactly one of the three things below at any given moment:

  1. In user-space, executing user code in a process.
  2. In kernel-space, in process context, executing on behalf of a specific process.
  3. In kernel-space, in interrupt context, not associated with a process, handling an interrupt.

When executing kernel code, the system is in kernel-space executing in kernel mode. When executing a regular process, the system is in user-space executing in user mode.

When an application executes a system call, we say that the kernel is executing on behalf of the application. Furthermore, the application is said to be executing a system call in kernel-space, and the kernel is running in process context.

A context switch can mean a register context switch, a task context switch, a thread context switch, or a process context switch. What constitutes the context is determined by the processor and the operating system.

When an interrupt occurs, the hardware automatically switches a part of the context (at least enough to allow the handler to return to the interrupted code). The handler may save additional context, depending on details of the particular hardware and software designs. Often only a minimal part of the context is changed in order to minimize the amount of time spent handling the interrupt. The kernel does not spawn or schedule a special process to handle interrupts, but instead the handler executes in the (often partial) context established at the beginning of interrupt handling. Once interrupt servicing is complete, the context in effect before the interrupt occurred is restored so that the interrupted process can resume execution in its proper state.

When a transition between user mode and kernel mode is required in an operating system, a context switch is not necessary; a mode transition is not by itself a context switch. However, depending on the operating system, a context switch may also take place at this time.

When an interrupt occurs, unless the interrupt is disabled in the processor, the processor immediately stops what it is doing, disables the interrupt system, and jumps to a predefined location in memory and executes the code located there. To balance the large amount of work with the need for quick execution, the kernel divides the work of processing interrupts into two halves. The interrupt handler is the top half. The bottom half can be executed later.

References

1. Linux Kernel Development, 3rd edition, by Robert Love
2. http://en.wikipedia.org/wiki/Context_switch

Monday, March 12, 2012

JUnit Test

This is a presentation that I did for using junit test.

Introduction to JUnit Test


Uses

A framework for unit test. Used mainly to test individual classes and methods.

JUnit Library

In maven pom.xml:
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
The scope is "test". So the junit.jar will not be packaged into the application for deployment.

Configure Maven for Running JUnit

In maven pom.xml:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<!--<skipTests>true</skipTests>-->
<testFailureIgnore>false</testFailureIgnore>
</configuration>
</plugin>
If skipTests is true, no unit tests will be run.
If testFailureIgnore is true, the tests will be run and the build maven will succeed even if some tests fail.
If testFailureIgnore is false, the tests will be run and build will fail if a test fails.

The test results will go to the directory:
project_base_directory\target\surefire-reports

Traditional JUnit Test

The test class must extend the JUnit class TestCase or its subclasses.
  1. Use setUp() to initialize resources.
  2. Use tearDown() to release resources
  3. Every test method must start with the lowercase "test".

The lifecycle of a TestCase

The lifecycle of a TestCase used by the JUnit framework is as follows:
  1. Execute setUp().
  2. Call a test-prefixed method.
  3. Execute tearDown().
  4. Repeat these steps for each test method. This will occur even if setUp() or tearDown() throws an exception
Notes:
If setUp() throws an Exception, the test method and tearDown() will not be executed.
If the test method fails and throws an error or exception, tearDown() will still be executed.

Utility Methods from Assert

  • assertTrue(String message, boolean condition)
  • assertFalse(String message, boolean condition)
  • fail(String message)
  • assertEquals(String message, Object expected, Object actual)
  • assertEquals(String message, String expected, String actual)
  • assertEquals(String message, double expected, double actual, double delta)
  • assertEquals(String message, int expected, int actual)
  • assertSame(String message, Object expected, Object actual)
  • assertNotNull(String message, Object object)
  • assertNull(String message, Object object)
See the class junit.framework.Assert for more methods.

A Sample Class for Testing

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class Sound {
 private Map<String, String> voicemap = new HashMap<String, String>() {
  {
   put("bee", "buzz");
   put("cow", "moo");
   put("dog", "woof");
   put("cat", "meow");
   put("snake", "hiss");
   put("bird", "chir");
   put("goose", "honk");
  }
 };

 public String speak(String animal) throws Exception {
  if (animal == null) {
   throw new Exception("animial is not specified.");
  }
  String name = animal.toLowerCase();
  Set<String> animals = voicemap.keySet();
  if (!animals.contains(name)) {
   throw new Exception("not implemented yet for this animal.");
  }
  return voicemap.get(name);
 }

 public String yell(String animal) throws Exception {
  String sound = speak(animal);
  return sound.toUpperCase();
 }
}

A Sample JUnit Test Class

import junit.framework.TestCase;

public class SoundTest extends TestCase {

/* This is for demo only. In real life, you won’t need to initialize a simple object such as Sound here. The objects that need to be initialized  in the setUp() method are usually more complex resources such as database connection. 
*/
 private Sound sound = null; 

 @Override
 protected void setUp() throws Exception {
  super.setUp();
  sound = new Sound();  
 }

 @Override
 protected void tearDown() throws Exception {
  sound = null;
  super.tearDown();
 }

 public void testSpeak() throws Exception {
  String beeSound = sound.speak("bee");
  assertEquals("buzz", beeSound);
  try {
   String temp = sound.speak("fish");
   fail("Failed for fish. This statemente should not have been executed");
  } catch (Exception e) {
   return; // excepted
  }
 }

 public void testYell() {
  try {
   String gooseYell = sound.yell("goose");
   assertEquals("The sound of goose is not right", "HONK", gooseYell);
  } catch (Exception e) {
   fail("Test failed. This statement should not have been reached.");
  }
 }
}


Run JUnit in Eclipse


Run JUnit Test On CommandLine

JUnit provides the TestRunner classes for running all the tests. The two most popular test runners are a text-based one, junit.textui.TestRunner, and a Swing-based one, junit.swingui.TestRunner

Example:
java junit.textui.TestRunner org.example.SampleTest

TestSuite

JUnit tests can be grouped together by using the TestSuite class.
Example:
import junit.framework.Test;
import junit.framework.TestSuite;

public class GroupTests extends TestSuite {
      static public Test suite() {
            TestSuite suite = new TestSuite();
             suite.addTestSuite(SimpleTest1.class);
             suite.addTestSuite(SimpleTest2.class);
             return suite;
    }
}

When this test is run, both SimpleTest1 and SimpleTest2 will be invoked.

Junit Test Using Annotation in JUnit4

  1. No need to extend the class TestCase
  2. No need to use setUp() or tearDown(). Use @Before and @After instead.
  3. The test method name does not need to start with "test". But you need to put the @Test annotation before each test method.
  4. Use @Test(expected = YourException.class) to test exception
  5. Can use @Test(timeout = ?) for performance testing. Here "?" is time in milliseconds.
  6. Can use @Ignore to ignore a test
Example Using Annotation

import junit.framework.Assert;

import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;

public class SoundAnnotationTest {

/** This is for demo only. In real life, you won’t need to initialize a simple object such as Sound here. The objects that need to be initialized  in the @Before method are usually more complex resources such as database connection. 
*/
 private Sound sound = null;

 /**
  * The method name does not have to be setUp. You can have multiple such
  * methods with the "Before" annotattion, each of which is run before each
  * test
  */
 @Before
 public void setUp() {
  sound = new Sound();
 }

 /**
  * The method name does not have to be tearDown. You can have multiple such
  * methods with teh "After" annotation, each of which is run after each
  * test.
  */
 @After
 public void tearDown() {
  sound = null;

 }

 @Test
 public void speak() {
  try {
   String beeSound = sound.speak("bee");
   Assert.assertEquals("buzz", beeSound);
  } catch (Exception e) {
   Assert.fail("Test failed.");
  }

  try {
   sound.speak("fish");
   Assert.fail("Failed for fish. This statemente should not have been executed");
  } catch (Exception e) {
   return; // excepted
  }
 }

 @Test
 public void testYell() {
  try {
   String gooseYell = sound.yell("goose");
   Assert.assertEquals("The sound of goose is not right", "HONK",
     gooseYell);
  } catch (Exception e) {
   Assert.fail("Test failed. This statement should not have been reached.");
  }
 }

 @Test(expected = Exception.class)
 // IndexOutOfBoundsException.class
 public void testFish() throws Exception {
  sound.speak("fish");
 }

 @Test(timeout = 700)
 public void testPerformance() throws Exception {
  Thread.currentThread().sleep(600);
 }

 @Ignore
 public void foo() throws Exception {
  for (int i = 0; i < 10; i++) {
   // no-op
  }
 }
}

Use EasyMock in JUnit

  1. Create Mock object using EasyMock.createMock
  2. Mock expected results using EasyMock's expect and the andReturn()/andThrow() method
    You can use andReturn to return the value you want.
    You can use andThrow to throw any kind of exception you like.
  3. Call the EasyMock replay() method.
  4. Do test and check results.

Example Using EasyMock

(MyServiceEndpointTest)
fooServiceMock = createMock(FooService.class);
barServiceMock = createMock(BarService.class);
endPoint = new MarshallingCommonServiceEndpoint(barServiceMock,
    fooServiceMock);
expect(barServiceMock.getSomeInput(arg1, arg2)).andReturn(Boolean.TRUE);
replay(barServiceMock);
GetBarResponse response = endPoint.getBar(request);
assertTrue("Invalid status", response.isStatus());

HSQLDB


HSQLDB stands for "Hyper Structured Query Language Database". It is a relational database management system written in Java. It offers a fast, small database engine which offers both in-memory and disk-based tables. Embedded and server modes are available.
Instead of connecting to the actual database, JUnit can use HSQLDB for tests related to database actions.
Example: LocationDaoTest.java. This test class extends
AbstractTransactionalDataSourceSpringContextTests. This is from Spring. It is a subclass of TestCase and offers features such as transaction management and bean injection.

Resources

  1. http://java.sun.com/developer/Books/javaprogramming/ant/ant_chap04.pdf
  2. http://www.ibm.com/developerworks/java/library/j-easymock/index.html
  3. http://www.ibm.com/developerworks/java/library/j-junit4/index.html
  4. http://www.methodsandtools.com/tools/tools.php?junit

Tuesday, February 14, 2012

Class Loader Hierarchy Of An Application On Weblogic Server

Some Background Knowledge About the Java Class Loaders

When the JVM is started, three class loaders are used:

  1. Bootstrap class loader
  2. Extensions class loader
  3. System class loader

The bootstrap class loader loads the core Java libraries located in the <JAVA_HOME>/jre/lib directory. This class loader, which is part of the core JVM, is written in native code.

The extensions class loader loads the code in the extensions directories (<JAVA_HOME>/jre/lib/ext, or any other directory specified by the java.ext.dirs system property). It is implemented by the sun.misc.Launcher$ExtClassLoader class.

The system class loader loads code found on java.class.path, which maps to the CLASSPATH environment variable. This is implemented by the sun.misc.Launcher$AppClassLoader class.

The Weblogic Server and Application Configuration

This is weblogic 10.3.2. The application is deployed to the myAppwls10loc domain. There is a startup class for the domain. The domain lib directory has a jar jt400.jar.
In the command startWeblogic.cmd, two additional jars are put onto the classpath:
set CLASSPATH=C:\workshop\myclient.jar; %MAVEN_HOME%\oracle\jars\aqapi-9.0.2.jar ;%CLASSPATH%
The application is an ear. It has two modules: a war and an ejb jar. The ear has the following layout:
APP-INF
  classes
  lib
    x.jar
META-INF
myejb.jar
mywar.war

In summary, the results are the following.
  1. The classes in myclient.jar ( used by the startup class ) are loaded with the following hierarchy:
    |
    sun.misc.Launcher$ExtClassLoader@19134f4
    |
    sun.misc.Launcher$AppClassLoader@47858e
    

  2. The classes in APP-INF/lib/x.jar and the classes in myejb.jar are loaded with the following hirearchy (NOTE: their context class loaders are different though):
    |
    sun.misc.Launcher$ExtClassLoader@19134f4
     |
    sun.misc.Launcher$AppClassLoader@47858e
     |
    java.net.URLClassLoader@164dbd5
     |
    weblogic.utils.classloaders.GenericClassLoader@1db6942
     |
    weblogic.utils.classloaders.FilteringClassLoader@11f9cee
     |
    weblogic.utils.classloaders.GenericClassLoader@f8d6a6
    

  3. Add the code to print the class loader hierarchy in the jsp file in mywar.war. The output is the following:
    |
    sun.misc.Launcher$ExtClassLoader@19134f4
     |
    sun.misc.Launcher$AppClassLoader@47858e
     |
    java.net.URLClassLoader@164dbd5
     |
    weblogic.utils.classloaders.GenericClassLoader@1db6942
     |
    weblogic.utils.classloaders.FilteringClassLoader@11f9cee
     |
    weblogic.utils.classloaders.GenericClassLoader@f8d6a6
     |
    weblogic.utils.classloaders.ChangeAwareClassLoader@17b51e8
     |
    weblogic.servlet.jsp.TagFileClassLoader@18d70a6
     |
    weblogic.servlet.jsp.JspClassLoader@a3af1c
    
    You can see that this is a child class loader of the class loader that loads the classes in myejb.jar and x.jar.

Below are more details. In the following log file, the class SampleBo is in a jar that resides in the directory APP-INF/lib directory. And the class XyzMessageHandlerImpl is in myejb.jar.

The following functions are used to print out the classloader tree:

private void printClassloaders(Class clazz) {
  ClassLoader classLoader = clazz.getClassLoader();
  System.out.println("==============================");
  System.out.println("Class name:" + clazz.getName());
  printCLtree(classLoader, "");
  System.out
    .println("Thread.currentThread().getClass().getClassLoader():");
  ClassLoader cl = Thread.currentThread().getClass().getClassLoader();
  printCLtree(cl, "");
  System.out.println("==============================");
 }

 private void printCLtree(ClassLoader cl, String indent) {
  if (cl == null) {
   return;
  }
  System.out.println(indent + "ClassLoader=" + cl);
  ClassLoader pcl = cl.getParent();
  if (pcl == null) {
   System.out.println(indent + "  ClassLoader=" + pcl);
  } else {
   printCLtree(pcl, indent + "  ");
  }
 }

 public static void printClassLoaderHierarchy(Class c) {
  ClassLoader cl = c.getClassLoader();
  System.out.println("___________________START_______________________");
  System.out.println("\nClass loader tree");
  printClassLoaderTree(cl);
  System.out.println("\nContext loader tree");
  ClassLoader l = Thread.currentThread().getContextClassLoader();
  printClassLoaderTree(l);
  System.out.println("____________________END_______________________");
 }

 public static void printClassLoaderTree(ClassLoader l) {
  ClassLoader p = l.getParent();
  if (p != null)
   printClassLoaderTree(p);
  String u = "";
  if (l instanceof URLClassLoader)
   u = getURLs(((URLClassLoader) l).getURLs());
  System.out.println((new StringBuilder("\t|\n")).append(l).append(" ")
    .append(u).toString());
 }

 public static String getURLs(URL urls[]) {
  if (urls == null)
   return "{}";
  StringBuffer b = new StringBuffer("{");
  for (int i = 0; i < urls.length; i++)
   b.append(urls[i]).append(":");

  b.append("}");
  return b.toString();
 }



The following is the log file:

.
.
JAVA Memory arguments: -Xms256m -Xmx512m -XX:CompileThreshold=8000 -XX:PermSize=48m  -XX:MaxPermSize=128m
.
WLS Start Mode=Development
.
CLASSPATH=C:\workshop\myclient.jar; C:/workspace/maven \oracle\jars\aqapi-9.0.2.jar ;C:\bea1032\patch_wls1032\profiles\default\sys_manifest_classpath\weblogic_patch.jar;C:\bea1032\patch_oepe1032\profiles\default\sys_manifest_classpath\weblogic_patch.jar;C:\bea1032\JDK160~1.5-3\lib\tools.jar;C:\bea1032\utils\config\10.3\config-launch.jar;C:\bea1032\WLSERV~1.3\server\lib\weblogic_sp.jar;C:\bea1032\WLSERV~1.3\server\lib\weblogic.jar;C:\bea1032\modules\features\weblogic.server.modules_10.3.2.0.jar;C:\bea1032\WLSERV~1.3\server\lib\webservices.jar;C:\bea1032\modules\ORGAPA~1.0/lib/ant-all.jar;C:\bea1032\modules\NETSFA~1.0_1/lib/ant-contrib.jar;C:\bea1032\WLSERV~1.3\common\eval\pointbase\lib\pbclient57.jar;C:\bea1032\WLSERV~1.3\server\lib\xqrl.jar
.
PATH=C:\bea1032\patch_wls1032\profiles\default\native;C:\bea1032\patch_oepe1032\profiles\default\native;C:\bea1032\WLSERV~1.3\server\native\win\32;C:\bea1032\WLSERV~1.3\server\bin;C:\bea1032\modules\ORGAPA~1.0\bin;C:\bea1032\JDK160~1.5-3\jre\bin;C:\bea1032\JDK160~1.5-3\bin;C:\bea1032\jrockit_160_14_R27.6.5-32\jre\bin;C:\Program Files\CA\SC\CAWIN\;C:\PROGRA~1\CA\SC\ETPKI\lib;C:\Program Files\Java\jdk1.6.0_14\bin;C:\Program Files\JavaFX\javafx-sdk1.3\bin;C:\Program Files\JavaFX\javafx-sdk1.3\emulator\bin;C:\Program Files\JavaFX\javafx-sdk1.2\bin;C:\Program Files\JavaFX\javafx-sdk1.2\emulator\bin;C:\Perl\site\bin;C:\Perl\bin;C:\ant\apache-ant-1.7.1\bin;C:\notes\;C:\notes\data\;C:\oracle\ora90\bin;C:\Program Files\Oracle\jre\1.1.8\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Common Files\Autodesk Shared\;C:\Program Files\Intel\DMIX;C:\Program Files\Common Files\Roxio Shared\DLLShared\;C:\apache-maven-2.2.1\bin;C:\JavaKit\j3d\bin;C:\Program Files\Borland\CaliberRM SDK 2008\lib;;C:\Program Files\SEAGULL\BlueZone\;C:\PROGRA~1\CA\SC\CAM\bin;C:\Program Files\CA\DSM\bin;C:\Program Files\CA\SC\Csam\SockAdapter\\bin;C:\Program Files\Enterprise Vault\EVClient\;C:\WINDOWS\system32\WindowsPowerShell\v1.0;C:\Program Files\Subversion\bin;C:\Program Files\SSH Communications Security\SSH Secure Shell;C:\bea1032\WLSERV~1.3\server\native\win\32\oci920_8
.
***************************************************
*  To start WebLogic Server, use a username and   *
*  password assigned to an admin-level user.  For *
*  server administration, use the WebLogic Server *
*  console at http:\\hostname:port\console        *
***************************************************
starting weblogic with Java version:
java version "1.6.0_14"
Java(TM) SE Runtime Environment (build 1.6.0_14-b08)
Java HotSpot(TM) Client VM (build 14.0-b16, mixed mode)
Starting WLS with line:
C:\bea1032\JDK160~1.5-3\bin\java -client   -Xms256m -Xmx512m -XX:CompileThreshold=8000 -XX:PermSize=48m  -XX:MaxPermSize=128m -Dweblogic.Name=myAppAdminServer -Djava.security.policy=C:\bea1032\WLSERV~1.3\server\lib\weblogic.policy  -Xverify:none  -da -Dplatform.home=C:\bea1032\WLSERV~1.3 -Dwls.home=C:\bea1032\WLSERV~1.3\server -Dweblogic.home=C:\bea1032\WLSERV~1.3\server   -Dweblogic.management.discover=true  -Dwlw.iterativeDev= -Dwlw.testConsole= -Dwlw.logErrorsToConsole= -Dweblogic.ext.dirs=C:\bea1032\patch_wls1032\profiles\default\sysext_manifest_classpath;C:\bea1032\patch_oepe1032\profiles\default\sysext_manifest_classpath  weblogic.Server
<Feb 14, 2012 10:01:54 AM EST> <Notice> <WebLogicServer> <BEA-000395> <Following extensions directory contents added to the end of the classpath:
C:\bea1032\user_projects\domains\myAppwls10loc\lib\jt400.jar> 
<Feb 14, 2012 10:01:54 AM EST> <Info> <WebLogicServer> <BEA-000377> <Starting WebLogic Server with Java HotSpot(TM) Client VM Version 14.0-b16 from Sun Microsystems Inc.> 
<Feb 14, 2012 10:01:55 AM EST> <Info> <Management> <BEA-141107> <Version: WebLogic Server 10.3.2.0  Tue Oct 20 12:16:15 PDT 2009 1267925 > 
<Feb 14, 2012 10:01:58 AM EST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STARTING> 
<Feb 14, 2012 10:01:58 AM EST> <Info> <WorkManager> <BEA-002900> <Initializing self-tuning thread pool> 
<Feb 14, 2012 10:01:59 AM EST> <Notice> <LoggingService> <BEA-320400> <The log file C:\bea1032\user_projects\domains\myAppwls10loc\servers\myAppAdminServer\logs\myAppAdminServer.log will be rotated. Reopen the log file if tailing has stopped. This can happen on some platforms like Windows.> 
<Feb 14, 2012 10:01:59 AM EST> <Notice> <LoggingService> <BEA-320401> <The log file has been rotated to C:\bea1032\user_projects\domains\myAppwls10loc\servers\myAppAdminServer\logs\myAppAdminServer.log00138. Log messages will continue to be logged in C:\bea1032\user_projects\domains\myAppwls10loc\servers\myAppAdminServer\logs\myAppAdminServer.log.> 
<Feb 14, 2012 10:01:59 AM EST> <Notice> <Log Management> <BEA-170019> <The server log file C:\bea1032\user_projects\domains\myAppwls10loc\servers\myAppAdminServer\logs\myAppAdminServer.log is opened. All server side log events will be written to this file.> 
<Feb 14, 2012 10:02:07 AM EST> <Notice> <Security> <BEA-090082> <Security initializing using security realm myrealm.> 
<Feb 14, 2012 10:02:11 AM EST> <Notice> <LoggingService> <BEA-320400> <The log file C:\bea1032\user_projects\domains\myAppwls10loc\servers\myAppAdminServer\logs\access.log will be rotated. Reopen the log file if tailing has stopped. This can happen on some platforms like Windows.> 
<Feb 14, 2012 10:02:11 AM EST> <Notice> <LoggingService> <BEA-320401> <The log file has been rotated to C:\bea1032\user_projects\domains\myAppwls10loc\servers\myAppAdminServer\logs\access.log00080. Log messages will continue to be logged in C:\bea1032\user_projects\domains\myAppwls10loc\servers\myAppAdminServer\logs\access.log.> 
TimerStartUp static block

Class loader tree
 |
sun.misc.Launcher$ExtClassLoader@19134f4 {
file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/dnsns.jar:
file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/localedata.jar:
file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/sunjce_provider.jar:
file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/sunmscapi.jar:
file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/sunpkcs11.jar:}
 |
sun.misc.Launcher$AppClassLoader@47858e {
file:/C:/workshop/myclient.jar:
file:/C:/bea1032/user_projects/domains/myAppwls10loc/%20C:/workspace/maven%20/oracle/jars/aqapi-9.0.2.jar%20:
file:/C:/bea1032/patch_wls1032/profiles/default/sys_manifest_classpath/weblogic_patch.jar:
file:/C:/bea1032/patch_oepe1032/profiles/default/sys_manifest_classpath/weblogic_patch.jar:
file:/C:/bea1032/jdk160_14_R27.6.5-32/lib/tools.jar:
file:/C:/bea1032/utils/config/10.3/config-launch.jar:
file:/C:/bea1032/wlserver_10.3/server/lib/weblogic_sp.jar:
file:/C:/bea1032/wlserver_10.3/server/lib/weblogic.jar:
file:/C:/bea1032/modules/features/weblogic.server.modules_10.3.2.0.jar:
file:/C:/bea1032/wlserver_10.3/server/lib/webservices.jar:
file:/C:/bea1032/modules/org.apache.ant_1.7.0/lib/ant-all.jar:
file:/C:/bea1032/modules/net.sf.antcontrib_1.0.0.0_1-0b2/lib/ant-contrib.jar:
file:/C:/bea1032/wlserver_10.3/common/eval/pointbase/lib/pbclient57.jar:
file:/C:/bea1032/wlserver_10.3/server/lib/xqrl.jar:}

Context loader tree
 |
sun.misc.Launcher$ExtClassLoader@19134f4 {
file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/dnsns.jar:
file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/localedata.jar:
file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/sunjce_provider.jar:
file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/sunmscapi.jar:
file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/sunpkcs11.jar:}
 |
sun.misc.Launcher$AppClassLoader@47858e {
file:/C:/workshop/myclient.jar:
file:/C:/bea1032/user_projects/domains/myAppwls10loc/%20C:/workspace/maven%20/oracle/jars/aqapi-9.0.2.jar%20:
file:/C:/bea1032/patch_wls1032/profiles/default/sys_manifest_classpath/weblogic_patch.jar:
file:/C:/bea1032/patch_oepe1032/profiles/default/sys_manifest_classpath/weblogic_patch.jar:
file:/C:/bea1032/jdk160_14_R27.6.5-32/lib/tools.jar:
file:/C:/bea1032/utils/config/10.3/config-launch.jar:
file:/C:/bea1032/wlserver_10.3/server/lib/weblogic_sp.jar:
file:/C:/bea1032/wlserver_10.3/server/lib/weblogic.jar:
file:/C:/bea1032/modules/features/weblogic.server.modules_10.3.2.0.jar:
file:/C:/bea1032/wlserver_10.3/server/lib/webservices.jar:
file:/C:/bea1032/modules/org.apache.ant_1.7.0/lib/ant-all.jar:
file:/C:/bea1032/modules/net.sf.antcontrib_1.0.0.0_1-0b2/lib/ant-contrib.jar:
file:/C:/bea1032/wlserver_10.3/common/eval/pointbase/lib/pbclient57.jar:
file:/C:/bea1032/wlserver_10.3/server/lib/xqrl.jar:}
 |
java.net.URLClassLoader@164dbd5 {
file:/C:/bea1032/user_projects/domains/myAppwls10loc/lib/jt400.jar:}

Tue Feb 14 10:02:11 EST 2012; INFO: binding to jnditree [t3://localhost:7001]
Tue Feb 14 10:02:11 EST 2012; INFO: binding fakequeue [App1Queue] as [javax.naming.InitialContext@1fd9726]
Tue Feb 14 10:02:11 EST 2012; INFO: timeout set [100] to [javax.naming.InitialContext@1fd9726]
Tue Feb 14 10:02:11 EST 2012; INFO: create queueconnection [timeout=100] as [com.myapp.messaging.aq.qfc.FakeQueueConnectionFactory@e0c07c]
Tue Feb 14 10:02:11 EST 2012INFO:  start connection[null] closed[false]
Tue Feb 14 10:02:11 EST 2012; INFO: binding fakefactory [App1ConnectionFactory] as [com.myapp.messaging.aq.qfc.FakeQueueConnectionFactory@e0c07c]
Tue Feb 14 10:02:11 EST 2012; INFO: creating fakeconnct [] as [com.myapp.messaging.aq.qfc.FakeQueueConnection@18a8bfasession=nullclosed=falsesession_list=0]
Tue Feb 14 10:02:11 EST 2012; INFO: TimerStartup [finished]
<Feb 14, 2012 10:02:16 AM EST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STANDBY> 
<Feb 14, 2012 10:02:16 AM EST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STARTING> 
==============================
Class name:com.myapp.business.sample.SampleBo
ClassLoader=weblogic.utils.classloaders.GenericClassLoader@f8d6a6 finder: weblogic.utils.classloaders.CodeGenClassFinder@8f53c8 annotation: myApp@
  ClassLoader=weblogic.utils.classloaders.FilteringClassLoader@11f9cee finder: weblogic.utils.classloaders.CodeGenClassFinder@77e77a annotation: 
    ClassLoader=weblogic.utils.classloaders.GenericClassLoader@1db6942 finder: weblogic.utils.classloaders.CodeGenClassFinder@1fe2c10 annotation: 
      ClassLoader=java.net.URLClassLoader@164dbd5
        ClassLoader=sun.misc.Launcher$AppClassLoader@47858e
          ClassLoader=sun.misc.Launcher$ExtClassLoader@19134f4
            ClassLoader=null
Thread.currentThread().getClass().getClassLoader():
ClassLoader=sun.misc.Launcher$AppClassLoader@47858e
  ClassLoader=sun.misc.Launcher$ExtClassLoader@19134f4
    ClassLoader=null
==============================
___________________START_______________________

Class loader tree
 |
sun.misc.Launcher$ExtClassLoader@19134f4 {file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/dnsns.jar:file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/localedata.jar:file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/sunjce_provider.jar:file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/sunmscapi.jar:file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/sunpkcs11.jar:}
 |
sun.misc.Launcher$AppClassLoader@47858e {file:/C:/workshop/myclient.jar:file:/C:/bea1032/user_projects/domains/myAppwls10loc/%20C:/workspace/maven%20/oracle/jars/aqapi-9.0.2.jar%20:file:/C:/bea1032/patch_wls1032/profiles/default/sys_manifest_classpath/weblogic_patch.jar:file:/C:/bea1032/patch_oepe1032/profiles/default/sys_manifest_classpath/weblogic_patch.jar:file:/C:/bea1032/jdk160_14_R27.6.5-32/lib/tools.jar:file:/C:/bea1032/utils/config/10.3/config-launch.jar:file:/C:/bea1032/wlserver_10.3/server/lib/weblogic_sp.jar:file:/C:/bea1032/wlserver_10.3/server/lib/weblogic.jar:file:/C:/bea1032/modules/features/weblogic.server.modules_10.3.2.0.jar:file:/C:/bea1032/wlserver_10.3/server/lib/webservices.jar:file:/C:/bea1032/modules/org.apache.ant_1.7.0/lib/ant-all.jar:file:/C:/bea1032/modules/net.sf.antcontrib_1.0.0.0_1-0b2/lib/ant-contrib.jar:file:/C:/bea1032/wlserver_10.3/common/eval/pointbase/lib/pbclient57.jar:file:/C:/bea1032/wlserver_10.3/server/lib/xqrl.jar:}
 |
java.net.URLClassLoader@164dbd5 {file:/C:/bea1032/user_projects/domains/myAppwls10loc/lib/jt400.jar:}
 |
weblogic.utils.classloaders.GenericClassLoader@1db6942 finder: weblogic.utils.classloaders.CodeGenClassFinder@1fe2c10 annotation:  
 |
weblogic.utils.classloaders.FilteringClassLoader@11f9cee finder: weblogic.utils.classloaders.CodeGenClassFinder@77e77a annotation:  
 |
weblogic.utils.classloaders.GenericClassLoader@f8d6a6 finder: weblogic.utils.classloaders.CodeGenClassFinder@8f53c8 annotation: myApp@ 

Context loader tree
 |
sun.misc.Launcher$ExtClassLoader@19134f4 {file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/dnsns.jar:file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/localedata.jar:file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/sunjce_provider.jar:file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/sunmscapi.jar:file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/sunpkcs11.jar:}
 |
sun.misc.Launcher$AppClassLoader@47858e {file:/C:/workshop/myclient.jar:file:/C:/bea1032/user_projects/domains/myAppwls10loc/%20C:/workspace/maven%20/oracle/jars/aqapi-9.0.2.jar%20:file:/C:/bea1032/patch_wls1032/profiles/default/sys_manifest_classpath/weblogic_patch.jar:file:/C:/bea1032/patch_oepe1032/profiles/default/sys_manifest_classpath/weblogic_patch.jar:file:/C:/bea1032/jdk160_14_R27.6.5-32/lib/tools.jar:file:/C:/bea1032/utils/config/10.3/config-launch.jar:file:/C:/bea1032/wlserver_10.3/server/lib/weblogic_sp.jar:file:/C:/bea1032/wlserver_10.3/server/lib/weblogic.jar:file:/C:/bea1032/modules/features/weblogic.server.modules_10.3.2.0.jar:file:/C:/bea1032/wlserver_10.3/server/lib/webservices.jar:file:/C:/bea1032/modules/org.apache.ant_1.7.0/lib/ant-all.jar:file:/C:/bea1032/modules/net.sf.antcontrib_1.0.0.0_1-0b2/lib/ant-contrib.jar:file:/C:/bea1032/wlserver_10.3/common/eval/pointbase/lib/pbclient57.jar:file:/C:/bea1032/wlserver_10.3/server/lib/xqrl.jar:}
 |
java.net.URLClassLoader@164dbd5 {file:/C:/bea1032/user_projects/domains/myAppwls10loc/lib/jt400.jar:}
 |
weblogic.utils.classloaders.GenericClassLoader@1db6942 finder: weblogic.utils.classloaders.CodeGenClassFinder@1fe2c10 annotation:  
 |
weblogic.utils.classloaders.FilteringClassLoader@11f9cee finder: weblogic.utils.classloaders.CodeGenClassFinder@77e77a annotation:  
 |
weblogic.utils.classloaders.GenericClassLoader@f8d6a6 finder: weblogic.utils.classloaders.CodeGenClassFinder@8f53c8 annotation: myApp@ 
 |
weblogic.utils.classloaders.ChangeAwareClassLoader@17b51e8 finder: weblogic.utils.classloaders.CodeGenClassFinder@1ad65f7 annotation: myApp@myApp 
____________________END_______________________
==============================
Class name:com.myapp.business.sample.SampleBo
ClassLoader=weblogic.utils.classloaders.GenericClassLoader@f8d6a6 finder: weblogic.utils.classloaders.CodeGenClassFinder@8f53c8 annotation: myApp@
  ClassLoader=weblogic.utils.classloaders.FilteringClassLoader@11f9cee finder: weblogic.utils.classloaders.CodeGenClassFinder@77e77a annotation: 
    ClassLoader=weblogic.utils.classloaders.GenericClassLoader@1db6942 finder: weblogic.utils.classloaders.CodeGenClassFinder@1fe2c10 annotation: 
      ClassLoader=java.net.URLClassLoader@164dbd5
        ClassLoader=sun.misc.Launcher$AppClassLoader@47858e
          ClassLoader=sun.misc.Launcher$ExtClassLoader@19134f4
            ClassLoader=null
Thread.currentThread().getClass().getClassLoader():
ClassLoader=sun.misc.Launcher$AppClassLoader@47858e
  ClassLoader=sun.misc.Launcher$ExtClassLoader@19134f4
    ClassLoader=null
==============================
___________________START_______________________

Class loader tree
 |
sun.misc.Launcher$ExtClassLoader@19134f4 {file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/dnsns.jar:file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/localedata.jar:file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/sunjce_provider.jar:file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/sunmscapi.jar:file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/sunpkcs11.jar:}
 |
sun.misc.Launcher$AppClassLoader@47858e {file:/C:/workshop/myclient.jar:file:/C:/bea1032/user_projects/domains/myAppwls10loc/%20C:/workspace/maven%20/oracle/jars/aqapi-9.0.2.jar%20:file:/C:/bea1032/patch_wls1032/profiles/default/sys_manifest_classpath/weblogic_patch.jar:file:/C:/bea1032/patch_oepe1032/profiles/default/sys_manifest_classpath/weblogic_patch.jar:file:/C:/bea1032/jdk160_14_R27.6.5-32/lib/tools.jar:file:/C:/bea1032/utils/config/10.3/config-launch.jar:file:/C:/bea1032/wlserver_10.3/server/lib/weblogic_sp.jar:file:/C:/bea1032/wlserver_10.3/server/lib/weblogic.jar:file:/C:/bea1032/modules/features/weblogic.server.modules_10.3.2.0.jar:file:/C:/bea1032/wlserver_10.3/server/lib/webservices.jar:file:/C:/bea1032/modules/org.apache.ant_1.7.0/lib/ant-all.jar:file:/C:/bea1032/modules/net.sf.antcontrib_1.0.0.0_1-0b2/lib/ant-contrib.jar:file:/C:/bea1032/wlserver_10.3/common/eval/pointbase/lib/pbclient57.jar:file:/C:/bea1032/wlserver_10.3/server/lib/xqrl.jar:}
 |
java.net.URLClassLoader@164dbd5 {file:/C:/bea1032/user_projects/domains/myAppwls10loc/lib/jt400.jar:}
 |
weblogic.utils.classloaders.GenericClassLoader@1db6942 finder: weblogic.utils.classloaders.CodeGenClassFinder@1fe2c10 annotation:  
 |
weblogic.utils.classloaders.FilteringClassLoader@11f9cee finder: weblogic.utils.classloaders.CodeGenClassFinder@77e77a annotation:  
 |
weblogic.utils.classloaders.GenericClassLoader@f8d6a6 finder: weblogic.utils.classloaders.CodeGenClassFinder@8f53c8 annotation: myApp@ 

Context loader tree
 |
sun.misc.Launcher$ExtClassLoader@19134f4 {file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/dnsns.jar:file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/localedata.jar:file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/sunjce_provider.jar:file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/sunmscapi.jar:file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/sunpkcs11.jar:}
 |
sun.misc.Launcher$AppClassLoader@47858e {file:/C:/workshop/myclient.jar:file:/C:/bea1032/user_projects/domains/myAppwls10loc/%20C:/workspace/maven%20/oracle/jars/aqapi-9.0.2.jar%20:file:/C:/bea1032/patch_wls1032/profiles/default/sys_manifest_classpath/weblogic_patch.jar:file:/C:/bea1032/patch_oepe1032/profiles/default/sys_manifest_classpath/weblogic_patch.jar:file:/C:/bea1032/jdk160_14_R27.6.5-32/lib/tools.jar:file:/C:/bea1032/utils/config/10.3/config-launch.jar:file:/C:/bea1032/wlserver_10.3/server/lib/weblogic_sp.jar:file:/C:/bea1032/wlserver_10.3/server/lib/weblogic.jar:file:/C:/bea1032/modules/features/weblogic.server.modules_10.3.2.0.jar:file:/C:/bea1032/wlserver_10.3/server/lib/webservices.jar:file:/C:/bea1032/modules/org.apache.ant_1.7.0/lib/ant-all.jar:file:/C:/bea1032/modules/net.sf.antcontrib_1.0.0.0_1-0b2/lib/ant-contrib.jar:file:/C:/bea1032/wlserver_10.3/common/eval/pointbase/lib/pbclient57.jar:file:/C:/bea1032/wlserver_10.3/server/lib/xqrl.jar:}
 |
java.net.URLClassLoader@164dbd5 {file:/C:/bea1032/user_projects/domains/myAppwls10loc/lib/jt400.jar:}
 |
weblogic.utils.classloaders.GenericClassLoader@1db6942 finder: weblogic.utils.classloaders.CodeGenClassFinder@1fe2c10 annotation:  
 |
weblogic.utils.classloaders.FilteringClassLoader@11f9cee finder: weblogic.utils.classloaders.CodeGenClassFinder@77e77a annotation:  
 |
weblogic.utils.classloaders.GenericClassLoader@f8d6a6 finder: weblogic.utils.classloaders.CodeGenClassFinder@8f53c8 annotation: myApp@ 
 |
weblogic.utils.classloaders.ChangeAwareClassLoader@17b51e8 finder: weblogic.utils.classloaders.CodeGenClassFinder@1ad65f7 annotation: myApp@myApp 
____________________END_______________________
<Feb 14, 2012 10:02:54 AM EST> <Notice> <LoggingService> <BEA-320400> <The log file C:\bea1032\user_projects\domains\myAppwls10loc\servers\myAppAdminServer\logs\myAppwls10loc.log will be rotated. Reopen the log file if tailing has stopped. This can happen on some platforms like Windows.> 
<Feb 14, 2012 10:02:54 AM EST> <Notice> <LoggingService> <BEA-320401> <The log file has been rotated to C:\bea1032\user_projects\domains\myAppwls10loc\servers\myAppAdminServer\logs\myAppwls10loc.log00095. Log messages will continue to be logged in C:\bea1032\user_projects\domains\myAppwls10loc\servers\myAppAdminServer\logs\myAppwls10loc.log.> 
<Feb 14, 2012 10:02:54 AM EST> <Notice> <Log Management> <BEA-170027> <The Server has established connection with the Domain level Diagnostic Service successfully.> 
<Feb 14, 2012 10:02:54 AM EST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to ADMIN> 
<Feb 14, 2012 10:02:54 AM EST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to RESUMING> 
<Feb 14, 2012 10:02:54 AM EST> <Notice> <Server> <BEA-002613> <Channel "Default" is now listening on 10.77.121.138:7001 for protocols iiop, t3, ldap, snmp, http.> 
<Feb 14, 2012 10:02:54 AM EST> <Notice> <Server> <BEA-002613> <Channel "Default[1]" is now listening on 127.0.0.1:7001 for protocols iiop, t3, ldap, snmp, http.> 
<Feb 14, 2012 10:02:54 AM EST> <Notice> <WebLogicServer> <BEA-000331> <Started WebLogic Admin Server "myAppAdminServer" for domain "myAppwls10loc" running in Development Mode> 
Tue Feb 14 10:02:56 EST 2012; INFO: create queueconnection [timeout=100] as [com.myapp.messaging.aq.qfc.FakeQueueConnectionFactory@1620d83]
==============================
Class name:com.myapp.messaging.aq.qfc.FakeQueueConnection
ClassLoader=sun.misc.Launcher$AppClassLoader@47858e
  ClassLoader=sun.misc.Launcher$ExtClassLoader@19134f4
    ClassLoader=null
Thread.currentThread().getClass().getClassLoader():
ClassLoader=sun.misc.Launcher$AppClassLoader@47858e
  ClassLoader=sun.misc.Launcher$ExtClassLoader@19134f4
    ClassLoader=null
==============================
___________________START_______________________

Class loader tree
 |
sun.misc.Launcher$ExtClassLoader@19134f4 {file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/dnsns.jar:file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/localedata.jar:file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/sunjce_provider.jar:file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/sunmscapi.jar:file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/sunpkcs11.jar:}
 |
sun.misc.Launcher$AppClassLoader@47858e {file:/C:/workshop/myclient.jar:file:/C:/bea1032/user_projects/domains/myAppwls10loc/%20C:/workspace/maven%20/oracle/jars/aqapi-9.0.2.jar%20:file:/C:/bea1032/patch_wls1032/profiles/default/sys_manifest_classpath/weblogic_patch.jar:file:/C:/bea1032/patch_oepe1032/profiles/default/sys_manifest_classpath/weblogic_patch.jar:file:/C:/bea1032/jdk160_14_R27.6.5-32/lib/tools.jar:file:/C:/bea1032/utils/config/10.3/config-launch.jar:file:/C:/bea1032/wlserver_10.3/server/lib/weblogic_sp.jar:file:/C:/bea1032/wlserver_10.3/server/lib/weblogic.jar:file:/C:/bea1032/modules/features/weblogic.server.modules_10.3.2.0.jar:file:/C:/bea1032/wlserver_10.3/server/lib/webservices.jar:file:/C:/bea1032/modules/org.apache.ant_1.7.0/lib/ant-all.jar:file:/C:/bea1032/modules/net.sf.antcontrib_1.0.0.0_1-0b2/lib/ant-contrib.jar:file:/C:/bea1032/wlserver_10.3/common/eval/pointbase/lib/pbclient57.jar:file:/C:/bea1032/wlserver_10.3/server/lib/xqrl.jar:}

Context loader tree
 |
sun.misc.Launcher$ExtClassLoader@19134f4 {file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/dnsns.jar:file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/localedata.jar:file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/sunjce_provider.jar:file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/sunmscapi.jar:file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/sunpkcs11.jar:}
 |
sun.misc.Launcher$AppClassLoader@47858e {file:/C:/workshop/myclient.jar:file:/C:/bea1032/user_projects/domains/myAppwls10loc/%20C:/workspace/maven%20/oracle/jars/aqapi-9.0.2.jar%20:file:/C:/bea1032/patch_wls1032/profiles/default/sys_manifest_classpath/weblogic_patch.jar:file:/C:/bea1032/patch_oepe1032/profiles/default/sys_manifest_classpath/weblogic_patch.jar:file:/C:/bea1032/jdk160_14_R27.6.5-32/lib/tools.jar:file:/C:/bea1032/utils/config/10.3/config-launch.jar:file:/C:/bea1032/wlserver_10.3/server/lib/weblogic_sp.jar:file:/C:/bea1032/wlserver_10.3/server/lib/weblogic.jar:file:/C:/bea1032/modules/features/weblogic.server.modules_10.3.2.0.jar:file:/C:/bea1032/wlserver_10.3/server/lib/webservices.jar:file:/C:/bea1032/modules/org.apache.ant_1.7.0/lib/ant-all.jar:file:/C:/bea1032/modules/net.sf.antcontrib_1.0.0.0_1-0b2/lib/ant-contrib.jar:file:/C:/bea1032/wlserver_10.3/common/eval/pointbase/lib/pbclient57.jar:file:/C:/bea1032/wlserver_10.3/server/lib/xqrl.jar:}
 |
java.net.URLClassLoader@164dbd5 {file:/C:/bea1032/user_projects/domains/myAppwls10loc/lib/jt400.jar:}
 |
weblogic.utils.classloaders.GenericClassLoader@1db6942 finder: weblogic.utils.classloaders.CodeGenClassFinder@1fe2c10 annotation:  
 |
weblogic.utils.classloaders.FilteringClassLoader@11f9cee finder: weblogic.utils.classloaders.CodeGenClassFinder@77e77a annotation:  
 |
weblogic.utils.classloaders.GenericClassLoader@f8d6a6 finder: weblogic.utils.classloaders.CodeGenClassFinder@8f53c8 annotation: myApp@ 
 |
weblogic.utils.classloaders.GenericClassLoader@fcfd10 finder: weblogic.utils.classloaders.CodeGenClassFinder@1d1bb4d annotation: myApp@ 
____________________END_______________________
Tue Feb 14 10:02:56 EST 2012; INFO:  construct queueSession
Tue Feb 14 10:02:56 EST 2012; INFO:  scheduling delayed start[5000ms], timeout[100ms] session[com.myapp.messaging.aq.qfc.FakeQueueSession@17b3b61queue=nullmessageListener=nullstopped=false]
Tue Feb 14 10:02:56 EST 2012; INFO:  session#1, queueSession created[com.myapp.messaging.aq.qfc.FakeQueueConnection@97cd75session=com.myapp.messaging.aq.qfc.FakeQueueSession@17b3b61queue=nullmessageListener=nullstopped=falseclosed=falsesession_list=1]
Tue Feb 14 10:02:56 EST 2012; INFO:  setMessageListener(weblogic.ejb.container.internal.MDListener@1598d5f)
Tue Feb 14 10:02:56 EST 2012INFO:  start connection[null] closed[false]
<Feb 14, 2012 10:02:57 AM EST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to RUNNING> 
<Feb 14, 2012 10:02:57 AM EST> <Notice> <WebLogicServer> <BEA-000360> <Server started in RUNNING mode> 
<Feb 14, 2012 10:03:01 AM EST> <Warning> <JMX> <BEA-149517> <An attempt was made to unregister an mbean that was already unregistered: weblogic.servlet.internal.ServletRuntimeMBeanImpl@bb303> 
------------------------
classLoader=weblogic.servlet.jsp.JspClassLoader@a3af1c finder: weblogic.utils.classloaders.CodeGenClassFinder@1ed70df annotation: 
  classLoader=weblogic.servlet.jsp.TagFileClassLoader@18d70a6 finder: weblogic.utils.classloaders.CodeGenClassFinder@deaa44 annotation: 
    classLoader=weblogic.utils.classloaders.ChangeAwareClassLoader@17b51e8 finder: weblogic.utils.classloaders.CodeGenClassFinder@1ad65f7 annotation: myApp@myApp
      classLoader=weblogic.utils.classloaders.GenericClassLoader@f8d6a6 finder: weblogic.utils.classloaders.CodeGenClassFinder@8f53c8 annotation: myApp@
        classLoader=weblogic.utils.classloaders.FilteringClassLoader@11f9cee finder: weblogic.utils.classloaders.CodeGenClassFinder@77e77a annotation: 
          classLoader=weblogic.utils.classloaders.GenericClassLoader@1db6942 finder: weblogic.utils.classloaders.CodeGenClassFinder@1fe2c10 annotation: 
            classLoader=java.net.URLClassLoader@164dbd5
              classLoader=sun.misc.Launcher$AppClassLoader@47858e
                classLoader=sun.misc.Launcher$ExtClassLoader@19134f4
                  classLoader=null
classLoader=null now
------------------------
___________________START_______________________

Class loader tree
 |
sun.misc.Launcher$ExtClassLoader@19134f4 {file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/dnsns.jar:file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/localedata.jar:file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/sunjce_provider.jar:file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/sunmscapi.jar:file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/sunpkcs11.jar:}
 |
sun.misc.Launcher$AppClassLoader@47858e {file:/C:/workshop/myclient.jar:file:/C:/bea1032/user_projects/domains/myAppwls10loc/%20C:/workspace/maven%20/oracle/jars/aqapi-9.0.2.jar%20:file:/C:/bea1032/patch_wls1032/profiles/default/sys_manifest_classpath/weblogic_patch.jar:file:/C:/bea1032/patch_oepe1032/profiles/default/sys_manifest_classpath/weblogic_patch.jar:file:/C:/bea1032/jdk160_14_R27.6.5-32/lib/tools.jar:file:/C:/bea1032/utils/config/10.3/config-launch.jar:file:/C:/bea1032/wlserver_10.3/server/lib/weblogic_sp.jar:file:/C:/bea1032/wlserver_10.3/server/lib/weblogic.jar:file:/C:/bea1032/modules/features/weblogic.server.modules_10.3.2.0.jar:file:/C:/bea1032/wlserver_10.3/server/lib/webservices.jar:file:/C:/bea1032/modules/org.apache.ant_1.7.0/lib/ant-all.jar:file:/C:/bea1032/modules/net.sf.antcontrib_1.0.0.0_1-0b2/lib/ant-contrib.jar:file:/C:/bea1032/wlserver_10.3/common/eval/pointbase/lib/pbclient57.jar:file:/C:/bea1032/wlserver_10.3/server/lib/xqrl.jar:}
 |
java.net.URLClassLoader@164dbd5 {file:/C:/bea1032/user_projects/domains/myAppwls10loc/lib/jt400.jar:}
 |
weblogic.utils.classloaders.GenericClassLoader@1db6942 finder: weblogic.utils.classloaders.CodeGenClassFinder@1fe2c10 annotation:  
 |
weblogic.utils.classloaders.FilteringClassLoader@11f9cee finder: weblogic.utils.classloaders.CodeGenClassFinder@77e77a annotation:  
 |
weblogic.utils.classloaders.GenericClassLoader@f8d6a6 finder: weblogic.utils.classloaders.CodeGenClassFinder@8f53c8 annotation: myApp@ 
 |
weblogic.utils.classloaders.ChangeAwareClassLoader@17b51e8 finder: weblogic.utils.classloaders.CodeGenClassFinder@1ad65f7 annotation: myApp@myApp 
 |
weblogic.servlet.jsp.TagFileClassLoader@18d70a6 finder: weblogic.utils.classloaders.CodeGenClassFinder@deaa44 annotation:  
 |
weblogic.servlet.jsp.JspClassLoader@a3af1c finder: weblogic.utils.classloaders.CodeGenClassFinder@1ed70df annotation:  

Context loader tree
 |
sun.misc.Launcher$ExtClassLoader@19134f4 {file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/dnsns.jar:file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/localedata.jar:file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/sunjce_provider.jar:file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/sunmscapi.jar:file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/sunpkcs11.jar:}
 |
sun.misc.Launcher$AppClassLoader@47858e {file:/C:/workshop/myclient.jar:file:/C:/bea1032/user_projects/domains/myAppwls10loc/%20C:/workspace/maven%20/oracle/jars/aqapi-9.0.2.jar%20:file:/C:/bea1032/patch_wls1032/profiles/default/sys_manifest_classpath/weblogic_patch.jar:file:/C:/bea1032/patch_oepe1032/profiles/default/sys_manifest_classpath/weblogic_patch.jar:file:/C:/bea1032/jdk160_14_R27.6.5-32/lib/tools.jar:file:/C:/bea1032/utils/config/10.3/config-launch.jar:file:/C:/bea1032/wlserver_10.3/server/lib/weblogic_sp.jar:file:/C:/bea1032/wlserver_10.3/server/lib/weblogic.jar:file:/C:/bea1032/modules/features/weblogic.server.modules_10.3.2.0.jar:file:/C:/bea1032/wlserver_10.3/server/lib/webservices.jar:file:/C:/bea1032/modules/org.apache.ant_1.7.0/lib/ant-all.jar:file:/C:/bea1032/modules/net.sf.antcontrib_1.0.0.0_1-0b2/lib/ant-contrib.jar:file:/C:/bea1032/wlserver_10.3/common/eval/pointbase/lib/pbclient57.jar:file:/C:/bea1032/wlserver_10.3/server/lib/xqrl.jar:}
 |
java.net.URLClassLoader@164dbd5 {file:/C:/bea1032/user_projects/domains/myAppwls10loc/lib/jt400.jar:}
 |
weblogic.utils.classloaders.GenericClassLoader@1db6942 finder: weblogic.utils.classloaders.CodeGenClassFinder@1fe2c10 annotation:  
 |
weblogic.utils.classloaders.FilteringClassLoader@11f9cee finder: weblogic.utils.classloaders.CodeGenClassFinder@77e77a annotation:  
 |
weblogic.utils.classloaders.GenericClassLoader@f8d6a6 finder: weblogic.utils.classloaders.CodeGenClassFinder@8f53c8 annotation: myApp@ 
 |
weblogic.utils.classloaders.ChangeAwareClassLoader@17b51e8 finder: weblogic.utils.classloaders.CodeGenClassFinder@1ad65f7 annotation: myApp@myApp 
____________________END_______________________



Class loaders for the class in APP-INF/lib and myejb.jar

In another test, I found the class loader that loads the class in the EJB module is the same as the one that loads the classes in the jars in the APP-INF/lib directory. In this test, there is no jar in the lib directory of the domain:C:/bea1032/user_projects/domains/myAppwls10loc/lib
The following is the log for the class in APP-INF/lib:
==============================
Class name:com.myapp.business.sample.SampleBo
ClassLoader=weblogic.utils.classloaders.GenericClassLoader@48268a finder: weblogic.utils.classloaders.CodeGenClassFinder@10e0edb annotation: myApp@
  ClassLoader=weblogic.utils.classloaders.FilteringClassLoader@38bbd7 finder: weblogic.utils.classloaders.CodeGenClassFinder@b44131 annotation: 
    ClassLoader=weblogic.utils.classloaders.GenericClassLoader@5b78cf finder: weblogic.utils.classloaders.CodeGenClassFinder@241f4e annotation: 
      ClassLoader=sun.misc.Launcher$AppClassLoader@47858e
        ClassLoader=sun.misc.Launcher$ExtClassLoader@19134f4
          ClassLoader=null
Thread.currentThread().getClass().getClassLoader():
ClassLoader=sun.misc.Launcher$AppClassLoader@47858e
  ClassLoader=sun.misc.Launcher$ExtClassLoader@19134f4
    ClassLoader=null
==============================
___________________START_______________________

Class loader tree
 |
sun.misc.Launcher$ExtClassLoader@19134f4 {file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/dnsns.jar:file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/localedata.jar:file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/sunjce_provider.jar:file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/sunmscapi.jar:file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/sunpkcs11.jar:}
 |
sun.misc.Launcher$AppClassLoader@47858e {file:/C:/workshop/myclient.jar:file:/C:/bea1032/user_projects/domains/myAppwls10loc/%20C:/workspace/maven%20/oracle/jars/aqapi-9.0.2.jar%20:file:/C:/bea1032/patch_wls1032/profiles/default/sys_manifest_classpath/weblogic_patch.jar:file:/C:/bea1032/patch_oepe1032/profiles/default/sys_manifest_classpath/weblogic_patch.jar:file:/C:/bea1032/jdk160_14_R27.6.5-32/lib/tools.jar:file:/C:/bea1032/utils/config/10.3/config-launch.jar:file:/C:/bea1032/wlserver_10.3/server/lib/weblogic_sp.jar:file:/C:/bea1032/wlserver_10.3/server/lib/weblogic.jar:file:/C:/bea1032/modules/features/weblogic.server.modules_10.3.2.0.jar:file:/C:/bea1032/wlserver_10.3/server/lib/webservices.jar:file:/C:/bea1032/modules/org.apache.ant_1.7.0/lib/ant-all.jar:file:/C:/bea1032/modules/net.sf.antcontrib_1.0.0.0_1-0b2/lib/ant-contrib.jar:file:/C:/bea1032/wlserver_10.3/common/eval/pointbase/lib/pbclient57.jar:file:/C:/bea1032/wlserver_10.3/server/lib/xqrl.jar:}
 |
weblogic.utils.classloaders.GenericClassLoader@5b78cf finder: weblogic.utils.classloaders.CodeGenClassFinder@241f4e annotation:  
 |
weblogic.utils.classloaders.FilteringClassLoader@38bbd7 finder: weblogic.utils.classloaders.CodeGenClassFinder@b44131 annotation:  
 |
weblogic.utils.classloaders.GenericClassLoader@48268a finder: weblogic.utils.classloaders.CodeGenClassFinder@10e0edb annotation: myApp@ 

Context loader tree
 |
sun.misc.Launcher$ExtClassLoader@19134f4 {file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/dnsns.jar:file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/localedata.jar:file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/sunjce_provider.jar:file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/sunmscapi.jar:file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/sunpkcs11.jar:}
 |
sun.misc.Launcher$AppClassLoader@47858e {file:/C:/workshop/myclient.jar:file:/C:/bea1032/user_projects/domains/myAppwls10loc/%20C:/workspace/maven%20/oracle/jars/aqapi-9.0.2.jar%20:file:/C:/bea1032/patch_wls1032/profiles/default/sys_manifest_classpath/weblogic_patch.jar:file:/C:/bea1032/patch_oepe1032/profiles/default/sys_manifest_classpath/weblogic_patch.jar:file:/C:/bea1032/jdk160_14_R27.6.5-32/lib/tools.jar:file:/C:/bea1032/utils/config/10.3/config-launch.jar:file:/C:/bea1032/wlserver_10.3/server/lib/weblogic_sp.jar:file:/C:/bea1032/wlserver_10.3/server/lib/weblogic.jar:file:/C:/bea1032/modules/features/weblogic.server.modules_10.3.2.0.jar:file:/C:/bea1032/wlserver_10.3/server/lib/webservices.jar:file:/C:/bea1032/modules/org.apache.ant_1.7.0/lib/ant-all.jar:file:/C:/bea1032/modules/net.sf.antcontrib_1.0.0.0_1-0b2/lib/ant-contrib.jar:file:/C:/bea1032/wlserver_10.3/common/eval/pointbase/lib/pbclient57.jar:file:/C:/bea1032/wlserver_10.3/server/lib/xqrl.jar:}
 |
weblogic.utils.classloaders.GenericClassLoader@5b78cf finder: weblogic.utils.classloaders.CodeGenClassFinder@241f4e annotation:  
 |
weblogic.utils.classloaders.FilteringClassLoader@38bbd7 finder: weblogic.utils.classloaders.CodeGenClassFinder@b44131 annotation:  
 |
weblogic.utils.classloaders.GenericClassLoader@48268a finder: weblogic.utils.classloaders.CodeGenClassFinder@10e0edb annotation: myApp@ 
 |
weblogic.utils.classloaders.ChangeAwareClassLoader@faaa93 finder: weblogic.utils.classloaders.CodeGenClassFinder@5532da annotation: myApp@myApp 
____________________END_______________________

And the following is the log for the class in myejb.jar:
==============================
Class name:com.myapp.messaging.xyz.XyzMessageHandlerImpl
ClassLoader=weblogic.utils.classloaders.GenericClassLoader@48268a finder: weblogic.utils.classloaders.CodeGenClassFinder@10e0edb annotation: myApp@
  ClassLoader=weblogic.utils.classloaders.FilteringClassLoader@38bbd7 finder: weblogic.utils.classloaders.CodeGenClassFinder@b44131 annotation: 
    ClassLoader=weblogic.utils.classloaders.GenericClassLoader@5b78cf finder: weblogic.utils.classloaders.CodeGenClassFinder@241f4e annotation: 
      ClassLoader=sun.misc.Launcher$AppClassLoader@47858e
        ClassLoader=sun.misc.Launcher$ExtClassLoader@19134f4
          ClassLoader=null
Thread.currentThread().getClass().getClassLoader():
==============================
___________________START_______________________

Class loader tree
 |
sun.misc.Launcher$ExtClassLoader@19134f4 {file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/dnsns.jar:file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/localedata.jar:file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/sunjce_provider.jar:file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/sunmscapi.jar:file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/sunpkcs11.jar:}
 |
sun.misc.Launcher$AppClassLoader@47858e {file:/C:/workshop/myclient.jar:file:/C:/bea1032/user_projects/domains/myAppwls10loc/%20C:/workspace/maven%20/oracle/jars/aqapi-9.0.2.jar%20:file:/C:/bea1032/patch_wls1032/profiles/default/sys_manifest_classpath/weblogic_patch.jar:file:/C:/bea1032/patch_oepe1032/profiles/default/sys_manifest_classpath/weblogic_patch.jar:file:/C:/bea1032/jdk160_14_R27.6.5-32/lib/tools.jar:file:/C:/bea1032/utils/config/10.3/config-launch.jar:file:/C:/bea1032/wlserver_10.3/server/lib/weblogic_sp.jar:file:/C:/bea1032/wlserver_10.3/server/lib/weblogic.jar:file:/C:/bea1032/modules/features/weblogic.server.modules_10.3.2.0.jar:file:/C:/bea1032/wlserver_10.3/server/lib/webservices.jar:file:/C:/bea1032/modules/org.apache.ant_1.7.0/lib/ant-all.jar:file:/C:/bea1032/modules/net.sf.antcontrib_1.0.0.0_1-0b2/lib/ant-contrib.jar:file:/C:/bea1032/wlserver_10.3/common/eval/pointbase/lib/pbclient57.jar:file:/C:/bea1032/wlserver_10.3/server/lib/xqrl.jar:}
 |
weblogic.utils.classloaders.GenericClassLoader@5b78cf finder: weblogic.utils.classloaders.CodeGenClassFinder@241f4e annotation:  
 |
weblogic.utils.classloaders.FilteringClassLoader@38bbd7 finder: weblogic.utils.classloaders.CodeGenClassFinder@b44131 annotation:  
 |
weblogic.utils.classloaders.GenericClassLoader@48268a finder: weblogic.utils.classloaders.CodeGenClassFinder@10e0edb annotation: myApp@ 

Context loader tree
 |
sun.misc.Launcher$ExtClassLoader@19134f4 {file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/dnsns.jar:file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/localedata.jar:file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/sunjce_provider.jar:file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/sunmscapi.jar:file:/C:/bea1032/jdk160_14_R27.6.5-32/jre/lib/ext/sunpkcs11.jar:}
 |
sun.misc.Launcher$AppClassLoader@47858e {file:/C:/workshop/myclient.jar:file:/C:/bea1032/user_projects/domains/myAppwls10loc/%20C:/workspace/maven%20/oracle/jars/aqapi-9.0.2.jar%20:file:/C:/bea1032/patch_wls1032/profiles/default/sys_manifest_classpath/weblogic_patch.jar:file:/C:/bea1032/patch_oepe1032/profiles/default/sys_manifest_classpath/weblogic_patch.jar:file:/C:/bea1032/jdk160_14_R27.6.5-32/lib/tools.jar:file:/C:/bea1032/utils/config/10.3/config-launch.jar:file:/C:/bea1032/wlserver_10.3/server/lib/weblogic_sp.jar:file:/C:/bea1032/wlserver_10.3/server/lib/weblogic.jar:file:/C:/bea1032/modules/features/weblogic.server.modules_10.3.2.0.jar:file:/C:/bea1032/wlserver_10.3/server/lib/webservices.jar:file:/C:/bea1032/modules/org.apache.ant_1.7.0/lib/ant-all.jar:file:/C:/bea1032/modules/net.sf.antcontrib_1.0.0.0_1-0b2/lib/ant-contrib.jar:file:/C:/bea1032/wlserver_10.3/common/eval/pointbase/lib/pbclient57.jar:file:/C:/bea1032/wlserver_10.3/server/lib/xqrl.jar:}
 |
weblogic.utils.classloaders.GenericClassLoader@5b78cf finder: weblogic.utils.classloaders.CodeGenClassFinder@241f4e annotation:  
 |
weblogic.utils.classloaders.FilteringClassLoader@38bbd7 finder: weblogic.utils.classloaders.CodeGenClassFinder@b44131 annotation:  
 |
weblogic.utils.classloaders.GenericClassLoader@48268a finder: weblogic.utils.classloaders.CodeGenClassFinder@10e0edb annotation: myApp@ 
____________________END_______________________