Raible's Wiki
Raible Designs AppFuseHomepage- Korean - Chinese - Italian - Japanese QuickStart Guide User Guide Tutorials Other ApplicationsStruts ResumeSecurity Example Struts Menu
Set your name in
UserPreferences
Referenced by
JSPWiki v2.2.33
Hide Menu |
This is version 2.
It is not the current version, and thus it cannot be edited. 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. Table of ContentsConfiguration 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 username 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>: <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: <bean-el:message key="login.signup" arg0="${pageContext.request.contextPath}/signup.jsp"/> Now you can try logging in with tomcat/tomcat, but it won't work. It seems that Resin has a problem with using an encrypted password (even though it's just a text string that matches the user's password in the database). Workaround #3: Change the "encrypt-password" <init-param> (in web.xml) to be false. This is on the Login Servlet (just search for "encrypt-password"). Then change the app_user.password column in the appfuse database to be "tomcat" instead of the encrypted version. mysql -u test -p appfuse update app_user set password = 'tomcat'; 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 #5: 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:
<resin:include href='appfuse.conf'/>
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:
|