Showing posts with label tomcat. Show all posts
Showing posts with label tomcat. Show all posts

Thursday, June 18, 2009

I run my Tomcat, instead I get this "ORACLE DATABASE 10g EXPRESS..." message

You try to run  Apache Tomcat, but instead you  get this message "ORACLE DATABASE 10g EXPRESS EDITION LICENSE AGREEMENT".
This simply means
If you bump into this problem, you have an Oracle 10g Express Edition (OracleXE 10g) installation sitting on the same port as your Tomcat default port (TCP/IP port 8080). As the TCP/IP protocol doesn't allow you to have more than one process listening to the same port (except when you use the advanced channel/selector), then when you start Tomcat, it will fail. You might not be aware that your Tomcat has failed to start, until you get into that message mentioned above.

There are 2 cures to this symptoms, the first cure  is to let Oracle XE take the port, and we move the tomcat installation to another port. The second cure is to set the Oracle XE to use another port.

To achieve the first one, you need to modify your $CATALINA_HOME/conf/server.xml file. Find the portion of the file that contains this snippet (assuming you are using the standard Tomcat installation):

[sourcecode lang="xml"]
connectionTimeout="20000"
redirectPort="8443" />
[/sourcecode]

Change the port 8080 to something else, e.g. 8484.

[sourcecode lang="xml"]
connectionTimeout="20000"
redirectPort="8443" />
[/sourcecode]

By now you should be able to run you application.
Don't forget that you have to run it from port 8484. So if the application you deploy is someapp.war the URL that you aim should be http://localhost:8484/someapp/ instead of http://localhost:8080/someapp/

