This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 104434 - init method of Session and Page bean not called when using Tomcat 5.5.20 and higher
Summary: init method of Session and Page bean not called when using Tomcat 5.5.20 and ...
Status: RESOLVED INVALID
Alias: None
Product: obsolete
Classification: Unclassified
Component: visualweb (show other bugs)
Version: 6.x
Hardware: PC Windows XP
: P2 blocker (vote)
Assignee: _ potingwu
URL: http://issues.apache.org/bugzilla/sho...
Keywords: TOMCAT
Depends on:
Blocks:
 
Reported: 2007-05-21 18:51 UTC by Yousuf Haider
Modified: 2007-06-06 00:05 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Server Log (5.36 KB, text/plain)
2007-05-21 18:55 UTC, Yousuf Haider
Details
Server Output (2.47 KB, text/plain)
2007-05-21 18:56 UTC, Yousuf Haider
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Yousuf Haider 2007-05-21 18:51:07 UTC
NetBeans IDE 6.0 Preview Build (M9)
WinXP
JDK 1.6

This problem is evident when  you have code inside the init method initializing
some resources such as a datasources. For example if you have a databound table
it will show up empty. No exceptions in the server log.
 Problem only occurs on Tomcat version 5.5.20 and higher. On Tomcat 5.5.17 it
works perfectly fine. 

Steps to recreate:

1. Download Tomcat 5.5.23.
Add a user with manager role in the
"$TOMCAT/conf/tomcat-users.xml" file 
Your file should look something like this:

<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
  <role rolename="manager"/>
  <role rolename="standard"/>
  <user username="admin" password="adminadmin" roles="standard,manager"/>
</tomcat-users>


2.Add the following jars to $TOMCAT/common/lib :
-commons-beanutils
 -commons-collections
 -commons-digester
 -commons-logging
 -jsf-api
 -jsf-impl
 -jstl
 -standard

3. Add the server in the IDE and create J2EE1.4 project.

4.Drag a drop down list or table onto the page and then connect to JavaDB/MySql
server and drop a db table onto the component.

5.Deploy application. 

The page will load, the component will be rendered but it will have no data,
i.e. a table or drop down list will be empty.

I tried copying the JDBC drivers $TOMCAT/common/lib without any success.

Same issue with Tomcat 6.

Work Around :
   1. add _init(); to getPage1() method of Page1.java
   2. add getSessionBean1().init(); to _init() method of Page1.java
Comment 1 Yousuf Haider 2007-05-21 18:55:13 UTC
Created attachment 42609 [details]
Server Log
Comment 2 Yousuf Haider 2007-05-21 18:56:12 UTC
Created attachment 42610 [details]
Server Output
Comment 3 Yousuf Haider 2007-05-21 23:42:52 UTC
UPDATE:
It turns out that this is actually a Tomcat bug that was introduced in Tomcat
5.5.20.

What is happening is that if the webapp is stored at a directory that has spaces
in it then Tomcat is not able to pick up jars in the WEB-INF/lib folder.

Tomcat has a method that returns the paths to all jars with tlds in them but
when Tomcat is scanning for these jar files in the WEB-INF/lib folder it is
getting the file paths containing '%20' instead of spaces and it is unable to
convert the '%20' into spaces.

As a result it concludes (wrongly) that there are no jars in the folder. The
workaround is to place the webapp in a path with no spaces in it. In that case
the project works fine and the table is displayed with data in it. You don't
even need to place the jsf and jstl related jar files in the $TOMCAT/common/lib
folder. It picks up the jar files from the webapps WEB-INF/lib folder as it
should have always been doing.

Here is the link for the bug on Tomcat's website:
http://issues.apache.org/bugzilla/show_bug.cgi?id=42354

Its marked as fixed in nightly build and the fix will be integrated in Tomcat
5.5.24 apparently.

Assigning keyword TOMCAT.
Comment 4 Yousuf Haider 2007-06-06 00:05:10 UTC
marking as invalid since its not a netbeans issue but a tomcat bug.