cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lars Schmidt-Thieme <>
Subject patch for cocoon 2.1dev for JDK 1.4 (including database examples)
Date Wed, 08 May 2002 18:00:46 GMT

I finally managed to get the database examples in cocoon 2.1dev 
to work with jdk 1.4. A detailed description follows at the end of 
this mail; a html-version and a patched and ready-to-deploy 
war-archiv is available at

Any improvements welcome (especially hints how to get
the portal up and running,  too).

Best regards


Fix for cocoon-2.1-dev

Intended setup:
  cocoon: 2.1-dev
  jdk: sun 1.4
  tomcat: 4.0.4b2 
  os: linux (suse 7.3)

  Database examles do not run with jdk 1.4.
  Accessing e.g. the simple sql example leads to (tail -f    

DEBUG   (2002-05-08) 17:52.13:178   
HttpProcessor[8080][4]/SQLTransformer$Query: SQLTransformer$Query: could not 
acquire a Connection -- waiting 5000 ms to try again.

1.- Get cocoon-2.1-dev (CVS snapshot xml-cocoon2_20020508103228.tar.gz).
  cd /opt/net
  tar xzf xml-cocoon2_20020508103228.tar.gz
  cd xml-cocoon
  export TOMCAT_HOME=/opt/net/jakarta-tomcat
  ./  -Dinclude.webapp.libs=yes -Dinclude.scratchpad.libs=yes webapp

2.- Get avalon framework (jakarta-avalon-src.tar.gz),
      avalon logkit (jakarta-avalon-logkit-src.tar.gz), and 
      avolon excalibur (jakarta-avalon-excalibur-src.tar.gz).

  Extract in a directory avalon,
  cd jakarta-avalon

  cd ../jakarta-logkit
  cd lib
  ln -s ../../jakarta-avalon/build/lib/avalon-framework.jar
  cd ..
  ./ import-servlet-jar

  cd ../jakarta-avalon-excalibur

  jar tf avalon-excalibur.jar | grep datasource

  Now you should see

  Note that this class is missing in the excalibur-jar shipped with cocoon 
(ISSUE 1).

3. - First patch of avalon excalibur:
  and uncomment line 122 (carefully read lines 119-121): (ISSUE 2)

            System.out.println( "Unable to get specified connection class: " 
+ e );

  (catch clause in last constructor).

  ./ clean

4. - Install new excalibur-jar and restart tomcat

  cd jakarta-tomcat
  killall -KILL java
  cp ../avalon/jakarta-avalon-excalibur/avalon-excalibur.jar 

In (tail -f logs/catalina.out):

Logging Error: Could not set up Cocoon Logger, will use screen instead
org.apache.avalon.framework.configuration.ConfigurationException: cannot find 
LogTargetFactory class 

5. - Test cocoon

  Access http://localhost:8080/cocoon/ with your webbrowser
  This should work ; you should see the cocoon entry page.

6. - Test database example:

  Again, access the simple sql example leads. This leads to (sitemap.log):

2002-05-08 18:26:03 WARN    (2002-05-08) 18:26.03:665   [core.dat] 
(/cocoon/sql/sql-page) HttpProcessor[8080][2]/LogKitLogger: Could not return 
org.apache.avalon.excalibur.datasource.NoValidConnectionException: No valid 
JdbcConnection class available

  But now you can see in catalina.out, what happened:

Unable to get specified connection class: java.sql.SQLException: Connection 
is broken: Connection refused
Starting service Tomcat-Apache
Apache Tomcat/4.0.4-b2
Server 1.6 is running
Press [Ctrl]+[C] to abort

The last two lines stem from the hsql database, that is used for the examples.
As you can see, the excalibur JdbcConnectionFactory tries to connect to 
the database before the database is started - and fails - and never
recovers (ISSUE 3). 

7. - Second patch (hack) of avalon excalibur:
  again and
    - make instance variable m_class non-final (line 30),
        private Class m_class;
    - add additional variable connectionClass (new line 35),
        private final String connectionClass;
    - factor out the database connection setup by inserting (as new lines 

	this.m_connectionClass = connectionClass;


    protected void hackedInit() {

    and replacing line 111 with
            String className = m_connectionClass;

    - call hackedInit if the init failed during startup (new lines 142, 143):

        if( null == this.m_class )

8. = 4. (dont forget killall java, otherwise hsql database may not be shut 
down correctly
   and you get an port already in use exception in catalina.out)

  (You still see the same output as in 6. in the logs, but now the connection 
   will be tried a second time, so it does not matter.)

9. = 5. but now the database example should work (it does for me).

The following examples are running on my machine:

- multimedia hello world: all
- docs: all (including the tutorial).
- more samples / static content: all (deli is disabled)
               / server pages / hello xsp: all
                              / jsp : none (404 page not found)
                              / xsp java: all (including esql)
                              / xsp javascript: all
                              / xsp python: none (404 page not found; 
                                      I dont have jphython installed).
               / dynamic content / internationalization: none (404)
                                 / dynamic content: all but python (see 
before; now correct error message)
                                 / xscript and soap: seem to work (the stock 
price is -1, though).
                                 / database access: ALL !!
                                 / aggregation: all.
               / portal: front page yes, but login does not work

       (this error message has been described in an earlies message by 
someone else, already).

                / sources: all
                / web applications: all
                / legacy: all but regress and test-math (404)  
- system tools: all

Please check that your question has not already been answered in the
FAQ before posting. <>

To unsubscribe, e-mail: <>
For additional commands, e-mail: <>

View raw message