.:An Endless Journey:.
open source and me
  • Immutable Page
  • Info
  • Attachments

JRun 4 Notes

JRun 4 is J2EE 1.3 compliant, that say, it only provide JSP 1.2 container. Hence, you only JSTL 1.0, and completely lack tagfile support.

IMO, tagfile in JSP2 is really good thing to abstract view helper logic, and more elegant than old Custom Tag. As JRun4 is an "appointed" AS when I am working on a few project, my workaround is to use Tiles, it let you encapsulate view helper logic like tagfile, while only have JSP 1.2 dependency. (see TechInfo/StandaloneTilesNotes)

Must-read resource

Datasource configuration

In JavaEE, datasource should prefix with 'java:comp/env'. Correct procedure to lookup JDBC DataSource using JNDI is:

  1. First lookup 'java:comp/env',
  2. Then lookup 'jdbc/MyDS'.

In web.xml, you should also define '<resource-ref>' with '<res-ref-name>' point to a JNDI ref.

For a good introduction, see this.

In JRun4, you setup datasource in SERVER-INF/jrun-resource.xml

And you have to map the datasource JNDI name to the web components. You do it in "jrun-web.xml" (JRun specific deployment descriptors)

Define this inside:

  <resource-ref>
    <res-ref-name>jdbc/ngn</res-ref-name>
    <jndi-name>ngn</jndi-name>
  </resource-ref>

From Macromedia livedoc, they point this config to web.xml which are completely wrong. Be care!!

Note:

  • '<res-ref-name>' match web.xml, while

  • '<jndi-name>' should match '<jndi-name>' in SERVER-INF/jrun-resource.xml

How to sperate JRun4 AS specific config from the deployable archieve (war)

According to official doc, if you put a 'myapp.war', then, the filename for that deployment descriptor should be 'myapp.war.jrun.xml'

But, realy filename should be myapp.web.jrun.xml (NOT 'war')

Very wierd issue JRun4 (updater 6) with JDK 1.5.06

JSP will translated into Java and then compiled into class files.

When the JSP use Collections in pre-Java 1.5 way (No generics), the page will not get translated into class file properly, the Java compiler will raise error.

The following is the stacktrace:

  17610 ERROR org.apache.tiles.taglib.InsertTag  - Exception in 
  '/WEB-INF/include/am/Tiles/SimpleEntityMenu.jsp': 
  Translator.CompilationFailedExceptionCompiler errors:Note: 
  C:\JRun4\servers\ngn\am\WEB-INF\jsp\jrun__WEB2dINF__include__am__Tiles
  __SimpleEntityMenu2ejsp2e.java uses unchecked or unsafe operations.
  Note: Recompile with -Xlint:unchecked for details.
  
  javax.servlet.ServletException: Translator.CompilationFailedExceptionCompiler
  errors:Note: C:\JRun4\servers\ngn\am\WEB-INF\jsp\jrun__WEB2dINF__include__am
  __Tiles__SimpleEntityMenu2ejsp2e.java uses unchecked or unsafe operations.
  Note: Recompile with -Xlint:unchecked for details.
  
      at jrun.jsp.Translator.compilePage(Translator.java:187)
      at jrun.jsp.Translator.translate(Translator.java:254)
      at jrun.jsp.Translator.translate(Translator.java:101)
      at jrun.jsp.JSPEngine.translateJSP(JSPEngine.java:693)
      at jrun.jsp.JSPServlet.translate(JSPServlet.java:125)
      at jrun.jsp.JSPServlet.service(JSPServlet.java:113)
      at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:91)
      at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
      at jrun.servlet.JRunRequestDispatcher.invokeNext(JRunRequestDispatcher.java:534)
      at jrun.servlet.JRunRequestDispatcher.include(JRunRequestDispatcher.java:464)
      at jrun.jsp.runtime.JRunPageContext.include(JRunPageContext.java:361)
      at org.apache.tiles.TilesUtilImpl.doInclude(TilesUtilImpl.java:135)
      at org.apache.tiles.TilesUtil.doInclude(TilesUtil.java:136)
      at org.apache.tiles.taglib.InsertTag.doInclude(InsertTag.java:766)
      at org.apache.tiles.taglib.InsertTag$InsertHandler.doEndTag(InsertTag.java:896)
      at org.apache.tiles.taglib.InsertTag.doEndTag(InsertTag.java:460)
      at jrun__WEB2dINF__include__am__Tiles__DefaultLayout2ejsp2b.
      _jspservice(jrun__web2dinf__include__am__tiles__defaultlayout2ejsp2b.java:261)
      at jrun.jsp.runtime.httpjspservlet.service(httpjspservlet.java:43)
  [snip..]

With the introduction of Generics and Annonation in Java 1.5, Collection syntax from JDK 1.4 will cause javac to flow out warning, and this warning will make the Translator of jrun failed to compile a JSP page.

This problem pretty hard to solve. JSPC will not write annonation to suppress the warning, on the other handle, JSPC won't allow you to specify extra javac option (to suppress the warning).

During this trouble shooting, the following related info found: Release Notes and Summary of Changes for each JDK 1.5 updates

A Post on how to use Antw + JRun JSPC

BTS entry of Sun Java SDK related to this issue

JRun4 JSPC class doc

Same issue discussed in MM Forum

Adobe release a hotfix for this issue:

There is one workaround and one solution:

  • Using JDK 1.5 update 5 or before. (Workaround)
  • Applied the Adobe hotfix (Solution, but not tested)

Precompile JSP

Add the following to build script

  <target name="deploy.appserver.jspcompile" if="env.JSP_COMPILE">
    <echo message="Env Var JSP_COMPILE found, compile JSP in deploy directory"/>
    <echo message="Compiling JSP files to Java source files with JSPC"/>
    <!-- Compile JSP -->
    <java classname="jrun.jsp.JSPC" fork="yes"
          failonerror="yes" output="jspc.log">
      <classpath>
        <path refid="compile.classpath"/>
      </classpath>
      <arg line="-k -w ${appserver.deploy.dir}"/>
    </java>
  </target>

  <target name="REAL_DEPLOY">
    <!-- snip... -->
    <antcall target="deploy.appserver.jspcompile"/>
    <!-- snip... -->
  </target>

Use MySQL JDBC driver for MySQL 4.1+

In short, avoid using built-in JDBC driver for MySQL bundled with JRun See this for details

JRun JDBC 3.0 getGeneratedKeys()

This simply not work, the JDBC api jar in JRun is JDBC 2.0

JRun, log4j, and commons-logging

Classloading issue.

JRun4 classloading issue

If use commons-logging + log4j, without axis

  1. define load-system-classes-first == false
  2. put jar in the war
  3. the log4j.properties can be put inside war or in servers/lib

If use JRun's axis

  1. Put log4j in servers/lib

Discussed in Spring forum:

Defined Location:

  ${jrun.home}/lib/*.jar
  ${jrun.home}/servers/lib/*.jar
  ${jrun.home}/servers/{$app}/WEB-INF/lib/*.jar
  ${jrun.home}/servers/{$app}/WEB-INF/classes
  ${jrun.home}/servers/{$app}/SERVER-INF/lib      [NOT WORK??]
  ${jrun.home}/servers/{$app}/SERVER-INF/classes  [NOT WORK??]

In jrun-web.xml,

  <load-system-classes-first>
  <reload>true</true>           Use DynamicClassLoader

Hacks:

  System.out.println(jrunx.util.JRunURLClassLoader.classloaders()); 

Ref:

Ref:

JRun4 API JavaDoc **