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
AppFuse
AppFuseSupport
AppFuse_it
AppFuse_jp
AppFuse_zh
Articles
Articles_cn
Articles_de
Articles_ko
Articles_pt
...and 2 more




JSPWiki v2.2.33

[RSS]


Hide Menu

AppFuseOnResin


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


This page describes my attempt to get AppFuse working on Resin 3.0.4. By documenting my procedures, and communicating with the Caucho team, I hope to be able to find workarounds to all the issues.
Update (1/12/2003): Most of the issues described in this document have been fixed by the Resin team, or in AppFuse's code. The two major bugs in AppFuse were related to the CompressionFilter (fixed by using new Filter) and password-encryption. Password encryption was broke because I had the wrong password. The only outstanding issue is exposing a struts-forward as a pageContext variable.

Table of Contents

  • [1] Configuration and installation
  • [2] Issues and Workarounds
  • [3] Quick Setup

Configuration and installation [#1]

1. The first step to installing AppFuse on Resin is to create an appfuse.conf file with the following contents:
<web-app id='/appfuse'
    document-directory="webapps/appfuse">

    <database>
        <jndi-name>jdbc/appfuse</jndi-name>
        <driver type="com.mysql.jdbc.Driver">
            <url>jdbc:mysql://localhost:3306/appfuse</url>
            <user>test</user>
            <password>test</password>
        </driver>
    </database>

    <resource jndi-name="mail/Session" type="javax.mail.Session"> 
        <init> 
            <mail.transport.protocol>smtp</mail.transport.protocol> 
            <mail.host>localhost</mail.host> 
        </init> 
    </resource> 

    <!-- Resin-specific JdbcAuthenticator -->
    <authenticator type="com.caucho.server.security.JdbcAuthenticator">
        <init>
            <data-source>jdbc/appfuse</data-source>
            <password-query>
              SELECT password FROM app_user WHERE username=?
            </password-query>
            <role-query>
              SELECT role_name FROM user_role r, app_user u
                WHERE r.username=? and r.user_id = u.id
            </role-query>
            <password-digest>none</password-digest>
        </init>
    </authenticator>

</web-app>

2. Put this file in $RESIN_HOME/conf.

3. Notify Resin that this file exists by adding the following to resin.conf, just after the last </web-app> in the file:

<resin:include href='appfuse.conf'/>

To further illustrate, here is where it goes within the default host config:

    <!-- configures the default host, matching any host name -->
    <host id=''>
      <document-directory>doc</document-directory>

      <!-- configures the root web-app -->
      <web-app id='/'>
        <!-- adds xsl to the search path -->
        <class-loader>
          <simple-loader path="$host-root/xsl"/>
        </class-loader>

        <servlet-mapping url-pattern="/servlet/*" servlet-name="invoker"/>
      </web-app>
      <resin:include href='appfuse.conf'/>
    </host>

4. Install AppFuse by running "ant package-web" and dropping the resulting .war file in $RESIN_HOME/webapps/. You will need to rename it from appfuse-version.war to appfuse.war.

5. Copy activation.jar, mail.jar and your JDBC Driver (i.e. mysql-connector-java-3.0.9-stable-bin.jar) to $RESIN_HOME/lib. The two JavaMail jars can be located in $J2EE_HOME/lib if you're using J2EE 1.4 Final.

6. At this point, you will will likely see the following error when starting Resin:

[appfuse] DEBUG [main] StartupListener.contextDestroyed(79) | contextDestroyed...

This is where the issues start...

Issues and Workarounds [#2]

The first step in tracking down the problems is to configure Resin to log more informative messages. Stop Resin and open $RESIN_HOME/conf/resin.conf. Change the logging level by changing the following line from this:
<log name='' level='info' path='stdout:' timestamp='[%H:%M:%S.%s] '/>

To this:

<log name='' level='all' path='stdout:' timestamp='[%H:%M:%S.%s] '/>

Restart Resin. Now Resin will tell you it's problem:

[07:10:34.302] com.caucho.config.ConfigException: `description' is an unknown pr
operty of `com.caucho.server.security.UserDataConstraint'.

Here, my friends, is where we have our first bug in Resin. According to the Servlet 2.3 DTD, "description" is certainly a valid property of user-data-constraint:

<!ELEMENT user-data-constraint (description?, transport-guarantee)>

Oh well, we can let it slide and comment out this property in web.xml.

Workaround #1: (Fixed in CVS) Search for "user-data-constraint" in $RESIN_HOME/webapps/appfuse/WEB-INF/web.xml and delete (or comment out) the <description> element following <user-data-constraint>:

THIS BUG IS FIXED ACCORDING TO THE RESIN TEAM

<user-data-constraint>
    <!--description>
	Encryption is not required for the application in general.
		    </description-->
    <transport-guarantee>NONE</transport-guarantee>
</user-data-constraint>
</security-constraint>

Stop and Restart Resin. You should now be able to the login page by going to http://localhost:8080/appfuse. BTW, if it seems to take a while, you might want to change your logging in $RESIN_HOME/conf/resin.conf back to "info"[logging options].

When navigating to http://localhost:8080/appfuse, you will likely see the following stacktrace:

java.lang.IllegalStateException: forward() not allowed after buffer has committed.
	at com.caucho.server.webapp.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:144)
	at com.caucho.server.webapp.RequestDispatcherImpl.error(RequestDispatcherImpl.java:118)
	at com.caucho.jsp.PageContextImpl.handlePageException(PageContextImpl.java:868)
	at _layouts._baselayout__jsp._jspService(_baselayout__jsp.java:409)
	at com.caucho.jsp.JavaPage.service(JavaPage.java:75)
	at com.caucho.jsp.Page.pageservice(Page.java:553)

This seems to be caused by the following JSTL code block in appfuse/WEB-INF/pages/loginForm.jsp.

    <fmt:message key="login.signup">
        <fmt:param><c:url value="/signup.jsp"/></fmt:param>
    </fmt:message>

Workaround #2: (Fixed in CVS) Change the code block above to use a Struts <bean-el> tag instead:

THIS BUG IS FIXED ACCORDING TO THE RESIN TEAM

    <bean-el:message key="login.signup" 
        arg0="${pageContext.request.contextPath}/signup.jsp"/>

Now it looks like I can login (in IE), Mozilla just takes me back to the login page. Unfortunately, I end up with a blank page and the following error in the log files:

[08:12:18.005] _web_22dinf._pages._mainmenu__jsp init
[08:12:18.161] [inc] chunk: 388
[08:12:18.161] [2] chunk: 455
[08:12:18.161] [inc] chunk: 856
[08:12:18.161] java.lang.ArrayIndexOutOfBoundsException: -3741
[08:12:18.161]  at com.caucho.server.connection.ResponseStream.writeChunk(Respon
seStream.java:411)
[08:12:18.161]  at com.caucho.server.connection.ResponseStream.flushBuffer(Respo
nseStream.java:359)
[08:12:18.161]  at com.caucho.server.connection.ResponseStream.finish(ResponseSt
ream.java:284)
[08:12:18.161]  at com.caucho.server.connection.AbstractHttpResponse.finish(Abst
ractHttpResponse.java:1697)
[08:12:18.161]  at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFil
terChain.java:188)

