You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-user@james.apache.org by Santosh <sa...@wirkle.com> on 2006/04/01 14:33:12 UTC

Problem configuring the DataSource

Hi Everyone,

I am trying configure a DataSource for connecting to a database other
than "mail". Following is the configuration I am using in the
<database-connections> section:

<data-source name="jdbc/db"
class="org.apache.james.util.dbcp.JdbcDataSource">
	<driver>com.mysql.jdbc.Driver</driver>
<dburl>jdbc:mysql://localhost/mirage?useUnicode=true&amp;characterEncodi
ng=UTF-8&amp;characterSetResults=UTF-8&amp;autoReconnect=true</dburl>
      <user>root</user>
      <password>trunk</password>
      <max>100</max>
</data-source>

1) The server is unable to start. It throws a huge stacktrace in which
the following section seems most relevant:
Caused by: java.sql.SQLException: Communication failure during
handshake. Is there a server running
on localhost:3306?
        at org.gjt.mm.mysql.MysqlIO.init(Unknown Source)
        at org.gjt.mm.mysql.Connection.connectionInit(Unknown Source)
        at org.gjt.mm.mysql.jdbc2.Connection.connectionInit(Unknown
Source)
        at org.gjt.mm.mysql.Driver.connect(Unknown Source)
        at
org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverC
onnectionFactory.
java:37)
        at
org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableCon
nectionFactory.ja
va:290)
        at
org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicD
ataSource.java:87
7)
        at
org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource
.java:851)
        ... 28 more

I am quite sure the database server is working fine since other my
Tomcat is able to connect with the same URL.

2) No matter what driver you specify, it used the default MySQL driver
that ships with JAMES. Is using the default MySQL driver necessary?

Waiting for answers.

Thanks a lot.
Santosh.


---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org


Re: Problem configuring the DataSource

Posted by Philip Tomlinson <ph...@pot.co.nz>.
Hi,

I recently had the same problem.

I think your probably using an old mysql jdbc client driver.

I turned on mysqld logging via --log=mysql.log and found that mysql was 
rejecting the client connection because it was using old 4.1 passwords 
and not the new passwords.

I did a google search on this error message and came up with a nice 
article describing how to get arround this.  However I eventually just 
replaced the mm.myql-2.0.14.jar with a newer
mysql-connector-java-3.0.17-ga.bin.jar and this solved the problem.

Rgds,
Phil


Santosh wrote:
> Hi Everyone,
>
> I am trying configure a DataSource for connecting to a database other
> than "mail". Following is the configuration I am using in the
> <database-connections> section:
>
> <data-source name="jdbc/db"
> class="org.apache.james.util.dbcp.JdbcDataSource">
> 	<driver>com.mysql.jdbc.Driver</driver>
> <dburl>jdbc:mysql://localhost/mirage?useUnicode=true&amp;characterEncodi
> ng=UTF-8&amp;characterSetResults=UTF-8&amp;autoReconnect=true</dburl>
>       <user>root</user>
>       <password>trunk</password>
>       <max>100</max>
> </data-source>
>
> 1) The server is unable to start. It throws a huge stacktrace in which
> the following section seems most relevant:
> Caused by: java.sql.SQLException: Communication failure during
> handshake. Is there a server running
> on localhost:3306?
>         at org.gjt.mm.mysql.MysqlIO.init(Unknown Source)
>         at org.gjt.mm.mysql.Connection.connectionInit(Unknown Source)
>         at org.gjt.mm.mysql.jdbc2.Connection.connectionInit(Unknown
> Source)
>         at org.gjt.mm.mysql.Driver.connect(Unknown Source)
>         at
> org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverC
> onnectionFactory.
> java:37)
>         at
> org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableCon
> nectionFactory.ja
> va:290)
>         at
> org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicD
> ataSource.java:87
> 7)
>         at
> org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource
> .java:851)
>         ... 28 more
>
> I am quite sure the database server is working fine since other my
> Tomcat is able to connect with the same URL.
>
> 2) No matter what driver you specify, it used the default MySQL driver
> that ships with JAMES. Is using the default MySQL driver necessary?
>
> Waiting for answers.
>
> Thanks a lot.
> Santosh.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
> For additional commands, e-mail: server-user-help@james.apache.org
>
>
>
>
>
>
>
>   




---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org


Re: getting mail context from another thread

Posted by Stefano Bagnara <ap...@bago.org>.
Philip Tomlinson wrote:
> Hi,
> How can I get a MailContext from another thread other than a spool thread.
> 
> I have a scheduler which calls back in a separate thread of execution 
> and from this thread
> I want to be able to send an email.

You have to work with the assembly.xml

Add the dependency "org.apache.mailet.MailetContext" to your scheduler 
component (it is provided by the James block).

You can then simply use the ServiceManager (in your component service() 
method) to lookup the MailetContext.

You have to add the dependency by declaring it in your component .xinfo 
file.

Stefano


---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org


getting mail context from another thread

Posted by Philip Tomlinson <ph...@pot.co.nz>.
Hi,
How can I get a MailContext from another thread other than a spool thread.

I have a scheduler which calls back in a separate thread of execution 
and from this thread
I want to be able to send an email.

Rgds,
Phil






---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org