You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Lars Schmidt-Thieme <lb...@rz.uni-karlsruhe.de> on 2002/05/08 20:00:46 UTC
patch for cocoon 2.1dev for JDK 1.4 (including database examples)
Hi,
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
http://viror.wiwi.uni-karlsruhe.de/cocoon21fix/
Any improvements welcome (especially hints how to get
the portal up and running, too).
Best regards
Lars
-----------------------------------------
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)
Problem:
Database examles do not run with jdk 1.4.
Accessing e.g. the simple sql example leads to (tail -f
webapps/cocoon/WEB-INF/logs/sitemap.log):
DEBUG (2002-05-08) 17:52.13:178
[sitemap.transformer.sql](/cocoon/sql/sql-page)
HttpProcessor[8080][4]/SQLTransformer$Query: SQLTransformer$Query: could not
acquire a Connection -- waiting 5000 ms to try again.
Patch:
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
./build.sh -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
./build.sh
cd ../jakarta-logkit
cd lib
ln -s ../../jakarta-avalon/build/lib/avalon-framework.jar
cd ..
./build.sh import-servlet-jar
./build.sh
cd ../jakarta-avalon-excalibur
./build.sh
jar tf avalon-excalibur.jar | grep datasource
Now you should see
org/apache/avalon/excalibur/datasource/Jdbc3Connection.class
Note that this class is missing in the excalibur-jar shipped with cocoon
(ISSUE 1).
3. - First patch of avalon excalibur:
edit
/opt/net/avalon/jakarta-avalon-excalibur/datasource/src/java/org/apache/avalon/excalibur/datasource/JdbcConnectionFactory.java
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).
./build.sh clean
./build.sh
4. - Install new excalibur-jar and restart tomcat
cd jakarta-tomcat
./bin/shutdown.sh
killall -KILL java
cp ../avalon/jakarta-avalon-excalibur/avalon-excalibur.jar
webapps/cocoon/WEB-INF/lib/avalon-excalibur-20020506.jar
./bin/startup.sh
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
org.apache.avalon.excalibur.logger.factory.ServletTargetFactory
at
org.apache.avalon.excalibur.logger.DefaultLogTargetFactoryManager.configure(DefaultLogTargetFactoryManager.java:111)
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
Connection
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:
edit
/opt/net/avalon/jakarta-avalon-excalibur/datasource/src/java/org/apache/avalon/excalibur/datasource/JdbcConnectionFactory.java
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
90-95):
this.m_connectionClass = connectionClass;
hackedInit();
}
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 )
hackedInit();
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
initialization
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
java.lang.NullPointerException
at
org.apache.cocoon.webapps.session.xml.XMLUtil.getNodesFromPath(XMLUtil.java:870)
(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. <http://xml.apache.org/cocoon/faqs.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>