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 Russell E Glaue <rg...@cait.org> on 2005/03/25 19:01:47 UTC

mailstore SQL Error: Specified key was too long; max key length is 1000 bytes

Okay I have looked everywhere, and cannot find an answer.
Someone please assist.

I have installed, MySQL 4.1.10
I tried both mysql drivers: 3.0.16 and 3.1.7
I am using 'java version 1.5.0_02' and 'james 2.2.20'

I have gone over the configuration to make sure evey database setting is 
correct.
I know that James can connect to the MySQL server.
However, on initial start up using MySQL as the storage repository, when 
james attempts to create the database tables for mail store, I get this 
error:

java.sql.SQLException: Specified key was too long; max key length is 
1000 bytes

with log setting to debug, the mailstore log states this error occurs 
when trying to create the table.


Is someone able to explain what the problem is?
I know that James is compatible with MySQL 4.1 because I have read other 
posts of people using James with MySQL 4.1.

below is the logs.

-RG

* output executing bin/run.sh *
org.apache.excalibur.containerkit.lifecycle.LifecycleException: 
Component named "mailstore" failed to pass through the Initialization 
stage. (Reason: 
org.apache.avalon.framework.component.ComponentException: Cannot find or 
init repository).
         at 
org.apache.excalibur.containerkit.lifecycle.LifecycleHelper.fail(LifecycleHelper.java:289)
         at 
org.apache.excalibur.containerkit.lifecycle.LifecycleHelper.startup(LifecycleHelper.java:159)
         at 
org.apache.avalon.phoenix.components.application.DefaultApplication.startup(DefaultApplication.java:480)
... YADA snip, snip ...
Caused by: org.apache.avalon.framework.component.ComponentException: 
Cannot find or init repository
         at 
org.apache.james.core.AvalonMailStore.select(AvalonMailStore.java:318)
         at 
org.apache.james.core.AvalonMailStore.initialize(AvalonMailStore.java:129)
         at 
org.apache.avalon.framework.container.ContainerUtil.initialize(ContainerUtil.java:235)
         at 
org.apache.excalibur.containerkit.lifecycle.LifecycleHelper.startup(LifecycleHelper.java:144)
         ... 22 more
Caused by: java.sql.SQLException: Specified key was too long; max key 
length is 1000 bytes
         at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2847)
         at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1531)
         at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1622)
         at com.mysql.jdbc.Connection.execSQL(Connection.java:2376)
         at com.mysql.jdbc.Connection.execSQL(Connection.java:2297)
         at 
com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1860)
         at 
com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1494)
         at 
org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:168)
         at 
org.apache.james.mailrepository.JDBCMailRepository.initialize(JDBCMailRepository.java:371)
         at 
org.apache.james.core.AvalonMailStore.select(AvalonMailStore.java:300)
         ... 25 more


~james/logs/mailstore.log

