You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Liqiao Han <mi...@winlab.rutgers.edu> on 2004/02/28 21:07:29 UTC
NullPointerException @ cocoon+ mysql //thank you!
I have struggled with cocoon+mysql for a week and failed to make themwork!
I am new to mysql and cocoon both. now I totally have no idea what to do.
What I did:
1. I copied the "mysql-connector-java-3.0.11-stable-bin.jar" to
$COCOON_HOME/WEB-INF/lib
2. add the following to the web.xml
<!-- For MySQL Driver: -->
com.mysql.jdbc.Driver
3. add the following to the cocoon.xconf
<jdbc name="YourPoolName">
<pool-controller min="5" max="10"/>
<dburl>jdbc:mysql://boss.mylab.org:3306/tbdb?autoReconnect=true</dburl>
<user>YourUsername</user>
<password>YourPassword</password>
</jdbc>
in fact I am not quite sure the database name, user name and password
above.
A> the database server doesn't require an user name or password to use
the database, but it dos require an account to login in to the OS, I don't
know how to set the user and password here?
B> I am not sure the database name too. After I login on to the server
by
ssh, I can type
> mysql
>use tbdb
and then, I can inquery the table I want,
so is "tbdb" the one I should set after the port number?
4: here is what I add to the sitemap.xmap
<map:match pattern="allUsers">
<map:generate src="allUsers.xml" />
<map:transform type="sql">
<map:parameter name="use-connection" value="YourPoolName" />
<map:parameter name="show-nr-of-rows" value="true" />
<map:parameter name="clob-encoding" value="UTF-8" />
</map:transform>
<map:serialize type="xml" />
</map:match>
5, here is the allUsers.xml
<?xml version="1.0" ?>
<document>
<execute-query xmlns="http://apache.org/cocoon/SQL/2.0">
<query name="allUsers">
select uid from users;
</query>
</execute-query>
</document>
So I started the server and input the Url, the response is very
veryslow(about 5 minutes) and what I got an null pointer error. I looked
at the
error log, it says:
java.sql.SQLException: Failed to obtain connection. Made 5 attempts with
5000ms interval
at
org.apache.cocoon.transformation.SQLTransformer$Query.getConnection(SQLTrans
former.java:1038)
at
org.apache.cocoon.transformation.SQLTransformer.executeQuery(SQLTransformer.
java:326)
at
org.apache.cocoon.transformation.SQLTransformer.endExecuteQueryElement(SQLTr
ansformer.java:493)
I used tcpdump to see the data transfer between my machine and the
server,actually the tcp messages were sent out and the server acked it.
but I doubt
if jdbc has sent out the query because according to the tcpdump the
messagecontains no data like following:
my-domainName.1234 >server-domainName.3306 S 123456:123456(0) win 6424
(mss
1460, nop,nop, sackOK) (DF)
server-domainName.3306 >my-domainName.1234 R 0:0 ack 123457 win 0
Now I totally have no idea why
Thanks for your help and time!
following is the error stack:
Failed to execute pipeline.
org.apache.cocoon.ProcessingException: Failed to execute pipeline.:
java.lang.NullPointerException
Original Exception: java.lang.NullPointerException at
org.apache.xml.serializer.ToStream.ensurePrefixIsDeclared(ToStream.java:2675
) at
org.apache.xml.serializer.ToStream.startElement(ToStream.java:1777)
at
org.apache.xalan.transformer.TransformerIdentityImpl.startElement(Transforme
rIdentityImpl.java:1073) at
org.apache.cocoon.xml.AbstractXMLPipe.startElement(AbstractXMLPipe.java:130)
at
org.apache.cocoon.xml.AbstractXMLPipe.startElement(AbstractXMLPipe.java:130)
at
org.apache.cocoon.transformation.AbstractSAXTransformer.startTransformingEle
ment(AbstractSAXTransformer.java:692) at
org.apache.cocoon.transformation.SQLTransformer.start(SQLTransformer.java:80
1) at
org.apache.cocoon.transformation.SQLTransformer.executeQuery(SQLTransformer.
java:340) at
org.apache.cocoon.transformation.SQLTransformer.endExecuteQueryElement(SQLTr
ansformer.java:493) at
org.apache.cocoon.transformation.SQLTransformer.endTransformingElement(SQLTr
ansformer.java:774) at
org.apache.cocoon.transformation.AbstractSAXTransformer.endElement(AbstractS
AXTransformer.java:358)
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org