james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Frank Herrmann <herrmann_fr...@yahoo.com>
Subject 2.03->2.1.1 mysql-db access problem (long!)
Date Thu, 20 Mar 2003 18:34:37 GMT
Hi everybody,

I developed a mailet with James V2.03 and cant get it
to work with 2.1.1. This thing really kept me busy 
several hours without finding a solution. I hope
someone can give me a hint:

The section in config.xml is:

<!-- MYSQL -->
         <data-source name="james"
class="org.apache.james.util.mordred.JdbcDataSource">
            <driver>org.gjt.mm.mysql.Driver</driver>
           
<dburl>jdbc:mysql://127.0.0.1/james</dburl>
            <user>user</user>
            <password>correctpassword</password>
            <max>20</max>
         </data-source>

I initialize the datasource with:

  try {

            /* get reference to Avalon component
manager */
            ComponentManager componentManager =
(ComponentManager)getMailetContext().getAttribute(Constants.AVALON_COMPONENT_MANAGER);

            /* get list of possible data sources */

            if (_DEBUG_SQL)
System.out.println("(ContentMailet) #init# using
componentmanager " + componentManager);

            datasources =
(DataSourceSelector)componentManager.lookup(DataSourceSelector.ROLE);

The init debug message of my mailet prints:

(Mailet) #init# using componentmanager
Components:[org.apache.james.services.MailServer][org.apache.james.services.UsersRepository]
(Mailet) #init# using datasource
org.apache.james.util.mordred.JdbcDataSource@888e6c

so this seems ok.

As the mailet tries to do something with the
datasource "james":

         /* lookup login name in database */
            if (_DEBUG_SQL)
System.out.println("#service# looking up login name
for address "+recipEmailAddress);
            sql="SELECT * FROM subscribers WHERE
email=?;";
            prstmt = conn.prepareStatement(sql);
...
...

My mailet shows:

exception! javax.mail.MessagingException:
(ContentMailet) #service# sql exception
java.sql.SQLException: Giving up... no connections
available.;
  nested exception is:
        java.sql.SQLException: Giving up... no
connections available.

Here is the output of the default-logfile:

20/03/03 18:00:50 INFO  database-connections:
DataSource james ready
20/03/03 18:01:24 ERROR database-connections.james:
Error creating connection:
java.sql.SQLException: Cannot connect to MySQL server
on 127.0.0.1:3306. Is there a MySQL server running on
the machine/port you are trying t
        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
java.sql.DriverManager.getConnection(DriverManager.java:512)
        at
java.sql.DriverManager.getConnection(DriverManager.java:171)
        at
org.apache.james.util.mordred.JdbcDataSource.createConn(JdbcDataSource.java:479)
        at
org.apache.james.util.mordred.JdbcDataSource.getConnection(JdbcDataSource.java:155)
        at
ContentMailet.service(ContentMailet.java:140)
        at
org.apache.james.transport.LinearProcessor.service(LinearProcessor.java:362)
        at
org.apache.james.transport.JamesSpoolManager.process(JamesSpoolManager.java:385)
        at
org.apache.james.transport.JamesSpoolManager.run(JamesSpoolManager.java:315)
        at
org.apache.avalon.excalibur.thread.impl.ExecutableRunnable.execute(ExecutableRunnable.java:47)
        at
org.apache.avalon.excalibur.thread.impl.WorkerThread.run(WorkerThread.java:80)

But MySQL DOES run:

mysql -u user -p shows:

Your MySQL connection id is 53 to server version:
3.23.51-log

Type 'help;' or '\h' for help. Type '\c' to clear the
buffer.

mysql>

The database is created:

mysql> use james;
Reading table information for completion of table and
column names
You can turn off this feature to get a quicker startup
with -A

Database changed
mysql> show tables;
+------------------+
| Tables_in_james  |
+------------------+
| subscribers      |
+------------------+
3 rows in set (0.00 sec)


What is going on here ? What else can I try ?

Thanks for reading,
Frank Herrmann




__________________________________________________
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com

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


Mime
View raw message