JavaBlogs seems to really like my RSS feed - I keep showing up on the main page twice. This means that something is probably wrong with my feed, so I've done the right thing and disabled my Java feed for the time being. I'll add it in when I rev to the next Roller version - which will hopefully only be a week or two. I'll leave this in the Java category to see if it shows up over there. If so, I guess I'll have to delete the feed entirely instead of just disabling it.
My early-morning blog reading comes through once again. First off, Charles explains how I should implement Remember Me. If understand him correctly, I basically need to create a new table (i.e. user_cookie) that has two columns: username and cookie_id - where cookie_id is a random 128 bit number. The key to his strategy is replacing the number with a new one everytime the user logs in. Why didn't I think of that? Thanks Charles!
Secondly, this Tweaking MySQL Primer (via Erik) has some good tips on MySQL. I'd prefer a more generic "tweak your database" howto that covered many databases, but this will have to do for now. I'm going to try a little OPTIMIZE tablename on this site in a few - it's it's down all morning, now you know why...
Lastly, what the hell are Erik and Rick Ross cooking up?
I spent five hours on the phone with Rick Ross (of Javalobby) on Saturday afternoon. I think we effectively fixed everything that is wrong in the world. Stay tunned. ;-)
WTF? 5 hours on the phone? I don't think I've spent 5 hours on the phone with anyone in my entire life. It must be good - or they're not very good communicators... ;-)
Rick Hightower has started using AppFuse. It looks like he had a couple of issues, so I figured I'd post some solutions here for all to see (also because typing in comments w/o HTML on JRoller sucks).
Rick - I don't know why you're getting the first error with CATALINA_HOME. I just tried removing that as an environment variable on my PowerBook and I'm able to run "ant setup-db" just fine. If you've setup the MySQL database with the default settings, you should end up with a "root" user and a blank password. These settings are both specified in properties.xml, where database.admin.username=root and database.admin.username=(nothing). Of course, you can change these properties values by editing properties.xml, or by specifying them in your build.properties file. From the following error on your site:
db-load:
BUILD FAILED
C:\source\appfuse\build.xml:931: java.sql.SQLException: Invalid authorization sp
ecification, message from server: "Access denied for user: 'rick@localhost' (Us
ing password: YES)"
It looks like you have an administrator named "rick", but that your password was incorrect. YES is not the password you provided - that's just MySQL saying that you did provide a password.
The database creation script is at metadata/sql/mysql-create.sql and it simply creates an "appfuse" database and gives a user named "test" access to it.
create database if not exists appfuse;
grant all privileges on appfuse.* to test@"%" identified by "test";
grant all privileges on appfuse.* to test@localhost identified by "test";
The next error about j2ee.jar should be self explanatory and it looks like you figured that one out. I wish I didn't have to include the entire j2ee.jar in the classpath, but XDoclet requires javax.ejb.* JARs be in the classpath for generating Struts ActionForms from POJOs.
The last thing you did - ant -Dapp.name=sampleApp -Ddb.name=database - was to merely run the "package-web" target. It's the default target in build.xml. It simply compiles everything and packages into an appfuse-1.3.war file. In this scenario, the app.name and db.name mean nothing. If you want to create a new AppFuse project, you need to specify the new target. This will create a new project.
foxxy:~/dev/appfuse mraible$ ant new -Dapp.name=test -Ddb.name=test
Buildfile: build.xml
clean:
[echo] Cleaning build and distribution directories
[delete] Deleting directory /Users/mraible/workspace/appfuse/build
[delete] Deleting directory /Users/mraible/workspace/appfuse/dist
[delete] Deleting: /Users/mraible/workspace/appfuse/database.properties
new:
[echo] Creating new application named 'test'...
[copy] Copying 318 files to /Users/mraible/workspace/test
[copy] Copying 1 file to /Users/mraible/workspace/test
BUILD SUCCESSFUL
Total time: 21 seconds
I just tried this, followed by the commands specified below and all seems to be working just fine (BUILD SUCCESSFUL - Total time: 5 minutes 13 seconds).
cd ../test
ant setup-db
ant setup-tomcat
ant test-all
Just to be clear, here's a breakdown of what the above targets do:
- setup-db: creates a database for the project, assigns users, creates all the tables and populates it with test data.
- setup-tomcat: copies a context.xml file to $CATALINA_HOME/webapps and copies the database driver to CATALINA_HOME/common/lib.
- test-all: runs all the tests to verify the functionality of the app. These include test-ejb for the DAO layer, test-canoo for all the JSPs and test-web for all the StrutsTestCase/Cactus tests and business layer tests (*ManagerTest).
The first steps after creating a new AppFuse project are probably to rename the packages to fit your company's naming convention - i.e. org.appfuse -> com.company.appname. In Eclipse (and propably IDEA), this is fairly easy. Just make sure to do it in the "src" and "test" directories, as well as search for it - it might be specified in a few XML files (i.e. hibernate.cfg.xml). You'll also need to modify the "javadoc" target to ensure that it looks for the write package names. Currently, it's set to "org.*".
Hope this helps!