- Download+install Java (preferrably Java6 SDK). Setup
$JAVA_HOME
environmental variable accordingly, so that$JAVA_HOME/bin/java
is the JVM executable. For linux, package managers now offer sun-java-* packages, you'd better AVOID the gcj stuff, for maximum compatibility. - Download+install MySQL. Again, linux distros have packages in default repos. Edit the MySQL configuration file (
/etc/mysql/my.cnf
or whatever), so that, under "[mysqld]
", you COMMENT the "skip-networking
" option and give a good bind address (127.0.0.1 is safest). Part of the file will look like[mysqld]
The example listens only on the local loopback interface, change for use with remote tomcat. In general, test access to your mysql daemon with "
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
language = /usr/share/mysql/English
bind-address = 127.0.0.1
# skip-networkingtelnet localhost 3306
", or such. - Download+install Tomcat-5.5, preferrably the zip package. Linux distros offer tomcat packages. Consider
$CATALINA_HOME
to be the installation path, so that$CATALINA_HOME/bin/startup.sh
starts the server. Tomcat requires special administration: - Download the MySQL JDBC connector, and place the JAR file in
$CATALINA_HOME/common/lib
, for all webapps to see. Keep in mind that the MySQL driver class iscom.mysql.jdbc.Driver
. - See to that the Security Manager lets the driver create a socket to the listening server port, by adding a policy entry to
$CATALINA_HOME/common/conf/catalina.policy
:grant codeBase "jar:file:/path/to/tomcat5.5/common/lib/mysql-connector-java-5.1.5.jar!/-" {
//permission java.net.SocketPermission "localhost:", "connect";
//permission java.net.SocketPermission "127.0.0.1:3306", "connect";
//permission java.net.SocketPermission "127.0.0.1:3306", "resolve";
permission java.security.AllPermission ;
}; - For development, NetBeans 6.1 is good, Eclipse offers some not-so-good plugins, and Vi is always a safe choice.
Stuff I find in the internet,
ideas, comments, references,other issues, that worth saving.
A geek's blog site.
Wednesday, May 14, 2008
My first webapp, Walkthrough pt2: Server configuration
In order to prepare a system for the db-enabled webapp, follow the steps below:
Friday, May 09, 2008
My first webapp, Walkthrough pt1: Requirements
This is the first entry in a series of post that guide through the creation of a tomcat (tomcat-5.5) web application with the following features:
- Database connectivity (mysql-5)
- User authentication (a simple one, not JAAS stuff)
- User-created database content
- Universal foreign language support in forms, parameters and files (utf-8 encoding)
- File creation/manipulation
- Linux Mint 4.0 (ubuntu-7.10 based)
- Sun Java 6u6 (from apt-get)
- Tomcat 5.5 (from apt-get)
- Mysql 5.1 (from apt-get)
Tuesday, May 06, 2008
Rollback with svn
Trickier than it may seem, but simpler than expected. This is how you revert/rollback to an earlier svn version and cancel/undo all the stupid things you have done. Example:
Assume: $STUPID_VERSION is the version that messed things up, $LOCALMODIFIEDDIR the place where things change (must be svn-controlled of course, but can be a subdir of the project, if this is desired)
$ cd $LOCALMODIFIEDDIR
$ svn merge -c -$STUPID_VERSION .
Note the dot at the end '.'; Found here, at this good guy's blog.
.. oh, and NEVER NEVER NEVER copy entire svn-controlled directories!!! the ".svn" hidden dirs are chaotic evil.
Now, it's quite probable that a future commit will result in failure because of "file already exists"... Therefore, make a local copy of the affected $LOCALMODIFIEDDIR somewhere without svn (let it be $BACKUPDIR), DELETE the ".svn" inside, and:
$ svn delete --force $LOCALMODIFIEDDIR
$ svn commit -m "deleted the dir"
$ cp -r $BACKUPDIR $NEWDDIR
$ svn add $NEWDIR
$ svn commit -m "stupid error fixed "
So simple... :-(
Assume: $STUPID_VERSION is the version that messed things up, $LOCALMODIFIEDDIR the place where things change (must be svn-controlled of course, but can be a subdir of the project, if this is desired)
$ cd $LOCALMODIFIEDDIR
$ svn merge -c -$STUPID_VERSION .
Note the dot at the end '.'; Found here, at this good guy's blog.
.. oh, and NEVER NEVER NEVER copy entire svn-controlled directories!!! the ".svn" hidden dirs are chaotic evil.
Now, it's quite probable that a future commit will result in failure because of "file already exists"... Therefore, make a local copy of the affected $LOCALMODIFIEDDIR somewhere without svn (let it be $BACKUPDIR), DELETE the ".svn" inside, and:
$ svn delete --force $LOCALMODIFIEDDIR
$ svn commit -m "deleted the dir"
$ cp -r $BACKUPDIR $NEWDDIR
$ svn add $NEWDIR
$ svn commit -m "stupid error fixed "
So simple... :-(
Subscribe to:
Posts (Atom)