Ok, now if you want to take the second cure, go to your Oracle XE 10g console using sqlplus. Replace mypassword with that your SYS user password (as specified during the installation process). Note that the number 2, 3, 4 at the left side is generated by the sqlplus tools prompt (you don't need to type them in).

[sourcecode lang="sql"]
C:\> sqlplus sys/mypassword@xe as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Thu Jun 18 17:53:47 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.

Connected to:
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production

SQL> begin
2 dbms_xdb.sethttpport('8484');
3 end;
4 /
[/sourcecode]

Oracle XE should reply:

[sourcecode lang="sql"]
PL/SQL procedure successfully completed.
[/sourcecode]

After that check to ensure that the configuration has been changed properly:

[sourcecode lang="sql"]
SQL> select dbms_xdb.gethttpport as "HTTP-Port is " from dual;
[/sourcecode]

You should get a message like this:

[sourcecode lang="sql"]
HTTP-Port is
------------
8484
[/sourcecode]

Exit from sqlplus by typing "exit" at the prompt.

If everything as expected, now you can start the Tomcat server and use the port 8080 for Tomcat. To access the Oracle XE 10g database web console, access through http://localhost:8484/apex

Wednesday, March 18, 2009

Hudson Build Stuck on the Build Queue

These few days we have had problem with our Hudson server. The build seems to be stuck in the build queue, there are some executors (I setup 2 executors) available though. I suspected that there are some thread starvation going on or lacking of worker thread in the application server?
We used Apache Tomcat 6.0 to run the Hudson server. We also run artifactory for local maven2 repository on the same application server.
These few days the problem could be temporarily fixed by restarting the application server. I did it several times, but seems this problem is a chronic problem that keeps recurring every 10-20 builds.

This morning I figured out something new, Hudson seems to complain that the executor was frozen (showing that both executors status is "Offline"). Then I take a look, I discovered that there is a configuration for the executor when you click on the [Build executor status] positioned on the bottom of the left menu.
From here I can see the problem clearly:
Hudson displays the name of the executor nodes (as it supports build on multiple nodes), the response time for each node, free swap space and free disk space and some other stuff.
On my machine Hudson showed a warning that the disk space is low (less than 1GB). So this is the reason why Hudson froze the executors. It prevents itself to bring down the machine buy hogging the disk space.

Then I try to find a solution for this problem. I know that on our Windows server Hudson is running as Default User on the user's home. So, there is high probability to fix this problem by moving Hudson to other user of moving this user's space to location other than C: drive.

The simplest working solution to this problem turned to be:

  • specifying Hudson home (other than the default $USER_HOME/.hudson) on the Apache Tomcat service configuration

  • specifying Artifactory home (other than the default $USER_HOME/.artifactory) on the Apache Tomcat service configuration

  • copy the content of $USER_HOME/.hudson to a new hudson home

  • copy the content of $USER_HOME/.artifactory to a new artifactory home

  • restart Apache Tomcat service

Thursday, July 17, 2008

Apache Tomcat 6.0 Cannot Undeploy Correctly

This 3 months I have been using Tomcat 6.0 for deployment, and one thing that I don't like is that the application server needs to be restarted most of the time when deploying. I remember that this is not the case with my previous development. I thought it was because the Tomcat 6.0. Later I found out that the problem is with the struts-core-1.3.9.jar library.

Several attempts have been made to use the antiJARLocking and antiResourceLocking features of Tomcat. All ends up in futility.

The struts-core-1.3.9.jar (as well as version 1.3.5, 1.3.8) as setup by maven 2 dependency, depends on the Apache commons-digester-1.8.jar. This version (1.8) of the commons-digester library has this bug specific to Windows environment.

There are some workarounds that is possible:

  • Upgrade to higher version of Struts (in the case of my current work, we are moving to struts2 which known not to have this problem)

  • Override the maven 2 dependency, and inject a new dependency to higher version of commons-digester library


First option is obvious, the next will be a bit tricky.
I will show you how to do it later...

Thursday, July 10, 2008

Liferay 5.0.1 with Tomcat bundle

Why did I choose the Tomcat bundle?

First, unarguably Tomcat is the most popular application server in the planet.
One of the SpringSource guys told me that based on survey, around 80% of the Spring framework
deployment are in Tomcat. There are lots of application currently in production that uses
Tomcat.

Second, that is what the Liferay 4.4 documentation suggest for the development.
(Sadly enough, currently there is no Liferay 5.0.1 documentation...)

Become a bit different from the manual, I choose PostgreSQL 8.2 as my development database instead of MySQL as suggested by Liferay manual. pgAdminIII 1.6.3 feels handy right here.

What you need to do with PostgreSQL is:

Copy the JDBC driver from PostgreSQL installation to the Tomcat library folder.
In my machine I copied from [C:\Program Files\PostgreSQL\8.2\jdbc\postgresql-8.2-506.jdbc4.jar]
to my [d:\opt\liferay-portal-tomcat-5.5-5.0.1\shared\lib] folder.

I edit the d:\opt\liferay-portal-tomcat-5.5-5.0.1\conf\Catalina\localhost\ROOT.xml
Comment out the tag for MySQL, uncomment and adapt the PostgreSQL section.
For my machine, it was setup like this. You might need to adapt to your own database setting.

<resource
name="jdbc/LiferayPool"
auth="Container"
type="javax.sql.DataSource"
driverClassName="org.postgresql.Driver"
url="jdbc:postgresql://localhost:5432/lportal"
username="lportal_client"
password="liferay"
maxActive="20"
/>

Remember that some default configuration of PostgreSQL installation disabled the TCP/IP access
to database. You need to enable that, and also you might need to grant permission to where the
TCP/IP client located (in this case your Tomcat application server).

As suggested by the manual, Liferay will do the magic when you change the database, provided
sufficient rights to access the new database. Of course the magic takes some time to perform.

Access the web browser on the url [http://localhost:8080/]. It will display this screen:

Login using:
user: test@liferay.com
pass: test
Click on the [Sign in] button.

The sample page will show you a form asking you to agree/disagree with the Terms and Conditions.

If you get this far that means that you have succeeded setting up a fresh Liferay installation with the database for development.
Good job!

Wednesday, July 9, 2008

Liferay 5.0.1 Up and Running

Yesterday I attended the Liferay Intalio - Join Event, at Hilton Orchard Hotel Singapore.
The presentation itself was very short, but the cocktail is surprisingly quite long. I met great people here.

I believe Liferay is the fastest growing community on open source portal, and has been picking up very well and gaining reputable recognition.

Intalio is also an open source product in a niche market which has gained reputable recognition it its own niche market.

Today I downloaded the latest Liferay 5.0.1 bundled with Tomcat 5.5 from this link:
http://downloads.sourceforge.net/lportal/liferay-portal-tomcat-5.5-5.0.1.zip

I personally still prefer to use the Tomcat 5.5 rather than Tomcat 6.0, not because I'm a slow adapter of this latest app server, but because I found it quite problematic to deploy on Tomcat 6.0. This happens when I was working with a Struts application at my work. Something strange things happened, and Tomcat 6.0 does not show anything. After hours of finding out, I decided to give a try to deploy on Tomcat 5.5, which gave a thorough error message about deployment. It might be because of something the way Tomcat changes the logger between 5.5 and 6.0 which I haven't had time to explore much.

As expected the downloaded bundle works very well with my laptop environment.
I used JDK 5 to run it.

These are the steps needed to make the Liferay 5.0.1 running on my machine:

  1. Extract the file to a folder (mine is [d:\opt\liferay-portal-tomcat-5.5-5.0.1])

  2. Set environment variable CATALINA_HOME to point to [d:\opt\liferay-portal-tomcat-5.5-5.0.1]

  3. Set your CLASSPATH, JAVA_HOME and PATH environment variables

  4. Run Tomcat 5.5 from the command line using "d:\opt\liferay-tomcat-5.5-5.0.1\bin\startup.bat"

  5. Watch the messages

  6. Test if it works by opening through your browser this url: http://localhost:8080/


Tuesday, October 23, 2007

Apache Hudson Continuous Build

This week I have had intensive touch with Hudson. I need to setup a new environment for development. It is a continuous build application, from the open source free software (OSFS) stack.

Hudson could run on any JEE application servers, such as Tomcat or Jetty. The project is now under Apache Software Foundation. The license is Apache License v 2.0.  
In our enviroment we use Subversion, and Hudson integrate well with Subversion. It polls for changes in Subversion, and  build on changes so that we could know which commit breaks the build. Hudson could run Ant build project but support Maven 2 build as well. To configure Hudson to use Maven 2 build, you only need to specify the pom.xml file. 


Saturday, August 18, 2007

No TELNET Client in Vista!?

Changing job always needs adjustments.
One of the most annoying thing is that you have to backup all your data, return your notebook to the office, and move the data to your new notebook. I moved to my personal notebook, cos starting from now I will be working on office's PC.
For me, I had an additional tasks, as I have to buy a new notebook. Making backup of all your data you have accumulated for more,than 1 year itself quite a tricky stuff. I have settled on the XP Professional, have a virtualized OpenSolaris 11 (Nevada) and CentOS 5, WebLogic 8.1 and WebLogic 9.2 installations along with the domains, and tons of codes personal stuffs to move.
My choice eventually fell on dual core Turion64 based Fujitsu lifebook. Large clear screen, economic, no camera, but I like it. Fujitsu also invented smart battery management and shock prevention software for hard drives.
One of the thing, is that latest computers only offer Vista. Mine is bundled with Vista Home Premium. It is much like changing platform from Linux to OpenSolaris. Lots of homeworks to do before you could run it so well.
Last week when I tried to work on with Tomcat, but my browser don't show anything. I need to check whether Tomcat service is available on the default port 8080. Then suddenly I found out that THERE IS NO TELNET CLIENT in Windows Vista! I checked the PATH variable, seems to be okay.
Then I googled around, and found out that TELNET client is disabled by default on Windows Vista!
You need to set it up like this, go to Control Panel:
Control Panel > Programs and Features > Turn Windows features on or off > Telnet client
Turn it on.
Amazingly, it took more than 10 minutes just to enable TELNET client! I got no idea why it took so long to enable such a simple trivial client application.
Later on I found out the reason why Tomcat not yet listening to port 8080. Vista blocked the port and asking for permission to listen to that port. This happens only the first time you run your Tomcat instance. If you enable client access feature, you need to reply to this kind of quite-annoying-prompts. Anyway I must be getting used to it.
Voila, Tomcat works again.