I saw this same ArrayIndexOutOfBoundsException on Roller, maybe it's an issue with the Compression Filter.

Workaround #3: (Fixed in CVS) Disable the compressionFilter by removing its mapping from web.xml.

HEY - that fricken worked! Damn Compression Filter - I think it causes more problems than it solves.

Quick Setup [#3]

I've taken my learnings from this exercise and enhanced AppFuse (in CVS) to run easier on Resin. If you can figure out an easier way to setup AppFuse on Resin (or offer any additional tips), please do so.

Here's the basic steps:

  • Edit $RESIN_HOME/conf/resin.conf and add the following after the last </web-app> closing tag.
<resin:include href='appfuse.conf'/>
  • Download appfuse.conf(info) and put it in the $RESIN_HOME/conf directory.
  • Put activation.jar, mail.jar and mysql-connector-java-3.0.9-stable-bin.jar in $RESIN_HOME/lib.
  • Remove the <filter-mapping> for CompressionFilter. (Fixed in CVS)
  • To enable the "Remember Me" feature, uncomment the <dispatcher> elements in web.xml, or just hit invoke the /appfuse/security/ URL to initialize the LoginFilter, which sets the "rememberMeEnabled" variable. (AppFuse 1.3-dev)

DISCLAIMER: I did not thoroughly test that everything works, I just ran through a couple of pages.

[#4] Logging options are:

off - disable logging
severe - severe errors only
warning - warnings
info - information
config - configuration
fine - fine debugging
finer - finer debugging
finest - finest debugging
all - all debugging

Attachments:
appfuse.conf Info on appfuse.conf 1140 bytes
resin.conf Info on resin.conf 5183 bytes


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