25/03/05 11:47:32 INFO  mailstore: JamesMailStore init...
25/03/05 11:47:32 INFO  mailstore: Registering Repository instance of 
class org.apache.james.mailrepository.AvalonMailRepository to handle 
$25/03/05 11:47:32 INFO  mailstore: Registering Repository instance of 
class org.apache.james.mailrepository.AvalonSpoolRepository to 
handle$25/03/05 11:47:32 INFO  mailstore: Registering Repository 
instance of class org.apache.james.mailrepository.JDBCMailRepository to 
handle db$25/03/05 11:47:32 INFO  mailstore: Registering Repository 
instance of class org.apache.james.mailrepository.JDBCSpoolRepository to 
handle d$25/03/05 11:47:32 INFO  mailstore: Registering Repository 
instance of class org.apache.james.mailrepository.JDBCMailRepository to 
handle db$25/03/05 11:47:32 INFO  mailstore: Registering Repository 
instance of class org.apache.james.mailrepository.JDBCSpoolRepository to 
handle d$25/03/05 11:47:32 INFO  mailstore: Registering Repository 
instance of class org.apache.james.mailrepository.MBoxMailRepository to 
handle mb$25/03/05 11:47:32 DEBUG mailstore: obtained repository: 
org.apache.james.mailrepository.JDBCSpoolRepository to handle: db,SPOOL
25/03/05 11:47:32 DEBUG mailstore: 
org.apache.james.mailrepository.JDBCSpoolRepository.compose()
25/03/05 11:47:32 DEBUG mailstore: 
org.apache.james.mailrepository.JDBCSpoolRepository.configure()
25/03/05 11:47:32 DEBUG mailstore: Parsed URL: table = 'spool', 
repositoryName = 'spool'
25/03/05 11:47:32 DEBUG mailstore: 
org.apache.james.mailrepository.JDBCSpoolRepository created according to 
db://maildb/spool/spool/
25/03/05 11:47:32 DEBUG mailstore: 
org.apache.james.mailrepository.JDBCSpoolRepository.initialize()
25/03/05 11:47:33 DEBUG mailstore: Reading SQL resources from file: 
/usr/local/james-2.2.0/apps/james/conf/sqlResources.xml, section 
org.ap$25/03/05 11:47:33 WARN  mailstore: Exception while creating 
repository:Specified key was too long; max key length is 1000 bytes
java.sql.SQLException: Specified key was too long; max key length is 
1000 bytes
         at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2847)
         at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1531)
         at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1622)
         at com.mysql.jdbc.Connection.execSQL(Connection.java:2376)
         at com.mysql.jdbc.Connection.execSQL(Connection.java:2297)
         at 
com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1860)
         at 
com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1494)
         at 
org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:168)
         at 
org.apache.james.mailrepository.JDBCMailRepository.initialize(JDBCMailRepository.java:371)
         at 
org.apache.james.core.AvalonMailStore.select(AvalonMailStore.java:300)
         at 
org.apache.james.core.AvalonMailStore.initialize(AvalonMailStore.java:129)
         at 
org.apache.avalon.framework.container.ContainerUtil.initialize(ContainerUtil.java:235)
         at 
org.apache.excalibur.containerkit.lifecycle.LifecycleHelper.startup(LifecycleHelper.java:144)
         at 
org.apache.avalon.phoenix.components.application.DefaultApplication.startup(DefaultApplication.java:480)
         at 
org.apache.avalon.phoenix.components.application.DefaultApplication.doRunPhase(DefaultApplication.java:428)
         at 
org.apache.avalon.phoenix.components.application.DefaultApplication.runPhase(DefaultApplication.java:364)
         at 
org.apache.avalon.phoenix.components.application.DefaultApplication.start(DefaultApplication.java:138)
         at 
org.apache.avalon.framework.container.ContainerUtil.start(ContainerUtil.java:251)
         at 
org.apache.avalon.phoenix.components.kernel.DefaultKernel.startup(DefaultKernel.java:178)
         at 
org.apache.avalon.phoenix.components.kernel.DefaultKernel.addApplication(DefaultKernel.java:254)
         at 
org.apache.avalon.phoenix.components.deployer.DefaultDeployer.deploy(DefaultDeployer.java:353)
         at 
org.apache.avalon.phoenix.components.embeddor.DefaultEmbeddor.deployFile(DefaultEmbeddor.java:498)
         at 
org.apache.avalon.phoenix.components.embeddor.DefaultEmbeddor.deployFile(DefaultEmbeddor.java:491)
         at 
org.apache.avalon.phoenix.components.embeddor.DefaultEmbeddor.deployFiles(DefaultEmbeddor.java:476)
         at 
org.apache.avalon.phoenix.components.embeddor.DefaultEmbeddor.deployDefaultApplications(DefaultEmbeddor.java:466)
         at 
org.apache.avalon.phoenix.components.embeddor.DefaultEmbeddor.execute(DefaultEmbeddor.java:224)
         at 
org.apache.avalon.phoenix.frontends.CLIMain.run(CLIMain.java:158)
         at 
