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 20.
It is not the current version, and thus it cannot be edited. AppFuse 1.8+ and JBoss 4.0.2
(1) First, you need to copy the entire appfuse deployment dir under jboss deploy dir. The default deploy dir in JBoss is something like "/server/default/deploy/". I needed to rename the dir as "appfuse.war" (Notice the .war in the name) so that jboss can detect it and reload it without errors. You can also simply deploy the WAR to this directory. NOTE: If you're using AppFuse 1.9+ - you're done! If you'd rather use a JNDI DataSource than the Spring-managed connection pool, you can follow the instructions below. You'll also need to change applicationContext-resources.xml so the dataSource bean reads from JNDI.(2) Next, you need to configure the datasource in jboss. For this, you need another file named "appfuse-ds.xml" and this file needs to be placed in the "deploy" dir of JBoss, at the same level of your deployed app dir, i.e., /server/default/deploy/. The contents of the file are: <datasources> <local-tx-datasource> <jndi-name>jdbc/appfuse</jndi-name> <connection-url>jdbc:mysql://localhost:3306/appfuse</connection-url> <driver-class>com.mysql.jdbc.Driver</driver-class> <user-name>test</user-name> <password>test</password> </local-tx-datasource> </datasources> (3) Next, You need a new file named "jboss-web.xml" which should be inside WEB-INF dir of you app. This file is needed for jboss deployment. The contents of this file is as follows: <?xml version="1.0" encoding="UTF-8" ?> <jboss-web> <context-root>/appfuse</context-root> <resource-ref> <res-ref-name>jdbc/appfuse</res-ref-name> <res-type>javax.sql.DataSource</res-type> <jndi-name>java:jdbc/appfuse</jndi-name> </resource-ref> </jboss-web>NOTE: You need to change the word "appfuse" to the name of the app instance you created if you are not using the default app that comes with appfuse. (4) Restart JBoss service. You might also checkout Ken Yee's blog for how he automated deploying AppFuse to JBoss. AppFuse 1.7 and JBoss 3.x.
AppFuse SecuritySetting up AppFuse security in JBoss I was surprise how easy it was. <application-policy name = "appfuse"> <authentication> <login-module code = "org.jboss.security.auth.spi.DatabaseServerLoginModule" flag = "required"> <module-option name = "dsJndiName">jdbc/mysql</module-option> <module-option name = "principalsQuery"> select password from app_user where username=? </module-option> <module-option name = "rolesQuery"> select role_name, 'Roles' from user_role where username=? </module-option> </login-module> </authentication> </application-policy> It took me less time to setup Security than it did for me to setup logging. (Which is a bit of a nightmare!) The above assumes you have a database driver mapped under jdbc/mysql. Create DS file as follows, and put it in the deploy dir: (C:\tools\jboss-3.2.3\server\default\deploy/mysql-ds.xml) <datasources> <local-tx-datasource> <jndi-name>jdbc/mysql</jndi-name> <connection-url>jdbc:mysql://localhost:3306/mysql</connection-url> <driver-class>com.mysql.jdbc.Driver</driver-class> <user-name>root</user-name> <password></password> </local-tx-datasource> </datasources> The login security stuff goes in the config directory of the server, e.g., C:\tools\jboss-3.2.3\server\default\conf\login-config.xml. I attached the login-config.xml file. Note the name has to be the name of your war (appfuse.war = appfuse). In reality, it has to be the name of the web context, but since my web context and war file name are the same it works. mysql-ds.xml has to be in the deploy dir, e.g., C:\tools\jboss-3.2.3\server\default\deploy\mysql-ds.xml. (The war file goes into the deploy dir as well). WARNING:JBoss holds onto the cache of users and roles. So if you changed a users role, they would not be able to see it for 1/2 an hour. I subclassed UserManagerImpl, and created a version specific to JBoss, then I changed UserManagerImpl to use a stub method called flushAuthCache. UserManagerJBossSpecific invalidates the user cache using JMX. JBoss is pretty cool! Since I am using Spring. I did not have to change any other code in the system. Just one configuration file! Spring change: <bean id="userManager" class="org.appfuse.webapp.service.UserManagerJBossSpecific"> <property name="userDAO"><ref local="userDAO"/></property> </bean> LoggingSetting up logging is a pain in JBoss. Don't mess with the console log... it misbehaves. Create a file logger and tail it. Here is my log4j.xml file (which has to be in the conf dir like the login-config.xml). I just tail -f the log file.
Attachments:
|