Bug 408253 - tomcat6 fails because if missing commons-xxxx jars
Summary: tomcat6 fails because if missing commons-xxxx jars
Status: RESOLVED FIXED
: 433848 (view as bug list)
Alias: None
Product: openSUSE 11.0
Classification: openSUSE
Component: Java (show other bugs)
Version: Final
Hardware: x86 openSUSE 11.0
: P5 - None : Major with 5 votes (vote)
Target Milestone: ---
Assignee: E-mail List
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-07-11 08:12 UTC by luc willems
Modified: 2008-10-10 09:44 UTC (History)
1 user (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
patch to fix usage of commons-xxxx datasource factory (556 bytes, patch)
2008-07-11 08:12 UTC, luc willems
Details | Diff
Archiva on my system, under fixed tomcat - this is a login screen, but the registration works too. (58.21 KB, image/png)
2008-07-18 09:22 UTC, Michal Vyskocil
Details

Note You need to log in before you can comment on or make changes to this bug.
Description luc willems 2008-07-11 08:12:56 UTC
Created attachment 227210 [details]
patch to fix usage of commons-xxxx datasource factory

while installing the archiva (see http://archiva.apache.org/docs/1.0.2/adminguide/webapp.html ) war into a clean tomcat6 installation, i noticed a startup exception :

        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: java.lang.ClassNotFoundException: org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory
        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:169)
        at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:114)
        ... 134 more

according to tomcat mailing list this happens because "repackaging of tomcat" and excluding the original jar , replacing them with commons based jars
http://www.mail-archive.com/users%40tomcat.apache.org/msg27481.html

validating the src RPM i noticed in the %post lib part

%post lib
build-jar-repository %{libdir} \
%if ! %defined suse_version
        commons-collections-tomcat5 \
        commons-dbcp-tomcat5 \
        commons-pool-tomcat5 \
%endif
        ecj 2>&1


this basicly excludes the required jars in a SuSE based distribution :-(
also , it's using tomcat5 variants ?

i fixed the spec file like this
%post lib
build-jar-repository %{libdir} \
        commons-collections \
        commons-dbcp \
        commons-pool \
        ecj 2>&1

and make sure the commons-xxxx are added to the Required rpm's

with this in place , the jar files are added to /usr/share/tomcat6/lib

after this , startup still needed the "-Djavax.sql.DataSource.Factory=org.apache.commons.dbcp.BasicDataSourceFactory" option like in mentioned in the mail
because we replaced the original dependencies with commons-xxxx , we need to
patch java/org/apache/naming/factory/Constants.java to use the commons-xxxx based class so that tomcat6 will work out of the box -)
included is a patch file to fix this.

after this changes , tomcat6 will work with commons-xxx based jars and use correct DataSourceFactory .
Comment 1 luc willems 2008-07-11 09:49:08 UTC
revalidated with latest opensuse update tomcat6-6.0.16-6.2.src.rpm
same problem 
Comment 2 Michal Vyskocil 2008-07-16 09:06:07 UTC
Well, the initial packaging of the tomcat6 package was not really good. I've added a missing jakarta-commons packages back and upload the result to the BuildService. It would be very helpfull, if you can revalidate this version.

To install, just use:

zypper ar http://download.opensuse.org/repositories/home://mvyskocil://tomcat6/openSUSE_11.0/ home:mvyskocil:tomcat6
zypper ref

zypper install -r home:mvyskocil:tomcat6

In fact, there would be some `nothing provides foo' errors, but this should be resolved via `zypper install foo' (the repository has only a base set of dependencies).
Comment 3 luc willems 2008-07-17 16:12:50 UTC
packages installed but still the same problem :-(

the commons-dbcp-tomcat5 jar is missing , this should include the missing class
of this exception 
2008-07-17 17:53:27,931 [main] INFO  org.codehaus.plexus.PlexusContainer  - Loading on start [role,roleHint]: [org.apache.maven.archiva.web.startup.A
rchivaStartup,default]
2008-07-17 17:53:28,360 [main] ERROR org.apache.commons.configuration.JNDIConfiguration  - Could not create resource factory instance
javax.naming.NamingException: Could not create resource factory instance [Root exception is java.lang.ClassNotFoundException: org.apache.tomcat.dbcp.
dbcp.BasicDataSourceFactory]
        at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:118)
        at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:793)


i'v have some questions concerning "commons-xxx-tomcat5" jar files.


1) what is the origine off this files 
2) why are we removing the tomcat versions of this files. 
3) if whe replace the common-xxx files , why not using the "latest" released files 

note : my fix changed the dependancy to the latest commons-xxx files. after this , the included patch will make sure that tomcat will run "out of the box"
with projects that need a datasource as resource injected in to them.


luc

Comment 4 Michal Vyskocil 2008-07-18 09:22:18 UTC
Created attachment 228684 [details]
Archiva on my system, under fixed tomcat - this is a login screen, but the registration works too.

Hi, its little weird. I've tried the fixed packages* yesterday and archiva works. The missing packages was properly installed and links was created. 

* there was many additional changes to the tomcat6 spec, so my version is different from that in a BuildService.

About your questions:

1.) The origin is the jpackage.org project (JPP5.0)
2.) Not sure, if understood. Did you mean the jakarta-commons-xxx and jakarta-commons-xxx-tomcat5 files? In that case, I don't know, why was these packages removed from specfile (as I'm not the initial packager).
3.) We try to be as most compatible as a jpackage 1.7, as is possible, so in many cases, we distribute the same versions of the Java software.

I suppose, that's better to be compatible with jpackage.org and upstream, because in this case, the Java software will be very similar across the RPM distributions. And the tomcat6 and archiva works on my system well with the jakarta-commons-dbcp-tomcat5 and original Constants.java.
Comment 5 luc willems 2008-07-18 16:20:53 UTC
Hi michal ,

it's seems that something went wrong during installing of the
new tomcat packages. because of that i was still using the "old" OpenSuSE 11.0 rpms :-(

after reinstalling your packages all was  OK :-)

any change this new packages will be included in any update for OpenSUSE 11 ?

luc
Comment 6 Michal Vyskocil 2008-07-21 14:33:12 UTC
It's great! Thanks for help.

But unfortunately not for 11.0, because I cannot add the new package into the released product and tomcat6 needs the jakarta-commons-dbcp-tomcat5. You can use the tomcat6 package from Java:packages in BuildService [1] - it's the version from Factory. This version will be maintained as version in 11.0, so the security fixes and (a bug fixes) for 11.0 will be also available for this version.

[1] - http://download.opensuse.org/repositories/Java:/packages/openSUSE_11.0/

BTW: the fixed package was submitted into the Factory.
Comment 7 Michal Vyskocil 2008-10-10 09:44:50 UTC
*** Bug 433848 has been marked as a duplicate of this bug. ***