Raible's Wiki

Raible Designs
Wiki Home
News
Recent Changes

AppFuse

Homepage
  - Korean
  - Chinese
  - Italian
  - Japanese

QuickStart Guide
  - Chinese
  - French
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish
  - Japanese

User Guide
  - Korean
  - Chinese

Tutorials
  - Chinese
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish

FAQ
  - Korean

Latest Downloads

Other Applications

Struts Resume
Security Example
Struts Menu

Set your name in
UserPreferences


Referenced by
...nobody




JSPWiki v2.2.33

[RSS]


Hide Menu

Sandbox


This is version 10. It is not the current version, and thus it cannot be edited.
[Back to current version]   [Restore this version]


Steps for running Appfuse 1.8.2 under Oracle Application Server Enterprise Edition 10g Release 2 (10.1.2.0.2)

To successfully deploy an application developed with Appfuse 1.8.2 under the Oracle AS 10g Rel.2 there are quite a number of steps to follow as Oracle AS has a lot of different (and odd) behaviours from Tomcat.

We need to modify the build.xml and some classes... And we need to write some new ones...

Here we go !


Oracle doesn't like tags in web.xml

We need edit the properties.xml to add a property:

<property name="DeployOnOrion" value="true"/>

Then, we modify the build.xml, in the package-web target so that it doesn't remove the comments out from the tags:

  <if>
    <and>    <!-- Modified Part start -->
      <not>
        <isset property="DeployOnOrion"/>
      </not>
    <or>
      <isset property="tomcat5"/>
      <isset property="tomcat5.5"/>
    </or>
    </and>   <!-- Modified Part end-->
    <then>
      <replaceregexp flags="g"
         file="${webapp.target}/WEB-INF/web.xml"
         match='<!--dispatcher>'
         replace='<dispatcher>'/>
      <replaceregexp flags="g"
         file="${webapp.target}/WEB-INF/web.xml"
         match='</dispatcher-->'
         replace='</dispatcher>'/>
    </then>
  </if>

The contextConfigLocation parameter

In the /metadata/web/web-settings.xml file there is the contextConfigLocation parameter that looks like this:

  <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>
      classpath*:META-INF/applicationContext-*.xml
      /WEB-INF/applicationContext-*.xml
    </param-value>
  </context-param>

The problem with Oracle AS is that the wildcards syntax won't work.
And, moreover, the classpath*:META-INF/ search doesn't work because Oracle returns a bad URL format while browsing inside jar files.

So we have to do two different things: the first step is to modify the build.xml file so that it copies the applicationContext-hibernate.xml and applicationContext-service.xml files in the WEB-INF directory.
We do this by adding the following statements at the end of the copy-resources target:

  <copy overwrite="true" tofile="${build.dir}/${webapp.name}/WEB-INF/applicationContext-${dao.type}.xml">
    <fileset dir="src/dao" includes="**/*-${dao.type}.xml"/>
    <filterset refid="variables.to.replace"/>
  </copy>
  <copy tofile="${build.dir}/${webapp.name}/WEB-INF/applicationContext-service.xml">
    <fileset dir="src/service" includes="**/*-service.xml"/>
  </copy>   

Then, we modify the contextConfigLocation parameter in this way:
  <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>
      /WEB-INF/applicationContext-hibernate.xml
      /WEB-INF/applicationContext-service.xml
      /WEB-INF/applicationContext-resources.xml
      /WEB-INF/applicationContext-security.xml
    </param-value> 
  </context-param>

Oracle calls the UserCounterListener twice

The UserCounterListener is added twice when the application is deployed because it is defined both in the web.xml file and in the /WEB-INF/.tld file.

This causes the application to add every user twice in the user list.

Infact, the webdoclet target, in the jsptaglip subtask, re-adds every listener in the taglibrary definition.