org.apache.avalon.phoenix.frontends.CLIMain.execute(CLIMain.java:144)
         at 
org.apache.avalon.phoenix.frontends.CLIMain.main(CLIMain.java:102)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at org.apache.avalon.phoenix.launcher.Main.startup(Main.java:94)
         at org.apache.avalon.phoenix.launcher.Main.main(Main.java:46)
25/03/05 11:47:33 ERROR mailstore: Cannot open private SpoolRepository




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


Re: mailstore SQL Error: Specified key was too long; max key length is 1000 bytes

Posted by Serge Knystautas <se...@lokitech.com>.
On Fri, 25 Mar 2005 15:42:50 -0600
  Russell E Glaue <rg...@cait.org> wrote:
> Ya, well I tried all this. Except for actually running 
>the SQL statement in MySQL separately. I could not 
>discover what SQL state was giving the problem.

Thanks for your patience, and I'm glad you got it working 
against 4.0.  I would encourage you to try actually 
running the SQL statement in MySQL 4.1 separately.  Here 
is the sqlResources.xml in SVN:

http://svn.apache.org/viewcvs.cgi/james/server/branches/branch_2_1_fcs/src/conf/sqlResources.xml?rev=109137&view=markup

You'll see the create logic is:

         CREATE TABLE ${table} (
             message_name varchar (200) NOT NULL,
             repository_name varchar (255) NOT NULL,
             message_state varchar (30) NOT NULL ,
             error_message varchar (200) NULL ,
             sender varchar (255) NULL ,
             recipients text NOT NULL ,
             remote_host varchar (255) NOT NULL ,
             remote_addr varchar (20) NOT NULL ,
             message_body longblob NOT NULL ,
             message_attributes longblob NULL ,
             last_updated datetime NOT NULL,
             PRIMARY KEY (repository_name, message_name)

where $(table) is based on your 
db://<databasepool>/<table>/ string.  I was thinking maybe 
it was some weird double-byte issue, but looking at the 
create script, 200+255 = 455, so even if we had mistakenly 
used double-bytes, that's 455 x 2 < 1000.

I'll try to test MySQL 4.1 with that statement at some 
point.  I'm still using 4.0 though primarily.

--
Serge Knystautas

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


Re: mailstore SQL Error: Specified key was too long; max key length is 1000 bytes

Posted by Vincenzo Gianferrari Pini <vi...@praxis.it>.
I'm using MySQL 5.0.1-alpha, using db:// configuration, and I don't have 
any problems.

Vincenzo

Russell E Glaue wrote:

> Ya, well I tried all this. Except for actually running the SQL 
> statement in MySQL separately. I could not discover what SQL state was 
> giving the problem.
> I turned DEBUG on for logging, but it is not verbose enough about the 
> communication to MySQL. That should be changed so to record what JAMES 
> is actually saying to MySQL. Right now JAMES is only records what 
> MySQL is saying to it.
>
> Well what I did do was look over every "CREATE TABLE" sql statement to 
> make sure they were all correct. And they all are. They are all fine.
>
> What I ended up doing was downgrading to MySQL 4.0.27. When I 
> downgraded to this version, using the JDBC driver mysql-jdbc-3.1.7, 
> JAMES will initialize the MySQL database without error. And it runs fine.
>
> So this tells me that JAMES is not fully compatible with MySQL 4.1.x. 
> I know everyone may want to disagree.
> Now I know JAMES partially works with MySQL 4.1 because I read another 
> posting where someone was using it for dbfile:// configuration.
> Since I am using this for a db:// configuration, and the mailstore is 
> the one being complained about, I would assume that JAMES is not 
> compatible with MySQL 4.1 100%, mainly with mailstore initialization.
>
> So, Is this is a bug that will need to be addressed?
> Would one of the developers like to quickly try JAMES with mysql 
> 4.1.10 and report back on their experience? Make sure you configure 
> JAMES to use MySQL for all storage, using db:// configuration.
>
> -RG
>
>
>
> Serge Knystautas wrote:
>
>> On Fri, 25 Mar 2005 12:01:47 -0600
>>  Russell E Glaue <rg...@cait.org> wrote:
>>
>>> java.sql.SQLException: Specified key was too long; max key length is 
>>> 1000 bytes
>>
>>
>>
>> Hmm, that is weird.  I'm only using MySQL 4.0, but I can't imagine 
>> this being a problem with the point release.  What I might suggest is 
>> opening sqlResources.xml, finding the SQL statement that gets run 
>> (hopefully file is obvious enough), and running it in a MySQL tool.  
>> Hopefully you'll get a bit more information about why that is 
>> failing.  You might also check the mysql docs on the off-chance they 
>> have more information about that error message.
>>
>> -- 
>> Serge Knystautas
>>
>> ---------------------------------------------------------------------
>> 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
>
>

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


Re: mailstore SQL Error: Specified key was too long; max key length is 1000 bytes

Posted by Russell E Glaue <rg...@cait.org>.
Ya, well I tried all this. Except for actually running the SQL statement 
in MySQL separately. I could not discover what SQL state was giving the 
problem.
I turned DEBUG on for logging, but it is not verbose enough about the 
communication to MySQL. That should be changed so to record what JAMES 
is actually saying to MySQL. Right now JAMES is only records what MySQL 
is saying to it.

Well what I did do was look over every "CREATE TABLE" sql statement to 
make sure they were all correct. And they all are. They are all fine.

What I ended up doing was downgrading to MySQL 4.0.27. When I downgraded 
to this version, using the JDBC driver mysql-jdbc-3.1.7, JAMES will 
initialize the MySQL database without error. And it runs fine.

So this tells me that JAMES is not fully compatible with MySQL 4.1.x. I 
know everyone may want to disagree.
Now I know JAMES partially works with MySQL 4.1 because I read another 
posting where someone was using it for dbfile:// configuration.
Since I am using this for a db:// configuration, and the mailstore is 
the one being complained about, I would assume that JAMES is not 
compatible with MySQL 4.1 100%, mainly with mailstore initialization.

So, Is this is a bug that will need to be addressed?
Would one of the developers like to quickly try JAMES with mysql 4.1.10 
and report back on their experience? Make sure you configure JAMES to 
use MySQL for all storage, using db:// configuration.

-RG



Serge Knystautas wrote:
> On Fri, 25 Mar 2005 12:01:47 -0600
>  Russell E Glaue <rg...@cait.org> wrote:
> 
>> java.sql.SQLException: Specified key was too long; max key length is 
>> 1000 bytes
> 
> 
> Hmm, that is weird.  I'm only using MySQL 4.0, but I can't imagine this 
> being a problem with the point release.  What I might suggest is opening 
> sqlResources.xml, finding the SQL statement that gets run (hopefully 
> file is obvious enough), and running it in a MySQL tool.  Hopefully 
> you'll get a bit more information about why that is failing.  You might 
> also check the mysql docs on the off-chance they have more information 
> about that error message.
> 
> -- 
> Serge Knystautas
> 
> ---------------------------------------------------------------------
> 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: mailstore SQL Error: Specified key was too long; max key length is 1000 bytes

Posted by Serge Knystautas <se...@lokitech.com>.
On Fri, 25 Mar 2005 12:01:47 -0600
  Russell E Glaue <rg...@cait.org> wrote:
> java.sql.SQLException: Specified key was too long; max 
>key length is 1000 bytes

Hmm, that is weird.  I'm only using MySQL 4.0, but I can't 
imagine this being a problem with the point release.  What 
I might suggest is opening sqlResources.xml, finding the 
SQL statement that gets run (hopefully file is obvious 
enough), and running it in a MySQL tool.  Hopefully you'll 
get a bit more information about why that is failing.  You 
might also check the mysql docs on the off-chance they 
have more information about that error message.

--
Serge Knystautas

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