You need to modify the webdoclet target in this way:

  <target name="webdoclet" depends="compile-web" unless="webdoclet.unnecessary"
    description="Generate web and Struts descriptors">
    <taskdef name="webdoclet" classname="xdoclet.modules.web.WebDocletTask">
      <classpath>
          <path refid="xdoclet.classpath"/>
          <path refid="web.compile.classpath"/>
      </classpath>
    </taskdef>
    <webdoclet destdir="${webapp.target}/WEB-INF"
      force="${xdoclet.force}"
      mergedir="metadata/web"
      excludedtags="@version,@author"
      verbose="true">
      <fileset dir="src/web"/>
      <fileset dir="${build.dir}/web/gen"/>
      <deploymentdescriptor validateXML="true"
        servletspec="2.3" sessiontimeout="10"
        destdir="${webapp.target}/WEB-INF" distributable="false"
        displayname="${ant.project.name}">
        <configParam name="httpPort" value="${http.port}"/>
        <configParam name="httpsPort" value="${https.port}"/>
        <configParam name="daoType" value="${dao.type}"/>
      </deploymentdescriptor>
     <strutsconfigxml validateXML="true" version="1.2"/>
      <strutsvalidationxml/>
    </webdoclet>
    <webdoclet destdir="${webapp.target}/WEB-INF"
       force="${xdoclet.force}"
       mergedir="metadata/web"
       excludedtags="@version,@author"
       verbose="true">
       <fileset dir="src/web" excludes="**/listener/**"/>
       <fileset dir="${build.dir}/web/gen"/>
       <jsptaglib validateXML="true"
         description="Custom tag library for this application"
         shortName="${webapp.name}" filename="${webapp.name}.tld"/>
     </webdoclet>
  </target>

When invalidating a session, Oracle doesn't call any HttpSessionAttributeListener

So the UserCounterListener is never called to remove unlogged users from the User List.

To fix this behaviour I created an OrionSessionListener class that gets called when a session is invalidated and that removes every variable in the session itself, forcing every HttpSessionAttributeListener to be called from the server.

Here is the class (create it in your /src/.../webapp/listener directory):

Plugin insertion failed: Unsupported parameter '0'.

ParameterDescriptionExample
urlIf specified, the source code from the Java file given by the url will be used (only available if this option is enabled in the wiki properties).url='http://www.java2html.de/HelloWorld.java'
tabSizeNumber of spaces representing a tab character. Default is 2.tabSize='4'
stylesupported styles are: Eclipse, Kawa, Monochromestyle='monochrome'
lineNumbersboolean flag for rendering line numbers. Default is falselineNumbers='true'
borderboolean flag for rendering a table border around the converted result. Default is falseborder='true'
alignmentSpecifies the horizontal alignment of the output. Supported values are: left, center, right default is left.alignment='center'
printVersionIf specified, the plugin only prints its name an version.printVersion='true'
attachmentIf specified, the source code from the attached Java file will be used.attachment='HelloWorld.java'
sourceIf specified, the source code contained in this parameter value will be used (only valid for one line of code).source='public final static main(String[] args);'


Null Object reference in class ConstantsTag

In the header.jsp page, you get a NullPointerException when executing the line

  <appfuse:constants scope="request"/>

This is caused by the release() method of the ConstantsTag

 
  public void release() {
      super.release();
      clazz = null;
      scope = Constants.class.getName();
  }
in the line
  clazz = null;

Just comment it out and everything works again.

I tried to use the class parameter of the constants tag, but i got another error and i had no more time to investigate further. :-)


Oracle doesn't execute filters if the url doesn't contain an extension

The problem happens with the j_security_check filter.

If you deploy the application, you will find out that it is impossible to login. This happens because the filter that should be triggered by the j_security_check url never gets called.

I found out that the problem is because the url doesn't have an extension. I changed the j_security_check into j_security_check.login and everything works again.

You have to change this in the following files:
/properties.xml
/metadata/web/filter-mappings.xml
/src/web/your_app_path/webapp/action/LoginServlet.java
/web/WEB-INF/applicationContext-security.xml


Strange behaviours with Orache Web Cache

Using Oracle Web Cache i noticed some strange behaviours. OWC keeps caching pages even if the header's meta tags say not to cache anything.

I had to disable the OWC to have the application work correctly.



Go to top   More info...   Attach file...
This particular version was published on 06-Nov-2006 13:52:44 MST by StefanoBertini.