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 Marc Chamberlin <ma...@marcchamberlin.com> on 2019/01/04 07:38:41 UTC

A MySQL connection setup issue

(Thanks Benoit, Saibabu, and Simon for taking the time/trouble to answer
my previous question on MySQL. It helped a lot!)

I have managed to get a little further setting up James 3.2.0 Spring
with MySQL/MariaDB but have ran into a problem which Google is not being
helpful.

I appear to be having troubles with getting a connection going between
James and the MariaDB server. I will provide a description of what I
have done and then I will show the exception message I am getting which
is stopping James from starting up...

First of all I downloaded the MariaDB Connector/J .jar file from
https://downloads.mariadb.org/connector-java/ and installed it in the
conf/lib directory within the James installation.

I then set up a database and user in MariaDB as follows -

> mysql --user=root -p

MariaDB [mysql]> create database mail;
MariaDB [mysql]> create user 'james'@'localhost' identified by 'apassword';
MariaDB [mysql]> grant all privileges on mail to 'james'@'localhost';

I also created a system user for james and assigned it the same password.

Next I edited the james-database.properties file as follows -

database.driverClassName=org.mariadb.jdbc.Driver
database.url=jdbc:mariadb://127.0.0.1:3306/mail
database.username=james
database.password=apassword
vendorAdapter.database=MYSQL
openjpa.streaming=false
datasource.testOnBorrow=true
datasource.validationQueryTimeoutSec=2
datasource.validationQuery=select 1

Telnetting to localhost port 3306 does show that the mariadb server is
responding but hard to say exactly what is being communicated because a
lot of the text has non-printable characters. I assume it is working OK...

Upon starting up James I am getting exceptions with a huge amount of
stack walkback messages, but I will try to capture just what appears to
be relevant -

INFO  22:03:05,852 | org.apache.james.domainlist.lib.AbstractDomainList
| Set autodetectIP to: true
WARN  22:03:06,000 |
org.apache.james.container.spring.context.JamesServerApplicationContext
| Exception encountered during context initial
ization - cancelling refresh attempt:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error
creating bean with name 'auth
enticator' defined in class path resource
[META-INF/org/apache/james/spring-mailbox-authenticator.xml]:
Unsatisfied dependency expressed th
rough constructor argument with index 0 of type
[org.apache.james.user.api.UsersRepository]: : Error creating bean with
name 'usersreposito
ry': Invocation of init method failed; nested exception is
<openjpa-3.0.0-r422266:1833209 nonfatal general error>
org.apache.openjpa.persis
tence.PersistenceException: There were errors initializing your
configuration: <openjpa-3.0.0-r422266:1833209 fatal user error> org.apache.
openjpa.util.UserException: A connection could not be obtained for
driver class "null" and URL "null".  You may have specified an invalid U
RL.
        at
org.apache.openjpa.jdbc.schema.DataSourceFactory.newConnectException(DataSourceFactory.java:272)
        at
org.apache.openjpa.jdbc.schema.DataSourceFactory.installDBDictionary(DataSourceFactory.java:258)
        at
org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getConnectionFactory(JDBCConfigurationImpl.java:735)
... (Lots more trace back messages followed by -)
Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create
PoolableConnectionFactory (Access denied for user 'james@localhost'@'l
ocalhost' (using password: YES))
        at
org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1549)
        at
org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388)
        at
org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)

and these exceptions/stack trace walkbacks repeat several time in the
log file. Kinda hard for this poor soul to grok and I sure would
appreciate it if wiser eyes could provide me with some ideas/pointers. I
would be willing to send the entire log file if that would help, but
warning it is a LOT! I am missing something simple probably....  Thanks
again in advance for helping me over this bump...

   Marc...



Linux Counter

Re: A MySQL connection setup issue

Posted by Marc Chamberlin <ma...@marcchamberlin.com>.
Hi Simon and thanks for your thoughts...  Yes my usersrepository.xml is 
the same as the one on github.  The only difference was that I was using 
the MD5 algorithm and the github was using SHA-512. On a lark I changed 
mine to SHA-512 also but no joy... I didn't really expect that to make a 
difference, but what the heck I gave it a shot... ;-) Marc..

On 1/4/19 3:24 AM, Simon Levesque wrote:
> Hi Marc,
>
> I am no James expert, but with the information here, since it is the
> UsersRepository that has issue, do you have a usersrepository.xml config
> with
> https://github.com/foilen/foilen-infra-plugins-core/blob/master/src/main/resources/com/foilen/infra/resource/email/james/usersrepository.xml
> ?
>
> HTH
>
> On Fri, 4 Jan 2019 at 02:39, Marc Chamberlin <ma...@marcchamberlin.com>
> wrote:
>
>> (Thanks Benoit, Saibabu, and Simon for taking the time/trouble to answer
>> my previous question on MySQL. It helped a lot!)
>>
>> I have managed to get a little further setting up James 3.2.0 Spring
>> with MySQL/MariaDB but have ran into a problem which Google is not being
>> helpful.
>>
>> I appear to be having troubles with getting a connection going between
>> James and the MariaDB server. I will provide a description of what I
>> have done and then I will show the exception message I am getting which
>> is stopping James from starting up...
>>
>> First of all I downloaded the MariaDB Connector/J .jar file from
>> https://downloads.mariadb.org/connector-java/ and installed it in the
>> conf/lib directory within the James installation.
>>
>> I then set up a database and user in MariaDB as follows -
>>
>>> mysql --user=root -p
>> MariaDB [mysql]> create database mail;
>> MariaDB [mysql]> create user 'james'@'localhost' identified by
>> 'apassword';
>> MariaDB [mysql]> grant all privileges on mail to 'james'@'localhost';
>>
>> I also created a system user for james and assigned it the same password.
>>
>> Next I edited the james-database.properties file as follows -
>>
>> database.driverClassName=org.mariadb.jdbc.Driver
>> database.url=jdbc:mariadb://127.0.0.1:3306/mail
>> database.username=james
>> database.password=apassword
>> vendorAdapter.database=MYSQL
>> openjpa.streaming=false
>> datasource.testOnBorrow=true
>> datasource.validationQueryTimeoutSec=2
>> datasource.validationQuery=select 1
>>
>> Telnetting to localhost port 3306 does show that the mariadb server is
>> responding but hard to say exactly what is being communicated because a
>> lot of the text has non-printable characters. I assume it is working OK...
>>
>> Upon starting up James I am getting exceptions with a huge amount of
>> stack walkback messages, but I will try to capture just what appears to
>> be relevant -
>>
>> INFO  22:03:05,852 | org.apache.james.domainlist.lib.AbstractDomainList
>> | Set autodetectIP to: true
>> WARN  22:03:06,000 |
>> org.apache.james.container.spring.context.JamesServerApplicationContext
>> | Exception encountered during context initial
>> ization - cancelling refresh attempt:
>> org.springframework.beans.factory.UnsatisfiedDependencyException: Error
>> creating bean with name 'auth
>> enticator' defined in class path resource
>> [META-INF/org/apache/james/spring-mailbox-authenticator.xml]:
>> Unsatisfied dependency expressed th
>> rough constructor argument with index 0 of type
>> [org.apache.james.user.api.UsersRepository]: : Error creating bean with
>> name 'usersreposito
>> ry': Invocation of init method failed; nested exception is
>> <openjpa-3.0.0-r422266:1833209 nonfatal general error>
>> org.apache.openjpa.persis
>> tence.PersistenceException: There were errors initializing your
>> configuration: <openjpa-3.0.0-r422266:1833209 fatal user error> org.apache.
>> openjpa.util.UserException: A connection could not be obtained for
>> driver class "null" and URL "null".  You may have specified an invalid U
>> RL.
>>          at
>>
>> org.apache.openjpa.jdbc.schema.DataSourceFactory.newConnectException(DataSourceFactory.java:272)
>>          at
>>
>> org.apache.openjpa.jdbc.schema.DataSourceFactory.installDBDictionary(DataSourceFactory.java:258)
>>          at
>>
>> org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getConnectionFactory(JDBCConfigurationImpl.java:735)
>> ... (Lots more trace back messages followed by -)
>> Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create
>> PoolableConnectionFactory (Access denied for user 'james@localhost'@'l
>> ocalhost' (using password: YES))
>>          at
>>
>> org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1549)
>>          at
>>
>> org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388)
>>          at
>>
>> org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
>>
>> and these exceptions/stack trace walkbacks repeat several time in the
>> log file. Kinda hard for this poor soul to grok and I sure would
>> appreciate it if wiser eyes could provide me with some ideas/pointers. I
>> would be willing to send the entire log file if that would help, but
>> warning it is a LOT! I am missing something simple probably....  Thanks
>> again in advance for helping me over this bump...
>>
>>     Marc...
>>
>>
>>
>> Linux Counter
>>


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


Re: A MySQL connection setup issue

Posted by Simon Levesque <si...@simonlevesque.com>.
Hi Marc,

I am no James expert, but with the information here, since it is the
UsersRepository that has issue, do you have a usersrepository.xml config
with
https://github.com/foilen/foilen-infra-plugins-core/blob/master/src/main/resources/com/foilen/infra/resource/email/james/usersrepository.xml
?

HTH

On Fri, 4 Jan 2019 at 02:39, Marc Chamberlin <ma...@marcchamberlin.com>
wrote:

> (Thanks Benoit, Saibabu, and Simon for taking the time/trouble to answer
> my previous question on MySQL. It helped a lot!)
>
> I have managed to get a little further setting up James 3.2.0 Spring
> with MySQL/MariaDB but have ran into a problem which Google is not being
> helpful.
>
> I appear to be having troubles with getting a connection going between
> James and the MariaDB server. I will provide a description of what I
> have done and then I will show the exception message I am getting which
> is stopping James from starting up...
>
> First of all I downloaded the MariaDB Connector/J .jar file from
> https://downloads.mariadb.org/connector-java/ and installed it in the
> conf/lib directory within the James installation.
>
> I then set up a database and user in MariaDB as follows -
>
> > mysql --user=root -p
>
> MariaDB [mysql]> create database mail;
> MariaDB [mysql]> create user 'james'@'localhost' identified by
> 'apassword';
> MariaDB [mysql]> grant all privileges on mail to 'james'@'localhost';
>
> I also created a system user for james and assigned it the same password.
>
> Next I edited the james-database.properties file as follows -
>
> database.driverClassName=org.mariadb.jdbc.Driver
> database.url=jdbc:mariadb://127.0.0.1:3306/mail
> database.username=james
> database.password=apassword
> vendorAdapter.database=MYSQL
> openjpa.streaming=false
> datasource.testOnBorrow=true
> datasource.validationQueryTimeoutSec=2
> datasource.validationQuery=select 1
>
> Telnetting to localhost port 3306 does show that the mariadb server is
> responding but hard to say exactly what is being communicated because a
> lot of the text has non-printable characters. I assume it is working OK...
>
> Upon starting up James I am getting exceptions with a huge amount of
> stack walkback messages, but I will try to capture just what appears to
> be relevant -
>
> INFO  22:03:05,852 | org.apache.james.domainlist.lib.AbstractDomainList
> | Set autodetectIP to: true
> WARN  22:03:06,000 |
> org.apache.james.container.spring.context.JamesServerApplicationContext
> | Exception encountered during context initial
> ization - cancelling refresh attempt:
> org.springframework.beans.factory.UnsatisfiedDependencyException: Error
> creating bean with name 'auth
> enticator' defined in class path resource
> [META-INF/org/apache/james/spring-mailbox-authenticator.xml]:
> Unsatisfied dependency expressed th
> rough constructor argument with index 0 of type
> [org.apache.james.user.api.UsersRepository]: : Error creating bean with
> name 'usersreposito
> ry': Invocation of init method failed; nested exception is
> <openjpa-3.0.0-r422266:1833209 nonfatal general error>
> org.apache.openjpa.persis
> tence.PersistenceException: There were errors initializing your
> configuration: <openjpa-3.0.0-r422266:1833209 fatal user error> org.apache.
> openjpa.util.UserException: A connection could not be obtained for
> driver class "null" and URL "null".  You may have specified an invalid U
> RL.
>         at
>
> org.apache.openjpa.jdbc.schema.DataSourceFactory.newConnectException(DataSourceFactory.java:272)
>         at
>
> org.apache.openjpa.jdbc.schema.DataSourceFactory.installDBDictionary(DataSourceFactory.java:258)
>         at
>
> org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getConnectionFactory(JDBCConfigurationImpl.java:735)
> ... (Lots more trace back messages followed by -)
> Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create
> PoolableConnectionFactory (Access denied for user 'james@localhost'@'l
> ocalhost' (using password: YES))
>         at
>
> org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1549)
>         at
>
> org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388)
>         at
>
> org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
>
> and these exceptions/stack trace walkbacks repeat several time in the
> log file. Kinda hard for this poor soul to grok and I sure would
> appreciate it if wiser eyes could provide me with some ideas/pointers. I
> would be willing to send the entire log file if that would help, but
> warning it is a LOT! I am missing something simple probably....  Thanks
> again in advance for helping me over this bump...
>
>    Marc...
>
>
>
> Linux Counter
>

Re: A MySQL connection setup issue

Posted by Garry Hurley <ga...@gmail.com>.
One other thing. While there are entries in wrapper.conf to allow you to add files to the classpath, ONLY the lib folder is valid in James, so all of your jar files - including the sql files and any custom jars - MUST be in [JAMES_INSTALL_PATH]/lib and not some subdirectory. Even if you point to the jar file in your james.database.properties file, it won’t be seen. And no symbolic links. James is very picky about that for some reason. 

Sent from my iPhone

> On Jan 4, 2019, at 3:52 PM, Marc Chamberlin <ma...@marcchamberlin.com> wrote:
> 
> Hi Garry, and thanks for your thoughts also... Still no joy however...  The vendor class (database.driverClassName) in my configuration is the same as what you show here. Ditto for all the other parameters except for the database.url. I created a database called mail (not maildb) in MariaDB so I adjusted the declaration to -
> 
> database.url=jdbc:mariadb://localhost:3306/mail
> 
> I won't get into the politics/religion over distros, I worship the gods of OpenSUSE myself, so no I don't have a rc.mysqld file to poke at, but I do have a my.cnf file and within it there is a parameter to skip networking, which is commented out. (If uncommented, according to the comments in the file, then only socket connections would be allowed and all TCP/IP port connections disabled.)
> 
>   Marc...
> 
> 
> 
>> On 1/4/19 6:16 AM, Garry Hurley wrote:
>> The vendor class on the driver is supposed to match, but also be
>> certain you are using Mariadb and not MySQL database and MariaDB
>> client in your Linux distro. My config, which does work in the current
>> branch (3.3.0 SNAPSHOT), is as follows.  It goes without saying that
>> your mileage my vary, and that I am using Slackware Linux, so your
>> mileage may vary.
>> 
>> ...
>> # Use derby as default
>> database.driverClassName=org.mariadb.jdbc.Driver
>> database.url=jdbc:mariadb://localhost:3306/maildb
>> database.username=james
>> database.password=<your password>
>> 
>> # Supported adapters are:
>> # DB2, DERBY, H2, HSQL, INFORMIX, MYSQL, ORACLE, POSTGRESQL, SQL_SERVER, SYBASE
>> vendorAdapter.database=MYSQL
>> 
>> ...
>> 
>> 
>> Make sure, however, that your database is configured to allow network
>> connections.  Change your rc.mysqld (or comparable one if your Linux
>> distro is inferior to Slackware ;) ) script to read as follows:
>> ...
>> # To allow outside connections to the database comment out the next line.
>> # If you don't need incoming network connections, then leave the line
>> # uncommented to improve system security.
>> #SKIP="--skip-networking"
>> ...
>> 
>> 
>>> On Jan 4, 2019, at 6:47 AM, Saibabu Vallurupalli <sa...@gmail.com> wrote:
>>> 
>>> your configurations are incorrect is what the error shows and I see
>>> you have got:
>>> 
>>> vendorAdapter.database=MYSQL
>>> 
>>> This should be :
>>> vendorAdapter.database=MARIADB
>>> 
>>> Try changing this.
>>> 
>>> Thanks,
>>> Sai
>>> 
>>>> On Fri, Jan 4, 2019 at 2:39 AM Marc Chamberlin <ma...@marcchamberlin.com> wrote:
>>>> 
>>>> (Thanks Benoit, Saibabu, and Simon for taking the time/trouble to answer
>>>> my previous question on MySQL. It helped a lot!)
>>>> 
>>>> I have managed to get a little further setting up James 3.2.0 Spring
>>>> with MySQL/MariaDB but have ran into a problem which Google is not being
>>>> helpful.
>>>> 
>>>> I appear to be having troubles with getting a connection going between
>>>> James and the MariaDB server. I will provide a description of what I
>>>> have done and then I will show the exception message I am getting which
>>>> is stopping James from starting up...
>>>> 
>>>> First of all I downloaded the MariaDB Connector/J .jar file from
>>>> https://downloads.mariadb.org/connector-java/ and installed it in the
>>>> conf/lib directory within the James installation.
>>>> 
>>>> I then set up a database and user in MariaDB as follows -
>>>> 
>>>>> mysql --user=root -p
>>>> MariaDB [mysql]> create database mail;
>>>> MariaDB [mysql]> create user 'james'@'localhost' identified by 'apassword';
>>>> MariaDB [mysql]> grant all privileges on mail to 'james'@'localhost';
>>>> 
>>>> I also created a system user for james and assigned it the same password.
>>>> 
>>>> Next I edited the james-database.properties file as follows -
>>>> 
>>>> database.driverClassName=org.mariadb.jdbc.Driver
>>>> database.url=jdbc:mariadb://127.0.0.1:3306/mail
>>>> database.username=james
>>>> database.password=apassword
>>>> vendorAdapter.database=MYSQL
>>>> openjpa.streaming=false
>>>> datasource.testOnBorrow=true
>>>> datasource.validationQueryTimeoutSec=2
>>>> datasource.validationQuery=select 1
>>>> 
>>>> Telnetting to localhost port 3306 does show that the mariadb server is
>>>> responding but hard to say exactly what is being communicated because a
>>>> lot of the text has non-printable characters. I assume it is working OK...
>>>> 
>>>> Upon starting up James I am getting exceptions with a huge amount of
>>>> stack walkback messages, but I will try to capture just what appears to
>>>> be relevant -
>>>> 
>>>> INFO  22:03:05,852 | org.apache.james.domainlist.lib.AbstractDomainList
>>>> | Set autodetectIP to: true
>>>> WARN  22:03:06,000 |
>>>> org.apache.james.container.spring.context.JamesServerApplicationContext
>>>> | Exception encountered during context initial
>>>> ization - cancelling refresh attempt:
>>>> org.springframework.beans.factory.UnsatisfiedDependencyException: Error
>>>> creating bean with name 'auth
>>>> enticator' defined in class path resource
>>>> [META-INF/org/apache/james/spring-mailbox-authenticator.xml]:
>>>> Unsatisfied dependency expressed th
>>>> rough constructor argument with index 0 of type
>>>> [org.apache.james.user.api.UsersRepository]: : Error creating bean with
>>>> name 'usersreposito
>>>> ry': Invocation of init method failed; nested exception is
>>>> <openjpa-3.0.0-r422266:1833209 nonfatal general error>
>>>> org.apache.openjpa.persis
>>>> tence.PersistenceException: There were errors initializing your
>>>> configuration: <openjpa-3.0.0-r422266:1833209 fatal user error> org.apache.
>>>> openjpa.util.UserException: A connection could not be obtained for
>>>> driver class "null" and URL "null".  You may have specified an invalid U
>>>> RL.
>>>>        at
>>>> org.apache.openjpa.jdbc.schema.DataSourceFactory.newConnectException(DataSourceFactory.java:272)
>>>>        at
>>>> org.apache.openjpa.jdbc.schema.DataSourceFactory.installDBDictionary(DataSourceFactory.java:258)
>>>>        at
>>>> org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getConnectionFactory(JDBCConfigurationImpl.java:735)
>>>> ... (Lots more trace back messages followed by -)
>>>> Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create
>>>> PoolableConnectionFactory (Access denied for user 'james@localhost'@'l
>>>> ocalhost' (using password: YES))
>>>>        at
>>>> org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1549)
>>>>        at
>>>> org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388)
>>>>        at
>>>> org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
>>>> 
>>>> and these exceptions/stack trace walkbacks repeat several time in the
>>>> log file. Kinda hard for this poor soul to grok and I sure would
>>>> appreciate it if wiser eyes could provide me with some ideas/pointers. I
>>>> would be willing to send the entire log file if that would help, but
>>>> warning it is a LOT! I am missing something simple probably....  Thanks
>>>> again in advance for helping me over this bump...
>>>> 
>>>>   Marc...
>>>> 
>>>> 
>>>> 
>>>> Linux Counter
>>> ---------------------------------------------------------------------
>>> 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
> 

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


Re: A MySQL connection setup issue

Posted by Marc Chamberlin <ma...@marcchamberlin.com>.
Hi Garry, and thanks for your thoughts also... Still no joy however...  
The vendor class (database.driverClassName) in my configuration is the 
same as what you show here. Ditto for all the other parameters except 
for the database.url. I created a database called mail (not maildb) in 
MariaDB so I adjusted the declaration to -

database.url=jdbc:mariadb://localhost:3306/mail

I won't get into the politics/religion over distros, I worship the gods of OpenSUSE myself, so no I don't have a rc.mysqld file to poke at, but I do have a my.cnf file and within it there is a parameter to skip networking, which is commented out. (If uncommented, according to the comments in the file, then only socket connections would be allowed and all TCP/IP port connections disabled.)

    Marc...



On 1/4/19 6:16 AM, Garry Hurley wrote:
> The vendor class on the driver is supposed to match, but also be
> certain you are using Mariadb and not MySQL database and MariaDB
> client in your Linux distro. My config, which does work in the current
> branch (3.3.0 SNAPSHOT), is as follows.  It goes without saying that
> your mileage my vary, and that I am using Slackware Linux, so your
> mileage may vary.
>
> ...
> # Use derby as default
> database.driverClassName=org.mariadb.jdbc.Driver
> database.url=jdbc:mariadb://localhost:3306/maildb
> database.username=james
> database.password=<your password>
>
> # Supported adapters are:
> # DB2, DERBY, H2, HSQL, INFORMIX, MYSQL, ORACLE, POSTGRESQL, SQL_SERVER, SYBASE
> vendorAdapter.database=MYSQL
>
> ...
>
>
> Make sure, however, that your database is configured to allow network
> connections.  Change your rc.mysqld (or comparable one if your Linux
> distro is inferior to Slackware ;) ) script to read as follows:
> ...
> # To allow outside connections to the database comment out the next line.
> # If you don't need incoming network connections, then leave the line
> # uncommented to improve system security.
> #SKIP="--skip-networking"
> ...
>
>
>> On Jan 4, 2019, at 6:47 AM, Saibabu Vallurupalli <sa...@gmail.com> wrote:
>>
>> your configurations are incorrect is what the error shows and I see
>> you have got:
>>
>> vendorAdapter.database=MYSQL
>>
>> This should be :
>> vendorAdapter.database=MARIADB
>>
>> Try changing this.
>>
>> Thanks,
>> Sai
>>
>>> On Fri, Jan 4, 2019 at 2:39 AM Marc Chamberlin <ma...@marcchamberlin.com> wrote:
>>>
>>> (Thanks Benoit, Saibabu, and Simon for taking the time/trouble to answer
>>> my previous question on MySQL. It helped a lot!)
>>>
>>> I have managed to get a little further setting up James 3.2.0 Spring
>>> with MySQL/MariaDB but have ran into a problem which Google is not being
>>> helpful.
>>>
>>> I appear to be having troubles with getting a connection going between
>>> James and the MariaDB server. I will provide a description of what I
>>> have done and then I will show the exception message I am getting which
>>> is stopping James from starting up...
>>>
>>> First of all I downloaded the MariaDB Connector/J .jar file from
>>> https://downloads.mariadb.org/connector-java/ and installed it in the
>>> conf/lib directory within the James installation.
>>>
>>> I then set up a database and user in MariaDB as follows -
>>>
>>>> mysql --user=root -p
>>> MariaDB [mysql]> create database mail;
>>> MariaDB [mysql]> create user 'james'@'localhost' identified by 'apassword';
>>> MariaDB [mysql]> grant all privileges on mail to 'james'@'localhost';
>>>
>>> I also created a system user for james and assigned it the same password.
>>>
>>> Next I edited the james-database.properties file as follows -
>>>
>>> database.driverClassName=org.mariadb.jdbc.Driver
>>> database.url=jdbc:mariadb://127.0.0.1:3306/mail
>>> database.username=james
>>> database.password=apassword
>>> vendorAdapter.database=MYSQL
>>> openjpa.streaming=false
>>> datasource.testOnBorrow=true
>>> datasource.validationQueryTimeoutSec=2
>>> datasource.validationQuery=select 1
>>>
>>> Telnetting to localhost port 3306 does show that the mariadb server is
>>> responding but hard to say exactly what is being communicated because a
>>> lot of the text has non-printable characters. I assume it is working OK...
>>>
>>> Upon starting up James I am getting exceptions with a huge amount of
>>> stack walkback messages, but I will try to capture just what appears to
>>> be relevant -
>>>
>>> INFO  22:03:05,852 | org.apache.james.domainlist.lib.AbstractDomainList
>>> | Set autodetectIP to: true
>>> WARN  22:03:06,000 |
>>> org.apache.james.container.spring.context.JamesServerApplicationContext
>>> | Exception encountered during context initial
>>> ization - cancelling refresh attempt:
>>> org.springframework.beans.factory.UnsatisfiedDependencyException: Error
>>> creating bean with name 'auth
>>> enticator' defined in class path resource
>>> [META-INF/org/apache/james/spring-mailbox-authenticator.xml]:
>>> Unsatisfied dependency expressed th
>>> rough constructor argument with index 0 of type
>>> [org.apache.james.user.api.UsersRepository]: : Error creating bean with
>>> name 'usersreposito
>>> ry': Invocation of init method failed; nested exception is
>>> <openjpa-3.0.0-r422266:1833209 nonfatal general error>
>>> org.apache.openjpa.persis
>>> tence.PersistenceException: There were errors initializing your
>>> configuration: <openjpa-3.0.0-r422266:1833209 fatal user error> org.apache.
>>> openjpa.util.UserException: A connection could not be obtained for
>>> driver class "null" and URL "null".  You may have specified an invalid U
>>> RL.
>>>         at
>>> org.apache.openjpa.jdbc.schema.DataSourceFactory.newConnectException(DataSourceFactory.java:272)
>>>         at
>>> org.apache.openjpa.jdbc.schema.DataSourceFactory.installDBDictionary(DataSourceFactory.java:258)
>>>         at
>>> org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getConnectionFactory(JDBCConfigurationImpl.java:735)
>>> ... (Lots more trace back messages followed by -)
>>> Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create
>>> PoolableConnectionFactory (Access denied for user 'james@localhost'@'l
>>> ocalhost' (using password: YES))
>>>         at
>>> org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1549)
>>>         at
>>> org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388)
>>>         at
>>> org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
>>>
>>> and these exceptions/stack trace walkbacks repeat several time in the
>>> log file. Kinda hard for this poor soul to grok and I sure would
>>> appreciate it if wiser eyes could provide me with some ideas/pointers. I
>>> would be willing to send the entire log file if that would help, but
>>> warning it is a LOT! I am missing something simple probably....  Thanks
>>> again in advance for helping me over this bump...
>>>
>>>    Marc...
>>>
>>>
>>>
>>> Linux Counter
>> ---------------------------------------------------------------------
>> 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: A MySQL connection setup issue SOLVED!

Posted by Garry Hurley <ga...@gmail.com>.
Thanks for the heads up on the fix to the specified key length issue.  I
ran into it and recompiled using the 767 byte length, but then my Slackware
build was to test  the jar files for connections to a SQLServer instance,
which has a max key length of 900, so going with 767 worked okay for me.
Glad you got it to work.  I figured it was likely a misconfiguration of
MySQL when you said the URLs matched except for database name.

On Sat, Jan 5, 2019 at 10:24 PM Marc Chamberlin <ma...@marcchamberlin.com>
wrote:

> Thanks everyone who helped me with getting James and MySQL/MariaDB to
> get along with each other. Upgrading MariaDB from version 10.0 (supplied
> with the OpenSUSE distro) to version 10.3 solved the remaining problems
> I was experiencing. Appears there was a bug in setting table sizes that
> they managed to solve.  I will close this thread and start a new one
> with my next question.
>
>     Marc..
>
> On 01/04/2019 03:36 PM, Marc Chamberlin wrote:
> > Hi Garry -  Took quite a bit of sleuthing but I think I have made
> > progress, at least solved one thing only to encounter another... Isn't
> > that the way programming goes? LOL  Anywise it appears I made a
> > mistake in granting privileges in MariaDB, I had executed the following -
> >
> > MariaDB [mysql]> grant all privileges on mail to 'james'@'localhost';
> > whereas it should have been -
> >
> > MariaDB [mysql]> grant all privileges on mail.* to 'james'@'localhost';
> >
> > To insure user james had remote access from my internal network I also
> > issued this command -
> >
> > MariaDB [mail]> grant all privileges on mail.* to
> > 'james'@'192.168.10.%' identified by 'aPassword';
> >
> > Sometime ya just got to love non-intuitive command syntax (and
> > non-intuitive error messages)! So that got me past the previous set of
> > exceptions I was experiencing only to land me in this muddle -
> >
> > WARN  14:28:38,933 |
> > org.apache.james.container.spring.context.JamesServerApplicationContext
> > | Exception encountered during context initial
> > ization - cancelling refresh attempt:
> > org.springframework.beans.factory.UnsatisfiedDependencyException:
> > Error creating bean with name 'auth
> > enticator' defined in class path resource
> > [META-INF/org/apache/james/spring-mailbox-authenticator.xml]:
> > Unsatisfied dependency expressed th
> > rough constructor argument with index 0 of type
> > [org.apache.james.user.api.UsersRepository]: : Error creating bean
> > with name 'usersreposito
> > ry': Invocation of init method failed; nested exception is
> > <openjpa-3.0.0-r422266:1833209 nonfatal general error>
> > org.apache.openjpa.persis
> > tence.PersistenceException: (conn=10) Specified key was too long; max
> > key length is 767 bytes {stmnt 515268797 CREATE TABLE JAMES_MAIL_REPO
> > S (MAIL_REPO_NAME VARCHAR(1024) NOT NULL, PRIMARY KEY
> > (MAIL_REPO_NAME)) ENGINE = innodb} [code=1071, state=42000]; nested
> > exception is org.
> > springframework.beans.factory.BeanCreationException: Error creating
> > bean with name 'usersrepository': Invocation of init method failed; nes
> > ted exception is <openjpa-3.0.0-r422266:1833209 nonfatal general
> > error> org.apache.openjpa.persistence.PersistenceException: (conn=10)
> > Spec
> > ified key was too long; max key length is 767 bytes {stmnt 515268797
> > CREATE TABLE JAMES_MAIL_REPOS (MAIL_REPO_NAME VARCHAR(1024) NOT NULL,
> > PRIMARY KEY (MAIL_REPO_NAME)) ENGINE = innodb} [code=1071, state=42000]
> >
> > Uhhh "Specified key was too long; max key length is 767 bytes"???
> > What in the world is this talking about? Google makes it sound like
> > another MySQL issue?
> >
> > I am not groking what you are saying about the JPA classes not
> > working, or what symptoms I will see. Sounds ominous...  Have I
> > reached the point where I will have to create the tables manually?
> >
> > Thanks again for all your help... Marc...
> >
> >
> > On 1/4/19 6:29 AM, Garry Hurley wrote:
> >> A few things I forgot to mention, make sure you have granted your user
> >> access to log in remotely, and that you have created whatever
> >> database you
> >> want to connect to (just do the create database '<your db name
> >> here>'; and
> >> it will work). Also, once you get past that point, you will likely find
> >> that the JPA classes don't work.  That is fixed in the current code
> >> stream.I doubt it has been backcported to 3.2.0, so be advised.  If you
> >> need scripts for creating the tables manually, I have them. exported
> >> from
> >> SQL Server, but the DDL scripts should not be too different, just
> >> reach out
> >> to me and I will pop them into an email.
> >>
> >>
> >> On Fri, Jan 4, 2019 at 9:16 AM Garry Hurley <ga...@gmail.com>
> >> wrote:
> >>
> >>> The vendor class on the driver is supposed to match, but also be
> >>> certain you are using Mariadb and not MySQL database and MariaDB
> >>> client in your Linux distro. My config, which does work in the current
> >>> branch (3.3.0 SNAPSHOT), is as follows.  It goes without saying that
> >>> your mileage my vary, and that I am using Slackware Linux, so your
> >>> mileage may vary.
> >>>
> >>> ...
> >>> # Use derby as default
> >>> database.driverClassName=org.mariadb.jdbc.Driver
> >>> database.url=jdbc:mariadb://localhost:3306/maildb
> >>> database.username=james
> >>> database.password=<your password>
> >>>
> >>> # Supported adapters are:
> >>> # DB2, DERBY, H2, HSQL, INFORMIX, MYSQL, ORACLE, POSTGRESQL,
> >>> SQL_SERVER,
> >>> SYBASE
> >>> vendorAdapter.database=MYSQL
> >>>
> >>> ...
> >>>
> >>>
> >>> Make sure, however, that your database is configured to allow network
> >>> connections.  Change your rc.mysqld (or comparable one if your Linux
> >>> distro is inferior to Slackware ;) ) script to read as follows:
> >>> ...
> >>> # To allow outside connections to the database comment out the next
> >>> line.
> >>> # If you don't need incoming network connections, then leave the line
> >>> # uncommented to improve system security.
> >>> #SKIP="--skip-networking"
> >>> ...
> >>>
> >>>
> >>>> On Jan 4, 2019, at 6:47 AM, Saibabu Vallurupalli <
> >>> saibabu.vallurupalli@gmail.com> wrote:
> >>>> your configurations are incorrect is what the error shows and I see
> >>>> you have got:
> >>>>
> >>>> vendorAdapter.database=MYSQL
> >>>>
> >>>> This should be :
> >>>> vendorAdapter.database=MARIADB
> >>>>
> >>>> Try changing this.
> >>>>
> >>>> Thanks,
> >>>> Sai
> >>>>
> >>>>> On Fri, Jan 4, 2019 at 2:39 AM Marc Chamberlin
> >>>>> <ma...@marcchamberlin.com>
> >>> wrote:
> >>>>> (Thanks Benoit, Saibabu, and Simon for taking the time/trouble to
> >>>>> answer
> >>>>> my previous question on MySQL. It helped a lot!)
> >>>>>
> >>>>> I have managed to get a little further setting up James 3.2.0 Spring
> >>>>> with MySQL/MariaDB but have ran into a problem which Google is not
> >>>>> being
> >>>>> helpful.
> >>>>>
> >>>>> I appear to be having troubles with getting a connection going
> >>>>> between
> >>>>> James and the MariaDB server. I will provide a description of what I
> >>>>> have done and then I will show the exception message I am getting
> >>>>> which
> >>>>> is stopping James from starting up...
> >>>>>
> >>>>> First of all I downloaded the MariaDB Connector/J .jar file from
> >>>>> https://downloads.mariadb.org/connector-java/ and installed it in
> the
> >>>>> conf/lib directory within the James installation.
> >>>>>
> >>>>> I then set up a database and user in MariaDB as follows -
> >>>>>
> >>>>>> mysql --user=root -p
> >>>>> MariaDB [mysql]> create database mail;
> >>>>> MariaDB [mysql]> create user 'james'@'localhost' identified by
> >>> 'apassword';
> >>>>> MariaDB [mysql]> grant all privileges on mail to 'james'@
> 'localhost';
> >>>>>
> >>>>> I also created a system user for james and assigned it the same
> >>> password.
> >>>>> Next I edited the james-database.properties file as follows -
> >>>>>
> >>>>> database.driverClassName=org.mariadb.jdbc.Driver
> >>>>> database.url=jdbc:mariadb://127.0.0.1:3306/mail
> >>>>> database.username=james
> >>>>> database.password=apassword
> >>>>> vendorAdapter.database=MYSQL
> >>>>> openjpa.streaming=false
> >>>>> datasource.testOnBorrow=true
> >>>>> datasource.validationQueryTimeoutSec=2
> >>>>> datasource.validationQuery=select 1
> >>>>>
> >>>>> Telnetting to localhost port 3306 does show that the mariadb
> >>>>> server is
> >>>>> responding but hard to say exactly what is being communicated
> >>>>> because a
> >>>>> lot of the text has non-printable characters. I assume it is working
> >>> OK...
> >>>>> Upon starting up James I am getting exceptions with a huge amount of
> >>>>> stack walkback messages, but I will try to capture just what
> >>>>> appears to
> >>>>> be relevant -
> >>>>>
> >>>>> INFO  22:03:05,852 |
> >>>>> org.apache.james.domainlist.lib.AbstractDomainList
> >>>>> | Set autodetectIP to: true
> >>>>> WARN  22:03:06,000 |
> >>>>>
> org.apache.james.container.spring.context.JamesServerApplicationContext
> >>>>>
> >>>>> | Exception encountered during context initial
> >>>>> ization - cancelling refresh attempt:
> >>>>> org.springframework.beans.factory.UnsatisfiedDependencyException:
> >>>>> Error
> >>>>> creating bean with name 'auth
> >>>>> enticator' defined in class path resource
> >>>>> [META-INF/org/apache/james/spring-mailbox-authenticator.xml]:
> >>>>> Unsatisfied dependency expressed th
> >>>>> rough constructor argument with index 0 of type
> >>>>> [org.apache.james.user.api.UsersRepository]: : Error creating bean
> >>>>> with
> >>>>> name 'usersreposito
> >>>>> ry': Invocation of init method failed; nested exception is
> >>>>> <openjpa-3.0.0-r422266:1833209 nonfatal general error>
> >>>>> org.apache.openjpa.persis
> >>>>> tence.PersistenceException: There were errors initializing your
> >>>>> configuration: <openjpa-3.0.0-r422266:1833209 fatal user error>
> >>> org.apache.
> >>>>> openjpa.util.UserException: A connection could not be obtained for
> >>>>> driver class "null" and URL "null".  You may have specified an
> >>>>> invalid U
> >>>>> RL.
> >>>>>         at
> >>>>>
> >>>
> org.apache.openjpa.jdbc.schema.DataSourceFactory.newConnectException(DataSourceFactory.java:272)
> >>>
> >>>>>         at
> >>>>>
> >>>
> org.apache.openjpa.jdbc.schema.DataSourceFactory.installDBDictionary(DataSourceFactory.java:258)
> >>>
> >>>>>         at
> >>>>>
> >>>
> org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getConnectionFactory(JDBCConfigurationImpl.java:735)
> >>>
> >>>>> ... (Lots more trace back messages followed by -)
> >>>>> Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create
> >>>>> PoolableConnectionFactory (Access denied for user
> >>>>> 'james@localhost'@'l
> >>>>> ocalhost' (using password: YES))
> >>>>>         at
> >>>>>
> >>>
> org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1549)
> >>>
> >>>>>         at
> >>>>>
> >>>
> org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388)
> >>>
> >>>>>         at
> >>>>>
> >>>
> org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
> >>>
> >>>>> and these exceptions/stack trace walkbacks repeat several time in the
> >>>>> log file. Kinda hard for this poor soul to grok and I sure would
> >>>>> appreciate it if wiser eyes could provide me with some
> >>>>> ideas/pointers. I
> >>>>> would be willing to send the entire log file if that would help, but
> >>>>> warning it is a LOT! I am missing something simple probably....
> >>>>> Thanks
> >>>>> again in advance for helping me over this bump...
> >>>>>
> >>>>>    Marc...
> >>>>>
> >>>>>
> >>>>>
> >>>>> Linux Counter
> >>>> ---------------------------------------------------------------------
> >>>> 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
> >
>
> --
> Linux Counter
>

Re: A MySQL connection setup issue SOLVED!

Posted by Marc Chamberlin <ma...@marcchamberlin.com>.
Thanks everyone who helped me with getting James and MySQL/MariaDB to
get along with each other. Upgrading MariaDB from version 10.0 (supplied
with the OpenSUSE distro) to version 10.3 solved the remaining problems
I was experiencing. Appears there was a bug in setting table sizes that
they managed to solve.  I will close this thread and start a new one
with my next question.

    Marc..

On 01/04/2019 03:36 PM, Marc Chamberlin wrote:
> Hi Garry -  Took quite a bit of sleuthing but I think I have made
> progress, at least solved one thing only to encounter another... Isn't
> that the way programming goes? LOL  Anywise it appears I made a
> mistake in granting privileges in MariaDB, I had executed the following -
>
> MariaDB [mysql]> grant all privileges on mail to 'james'@'localhost';
> whereas it should have been -
>
> MariaDB [mysql]> grant all privileges on mail.* to 'james'@'localhost';
>
> To insure user james had remote access from my internal network I also
> issued this command -
>
> MariaDB [mail]> grant all privileges on mail.* to
> 'james'@'192.168.10.%' identified by 'aPassword';
>
> Sometime ya just got to love non-intuitive command syntax (and
> non-intuitive error messages)! So that got me past the previous set of
> exceptions I was experiencing only to land me in this muddle -
>
> WARN  14:28:38,933 |
> org.apache.james.container.spring.context.JamesServerApplicationContext
> | Exception encountered during context initial
> ization - cancelling refresh attempt:
> org.springframework.beans.factory.UnsatisfiedDependencyException:
> Error creating bean with name 'auth
> enticator' defined in class path resource
> [META-INF/org/apache/james/spring-mailbox-authenticator.xml]:
> Unsatisfied dependency expressed th
> rough constructor argument with index 0 of type
> [org.apache.james.user.api.UsersRepository]: : Error creating bean
> with name 'usersreposito
> ry': Invocation of init method failed; nested exception is
> <openjpa-3.0.0-r422266:1833209 nonfatal general error>
> org.apache.openjpa.persis
> tence.PersistenceException: (conn=10) Specified key was too long; max
> key length is 767 bytes {stmnt 515268797 CREATE TABLE JAMES_MAIL_REPO
> S (MAIL_REPO_NAME VARCHAR(1024) NOT NULL, PRIMARY KEY
> (MAIL_REPO_NAME)) ENGINE = innodb} [code=1071, state=42000]; nested
> exception is org.
> springframework.beans.factory.BeanCreationException: Error creating
> bean with name 'usersrepository': Invocation of init method failed; nes
> ted exception is <openjpa-3.0.0-r422266:1833209 nonfatal general
> error> org.apache.openjpa.persistence.PersistenceException: (conn=10)
> Spec
> ified key was too long; max key length is 767 bytes {stmnt 515268797
> CREATE TABLE JAMES_MAIL_REPOS (MAIL_REPO_NAME VARCHAR(1024) NOT NULL,
> PRIMARY KEY (MAIL_REPO_NAME)) ENGINE = innodb} [code=1071, state=42000]
>
> Uhhh "Specified key was too long; max key length is 767 bytes"??? 
> What in the world is this talking about? Google makes it sound like
> another MySQL issue?
>
> I am not groking what you are saying about the JPA classes not
> working, or what symptoms I will see. Sounds ominous...  Have I
> reached the point where I will have to create the tables manually?
>
> Thanks again for all your help... Marc...
>
>
> On 1/4/19 6:29 AM, Garry Hurley wrote:
>> A few things I forgot to mention, make sure you have granted your user
>> access to log in remotely, and that you have created whatever
>> database you
>> want to connect to (just do the create database '<your db name
>> here>'; and
>> it will work). Also, once you get past that point, you will likely find
>> that the JPA classes don't work.  That is fixed in the current code
>> stream.I doubt it has been backcported to 3.2.0, so be advised.  If you
>> need scripts for creating the tables manually, I have them. exported
>> from
>> SQL Server, but the DDL scripts should not be too different, just
>> reach out
>> to me and I will pop them into an email.
>>
>>
>> On Fri, Jan 4, 2019 at 9:16 AM Garry Hurley <ga...@gmail.com>
>> wrote:
>>
>>> The vendor class on the driver is supposed to match, but also be
>>> certain you are using Mariadb and not MySQL database and MariaDB
>>> client in your Linux distro. My config, which does work in the current
>>> branch (3.3.0 SNAPSHOT), is as follows.  It goes without saying that
>>> your mileage my vary, and that I am using Slackware Linux, so your
>>> mileage may vary.
>>>
>>> ...
>>> # Use derby as default
>>> database.driverClassName=org.mariadb.jdbc.Driver
>>> database.url=jdbc:mariadb://localhost:3306/maildb
>>> database.username=james
>>> database.password=<your password>
>>>
>>> # Supported adapters are:
>>> # DB2, DERBY, H2, HSQL, INFORMIX, MYSQL, ORACLE, POSTGRESQL,
>>> SQL_SERVER,
>>> SYBASE
>>> vendorAdapter.database=MYSQL
>>>
>>> ...
>>>
>>>
>>> Make sure, however, that your database is configured to allow network
>>> connections.  Change your rc.mysqld (or comparable one if your Linux
>>> distro is inferior to Slackware ;) ) script to read as follows:
>>> ...
>>> # To allow outside connections to the database comment out the next
>>> line.
>>> # If you don't need incoming network connections, then leave the line
>>> # uncommented to improve system security.
>>> #SKIP="--skip-networking"
>>> ...
>>>
>>>
>>>> On Jan 4, 2019, at 6:47 AM, Saibabu Vallurupalli <
>>> saibabu.vallurupalli@gmail.com> wrote:
>>>> your configurations are incorrect is what the error shows and I see
>>>> you have got:
>>>>
>>>> vendorAdapter.database=MYSQL
>>>>
>>>> This should be :
>>>> vendorAdapter.database=MARIADB
>>>>
>>>> Try changing this.
>>>>
>>>> Thanks,
>>>> Sai
>>>>
>>>>> On Fri, Jan 4, 2019 at 2:39 AM Marc Chamberlin
>>>>> <ma...@marcchamberlin.com>
>>> wrote:
>>>>> (Thanks Benoit, Saibabu, and Simon for taking the time/trouble to
>>>>> answer
>>>>> my previous question on MySQL. It helped a lot!)
>>>>>
>>>>> I have managed to get a little further setting up James 3.2.0 Spring
>>>>> with MySQL/MariaDB but have ran into a problem which Google is not
>>>>> being
>>>>> helpful.
>>>>>
>>>>> I appear to be having troubles with getting a connection going
>>>>> between
>>>>> James and the MariaDB server. I will provide a description of what I
>>>>> have done and then I will show the exception message I am getting
>>>>> which
>>>>> is stopping James from starting up...
>>>>>
>>>>> First of all I downloaded the MariaDB Connector/J .jar file from
>>>>> https://downloads.mariadb.org/connector-java/ and installed it in the
>>>>> conf/lib directory within the James installation.
>>>>>
>>>>> I then set up a database and user in MariaDB as follows -
>>>>>
>>>>>> mysql --user=root -p
>>>>> MariaDB [mysql]> create database mail;
>>>>> MariaDB [mysql]> create user 'james'@'localhost' identified by
>>> 'apassword';
>>>>> MariaDB [mysql]> grant all privileges on mail to 'james'@'localhost';
>>>>>
>>>>> I also created a system user for james and assigned it the same
>>> password.
>>>>> Next I edited the james-database.properties file as follows -
>>>>>
>>>>> database.driverClassName=org.mariadb.jdbc.Driver
>>>>> database.url=jdbc:mariadb://127.0.0.1:3306/mail
>>>>> database.username=james
>>>>> database.password=apassword
>>>>> vendorAdapter.database=MYSQL
>>>>> openjpa.streaming=false
>>>>> datasource.testOnBorrow=true
>>>>> datasource.validationQueryTimeoutSec=2
>>>>> datasource.validationQuery=select 1
>>>>>
>>>>> Telnetting to localhost port 3306 does show that the mariadb
>>>>> server is
>>>>> responding but hard to say exactly what is being communicated
>>>>> because a
>>>>> lot of the text has non-printable characters. I assume it is working
>>> OK...
>>>>> Upon starting up James I am getting exceptions with a huge amount of
>>>>> stack walkback messages, but I will try to capture just what
>>>>> appears to
>>>>> be relevant -
>>>>>
>>>>> INFO  22:03:05,852 |
>>>>> org.apache.james.domainlist.lib.AbstractDomainList
>>>>> | Set autodetectIP to: true
>>>>> WARN  22:03:06,000 |
>>>>> org.apache.james.container.spring.context.JamesServerApplicationContext
>>>>>
>>>>> | Exception encountered during context initial
>>>>> ization - cancelling refresh attempt:
>>>>> org.springframework.beans.factory.UnsatisfiedDependencyException:
>>>>> Error
>>>>> creating bean with name 'auth
>>>>> enticator' defined in class path resource
>>>>> [META-INF/org/apache/james/spring-mailbox-authenticator.xml]:
>>>>> Unsatisfied dependency expressed th
>>>>> rough constructor argument with index 0 of type
>>>>> [org.apache.james.user.api.UsersRepository]: : Error creating bean
>>>>> with
>>>>> name 'usersreposito
>>>>> ry': Invocation of init method failed; nested exception is
>>>>> <openjpa-3.0.0-r422266:1833209 nonfatal general error>
>>>>> org.apache.openjpa.persis
>>>>> tence.PersistenceException: There were errors initializing your
>>>>> configuration: <openjpa-3.0.0-r422266:1833209 fatal user error>
>>> org.apache.
>>>>> openjpa.util.UserException: A connection could not be obtained for
>>>>> driver class "null" and URL "null".  You may have specified an
>>>>> invalid U
>>>>> RL.
>>>>>         at
>>>>>
>>> org.apache.openjpa.jdbc.schema.DataSourceFactory.newConnectException(DataSourceFactory.java:272)
>>>
>>>>>         at
>>>>>
>>> org.apache.openjpa.jdbc.schema.DataSourceFactory.installDBDictionary(DataSourceFactory.java:258)
>>>
>>>>>         at
>>>>>
>>> org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getConnectionFactory(JDBCConfigurationImpl.java:735)
>>>
>>>>> ... (Lots more trace back messages followed by -)
>>>>> Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create
>>>>> PoolableConnectionFactory (Access denied for user
>>>>> 'james@localhost'@'l
>>>>> ocalhost' (using password: YES))
>>>>>         at
>>>>>
>>> org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1549)
>>>
>>>>>         at
>>>>>
>>> org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388)
>>>
>>>>>         at
>>>>>
>>> org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
>>>
>>>>> and these exceptions/stack trace walkbacks repeat several time in the
>>>>> log file. Kinda hard for this poor soul to grok and I sure would
>>>>> appreciate it if wiser eyes could provide me with some
>>>>> ideas/pointers. I
>>>>> would be willing to send the entire log file if that would help, but
>>>>> warning it is a LOT! I am missing something simple probably.... 
>>>>> Thanks
>>>>> again in advance for helping me over this bump...
>>>>>
>>>>>    Marc...
>>>>>
>>>>>
>>>>>
>>>>> Linux Counter
>>>> ---------------------------------------------------------------------
>>>> 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
>

-- 
Linux Counter

Re: A MySQL connection setup issue

Posted by Marc Chamberlin <ma...@marcchamberlin.com>.
Hi Garry -  Took quite a bit of sleuthing but I think I have made 
progress, at least solved one thing only to encounter another... Isn't 
that the way programming goes? LOL  Anywise it appears I made a mistake 
in granting privileges in MariaDB, I had executed the following -

MariaDB [mysql]> grant all privileges on mail to 'james'@'localhost';
whereas it should have been -

MariaDB [mysql]> grant all privileges on mail.* to 'james'@'localhost';

To insure user james had remote access from my internal network I also 
issued this command -

MariaDB [mail]> grant all privileges on mail.* to 'james'@'192.168.10.%' 
identified by 'aPassword';

Sometime ya just got to love non-intuitive command syntax (and 
non-intuitive error messages)! So that got me past the previous set of 
exceptions I was experiencing only to land me in this muddle -

WARN  14:28:38,933 | 
org.apache.james.container.spring.context.JamesServerApplicationContext 
| Exception encountered during context initial
ization - cancelling refresh attempt: 
org.springframework.beans.factory.UnsatisfiedDependencyException: Error 
creating bean with name 'auth
enticator' defined in class path resource 
[META-INF/org/apache/james/spring-mailbox-authenticator.xml]: 
Unsatisfied dependency expressed th
rough constructor argument with index 0 of type 
[org.apache.james.user.api.UsersRepository]: : Error creating bean with 
name 'usersreposito
ry': Invocation of init method failed; nested exception is 
<openjpa-3.0.0-r422266:1833209 nonfatal general error> 
org.apache.openjpa.persis
tence.PersistenceException: (conn=10) Specified key was too long; max 
key length is 767 bytes {stmnt 515268797 CREATE TABLE JAMES_MAIL_REPO
S (MAIL_REPO_NAME VARCHAR(1024) NOT NULL, PRIMARY KEY (MAIL_REPO_NAME)) 
ENGINE = innodb} [code=1071, state=42000]; nested exception is org.
springframework.beans.factory.BeanCreationException: Error creating bean 
with name 'usersrepository': Invocation of init method failed; nes
ted exception is <openjpa-3.0.0-r422266:1833209 nonfatal general error> 
org.apache.openjpa.persistence.PersistenceException: (conn=10) Spec
ified key was too long; max key length is 767 bytes {stmnt 515268797 
CREATE TABLE JAMES_MAIL_REPOS (MAIL_REPO_NAME VARCHAR(1024) NOT NULL,
PRIMARY KEY (MAIL_REPO_NAME)) ENGINE = innodb} [code=1071, state=42000]

Uhhh "Specified key was too long; max key length is 767 bytes"???  What 
in the world is this talking about? Google makes it sound like another 
MySQL issue?

I am not groking what you are saying about the JPA classes not working, 
or what symptoms I will see. Sounds ominous...  Have I reached the point 
where I will have to create the tables manually?

Thanks again for all your help... Marc...


On 1/4/19 6:29 AM, Garry Hurley wrote:
> A few things I forgot to mention, make sure you have granted your user
> access to log in remotely, and that you have created whatever database you
> want to connect to (just do the create database '<your db name here>'; and
> it will work). Also, once you get past that point, you will likely find
> that the JPA classes don't work.  That is fixed in the current code
> stream.I doubt it has been backcported to 3.2.0, so be advised.  If you
> need scripts for creating the tables manually, I have them. exported from
> SQL Server, but the DDL scripts should not be too different, just reach out
> to me and I will pop them into an email.
>
>
> On Fri, Jan 4, 2019 at 9:16 AM Garry Hurley <ga...@gmail.com>
> wrote:
>
>> The vendor class on the driver is supposed to match, but also be
>> certain you are using Mariadb and not MySQL database and MariaDB
>> client in your Linux distro. My config, which does work in the current
>> branch (3.3.0 SNAPSHOT), is as follows.  It goes without saying that
>> your mileage my vary, and that I am using Slackware Linux, so your
>> mileage may vary.
>>
>> ...
>> # Use derby as default
>> database.driverClassName=org.mariadb.jdbc.Driver
>> database.url=jdbc:mariadb://localhost:3306/maildb
>> database.username=james
>> database.password=<your password>
>>
>> # Supported adapters are:
>> # DB2, DERBY, H2, HSQL, INFORMIX, MYSQL, ORACLE, POSTGRESQL, SQL_SERVER,
>> SYBASE
>> vendorAdapter.database=MYSQL
>>
>> ...
>>
>>
>> Make sure, however, that your database is configured to allow network
>> connections.  Change your rc.mysqld (or comparable one if your Linux
>> distro is inferior to Slackware ;) ) script to read as follows:
>> ...
>> # To allow outside connections to the database comment out the next line.
>> # If you don't need incoming network connections, then leave the line
>> # uncommented to improve system security.
>> #SKIP="--skip-networking"
>> ...
>>
>>
>>> On Jan 4, 2019, at 6:47 AM, Saibabu Vallurupalli <
>> saibabu.vallurupalli@gmail.com> wrote:
>>> your configurations are incorrect is what the error shows and I see
>>> you have got:
>>>
>>> vendorAdapter.database=MYSQL
>>>
>>> This should be :
>>> vendorAdapter.database=MARIADB
>>>
>>> Try changing this.
>>>
>>> Thanks,
>>> Sai
>>>
>>>> On Fri, Jan 4, 2019 at 2:39 AM Marc Chamberlin <ma...@marcchamberlin.com>
>> wrote:
>>>> (Thanks Benoit, Saibabu, and Simon for taking the time/trouble to answer
>>>> my previous question on MySQL. It helped a lot!)
>>>>
>>>> I have managed to get a little further setting up James 3.2.0 Spring
>>>> with MySQL/MariaDB but have ran into a problem which Google is not being
>>>> helpful.
>>>>
>>>> I appear to be having troubles with getting a connection going between
>>>> James and the MariaDB server. I will provide a description of what I
>>>> have done and then I will show the exception message I am getting which
>>>> is stopping James from starting up...
>>>>
>>>> First of all I downloaded the MariaDB Connector/J .jar file from
>>>> https://downloads.mariadb.org/connector-java/ and installed it in the
>>>> conf/lib directory within the James installation.
>>>>
>>>> I then set up a database and user in MariaDB as follows -
>>>>
>>>>> mysql --user=root -p
>>>> MariaDB [mysql]> create database mail;
>>>> MariaDB [mysql]> create user 'james'@'localhost' identified by
>> 'apassword';
>>>> MariaDB [mysql]> grant all privileges on mail to 'james'@'localhost';
>>>>
>>>> I also created a system user for james and assigned it the same
>> password.
>>>> Next I edited the james-database.properties file as follows -
>>>>
>>>> database.driverClassName=org.mariadb.jdbc.Driver
>>>> database.url=jdbc:mariadb://127.0.0.1:3306/mail
>>>> database.username=james
>>>> database.password=apassword
>>>> vendorAdapter.database=MYSQL
>>>> openjpa.streaming=false
>>>> datasource.testOnBorrow=true
>>>> datasource.validationQueryTimeoutSec=2
>>>> datasource.validationQuery=select 1
>>>>
>>>> Telnetting to localhost port 3306 does show that the mariadb server is
>>>> responding but hard to say exactly what is being communicated because a
>>>> lot of the text has non-printable characters. I assume it is working
>> OK...
>>>> Upon starting up James I am getting exceptions with a huge amount of
>>>> stack walkback messages, but I will try to capture just what appears to
>>>> be relevant -
>>>>
>>>> INFO  22:03:05,852 | org.apache.james.domainlist.lib.AbstractDomainList
>>>> | Set autodetectIP to: true
>>>> WARN  22:03:06,000 |
>>>> org.apache.james.container.spring.context.JamesServerApplicationContext
>>>> | Exception encountered during context initial
>>>> ization - cancelling refresh attempt:
>>>> org.springframework.beans.factory.UnsatisfiedDependencyException: Error
>>>> creating bean with name 'auth
>>>> enticator' defined in class path resource
>>>> [META-INF/org/apache/james/spring-mailbox-authenticator.xml]:
>>>> Unsatisfied dependency expressed th
>>>> rough constructor argument with index 0 of type
>>>> [org.apache.james.user.api.UsersRepository]: : Error creating bean with
>>>> name 'usersreposito
>>>> ry': Invocation of init method failed; nested exception is
>>>> <openjpa-3.0.0-r422266:1833209 nonfatal general error>
>>>> org.apache.openjpa.persis
>>>> tence.PersistenceException: There were errors initializing your
>>>> configuration: <openjpa-3.0.0-r422266:1833209 fatal user error>
>> org.apache.
>>>> openjpa.util.UserException: A connection could not be obtained for
>>>> driver class "null" and URL "null".  You may have specified an invalid U
>>>> RL.
>>>>         at
>>>>
>> org.apache.openjpa.jdbc.schema.DataSourceFactory.newConnectException(DataSourceFactory.java:272)
>>>>         at
>>>>
>> org.apache.openjpa.jdbc.schema.DataSourceFactory.installDBDictionary(DataSourceFactory.java:258)
>>>>         at
>>>>
>> org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getConnectionFactory(JDBCConfigurationImpl.java:735)
>>>> ... (Lots more trace back messages followed by -)
>>>> Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create
>>>> PoolableConnectionFactory (Access denied for user 'james@localhost'@'l
>>>> ocalhost' (using password: YES))
>>>>         at
>>>>
>> org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1549)
>>>>         at
>>>>
>> org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388)
>>>>         at
>>>>
>> org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
>>>> and these exceptions/stack trace walkbacks repeat several time in the
>>>> log file. Kinda hard for this poor soul to grok and I sure would
>>>> appreciate it if wiser eyes could provide me with some ideas/pointers. I
>>>> would be willing to send the entire log file if that would help, but
>>>> warning it is a LOT! I am missing something simple probably....  Thanks
>>>> again in advance for helping me over this bump...
>>>>
>>>>    Marc...
>>>>
>>>>
>>>>
>>>> Linux Counter
>>> ---------------------------------------------------------------------
>>> 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: A MySQL connection setup issue

Posted by Garry Hurley <ga...@gmail.com>.
A few things I forgot to mention, make sure you have granted your user
access to log in remotely, and that you have created whatever database you
want to connect to (just do the create database '<your db name here>'; and
it will work). Also, once you get past that point, you will likely find
that the JPA classes don't work.  That is fixed in the current code
stream.I doubt it has been backcported to 3.2.0, so be advised.  If you
need scripts for creating the tables manually, I have them. exported from
SQL Server, but the DDL scripts should not be too different, just reach out
to me and I will pop them into an email.


On Fri, Jan 4, 2019 at 9:16 AM Garry Hurley <ga...@gmail.com>
wrote:

> The vendor class on the driver is supposed to match, but also be
> certain you are using Mariadb and not MySQL database and MariaDB
> client in your Linux distro. My config, which does work in the current
> branch (3.3.0 SNAPSHOT), is as follows.  It goes without saying that
> your mileage my vary, and that I am using Slackware Linux, so your
> mileage may vary.
>
> ...
> # Use derby as default
> database.driverClassName=org.mariadb.jdbc.Driver
> database.url=jdbc:mariadb://localhost:3306/maildb
> database.username=james
> database.password=<your password>
>
> # Supported adapters are:
> # DB2, DERBY, H2, HSQL, INFORMIX, MYSQL, ORACLE, POSTGRESQL, SQL_SERVER,
> SYBASE
> vendorAdapter.database=MYSQL
>
> ...
>
>
> Make sure, however, that your database is configured to allow network
> connections.  Change your rc.mysqld (or comparable one if your Linux
> distro is inferior to Slackware ;) ) script to read as follows:
> ...
> # To allow outside connections to the database comment out the next line.
> # If you don't need incoming network connections, then leave the line
> # uncommented to improve system security.
> #SKIP="--skip-networking"
> ...
>
>
> > On Jan 4, 2019, at 6:47 AM, Saibabu Vallurupalli <
> saibabu.vallurupalli@gmail.com> wrote:
> >
> > your configurations are incorrect is what the error shows and I see
> > you have got:
> >
> > vendorAdapter.database=MYSQL
> >
> > This should be :
> > vendorAdapter.database=MARIADB
> >
> > Try changing this.
> >
> > Thanks,
> > Sai
> >
> >> On Fri, Jan 4, 2019 at 2:39 AM Marc Chamberlin <ma...@marcchamberlin.com>
> wrote:
> >>
> >> (Thanks Benoit, Saibabu, and Simon for taking the time/trouble to answer
> >> my previous question on MySQL. It helped a lot!)
> >>
> >> I have managed to get a little further setting up James 3.2.0 Spring
> >> with MySQL/MariaDB but have ran into a problem which Google is not being
> >> helpful.
> >>
> >> I appear to be having troubles with getting a connection going between
> >> James and the MariaDB server. I will provide a description of what I
> >> have done and then I will show the exception message I am getting which
> >> is stopping James from starting up...
> >>
> >> First of all I downloaded the MariaDB Connector/J .jar file from
> >> https://downloads.mariadb.org/connector-java/ and installed it in the
> >> conf/lib directory within the James installation.
> >>
> >> I then set up a database and user in MariaDB as follows -
> >>
> >>> mysql --user=root -p
> >>
> >> MariaDB [mysql]> create database mail;
> >> MariaDB [mysql]> create user 'james'@'localhost' identified by
> 'apassword';
> >> MariaDB [mysql]> grant all privileges on mail to 'james'@'localhost';
> >>
> >> I also created a system user for james and assigned it the same
> password.
> >>
> >> Next I edited the james-database.properties file as follows -
> >>
> >> database.driverClassName=org.mariadb.jdbc.Driver
> >> database.url=jdbc:mariadb://127.0.0.1:3306/mail
> >> database.username=james
> >> database.password=apassword
> >> vendorAdapter.database=MYSQL
> >> openjpa.streaming=false
> >> datasource.testOnBorrow=true
> >> datasource.validationQueryTimeoutSec=2
> >> datasource.validationQuery=select 1
> >>
> >> Telnetting to localhost port 3306 does show that the mariadb server is
> >> responding but hard to say exactly what is being communicated because a
> >> lot of the text has non-printable characters. I assume it is working
> OK...
> >>
> >> Upon starting up James I am getting exceptions with a huge amount of
> >> stack walkback messages, but I will try to capture just what appears to
> >> be relevant -
> >>
> >> INFO  22:03:05,852 | org.apache.james.domainlist.lib.AbstractDomainList
> >> | Set autodetectIP to: true
> >> WARN  22:03:06,000 |
> >> org.apache.james.container.spring.context.JamesServerApplicationContext
> >> | Exception encountered during context initial
> >> ization - cancelling refresh attempt:
> >> org.springframework.beans.factory.UnsatisfiedDependencyException: Error
> >> creating bean with name 'auth
> >> enticator' defined in class path resource
> >> [META-INF/org/apache/james/spring-mailbox-authenticator.xml]:
> >> Unsatisfied dependency expressed th
> >> rough constructor argument with index 0 of type
> >> [org.apache.james.user.api.UsersRepository]: : Error creating bean with
> >> name 'usersreposito
> >> ry': Invocation of init method failed; nested exception is
> >> <openjpa-3.0.0-r422266:1833209 nonfatal general error>
> >> org.apache.openjpa.persis
> >> tence.PersistenceException: There were errors initializing your
> >> configuration: <openjpa-3.0.0-r422266:1833209 fatal user error>
> org.apache.
> >> openjpa.util.UserException: A connection could not be obtained for
> >> driver class "null" and URL "null".  You may have specified an invalid U
> >> RL.
> >>        at
> >>
> org.apache.openjpa.jdbc.schema.DataSourceFactory.newConnectException(DataSourceFactory.java:272)
> >>        at
> >>
> org.apache.openjpa.jdbc.schema.DataSourceFactory.installDBDictionary(DataSourceFactory.java:258)
> >>        at
> >>
> org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getConnectionFactory(JDBCConfigurationImpl.java:735)
> >> ... (Lots more trace back messages followed by -)
> >> Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create
> >> PoolableConnectionFactory (Access denied for user 'james@localhost'@'l
> >> ocalhost' (using password: YES))
> >>        at
> >>
> org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1549)
> >>        at
> >>
> org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388)
> >>        at
> >>
> org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
> >>
> >> and these exceptions/stack trace walkbacks repeat several time in the
> >> log file. Kinda hard for this poor soul to grok and I sure would
> >> appreciate it if wiser eyes could provide me with some ideas/pointers. I
> >> would be willing to send the entire log file if that would help, but
> >> warning it is a LOT! I am missing something simple probably....  Thanks
> >> again in advance for helping me over this bump...
> >>
> >>   Marc...
> >>
> >>
> >>
> >> Linux Counter
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
> > For additional commands, e-mail: server-user-help@james.apache.org
> >
>

Re: A MySQL connection setup issue

Posted by Garry Hurley <ga...@gmail.com>.
The vendor class on the driver is supposed to match, but also be
certain you are using Mariadb and not MySQL database and MariaDB
client in your Linux distro. My config, which does work in the current
branch (3.3.0 SNAPSHOT), is as follows.  It goes without saying that
your mileage my vary, and that I am using Slackware Linux, so your
mileage may vary.

...
# Use derby as default
database.driverClassName=org.mariadb.jdbc.Driver
database.url=jdbc:mariadb://localhost:3306/maildb
database.username=james
database.password=<your password>

# Supported adapters are:
# DB2, DERBY, H2, HSQL, INFORMIX, MYSQL, ORACLE, POSTGRESQL, SQL_SERVER, SYBASE
vendorAdapter.database=MYSQL

...


Make sure, however, that your database is configured to allow network
connections.  Change your rc.mysqld (or comparable one if your Linux
distro is inferior to Slackware ;) ) script to read as follows:
...
# To allow outside connections to the database comment out the next line.
# If you don't need incoming network connections, then leave the line
# uncommented to improve system security.
#SKIP="--skip-networking"
...


> On Jan 4, 2019, at 6:47 AM, Saibabu Vallurupalli <sa...@gmail.com> wrote:
>
> your configurations are incorrect is what the error shows and I see
> you have got:
>
> vendorAdapter.database=MYSQL
>
> This should be :
> vendorAdapter.database=MARIADB
>
> Try changing this.
>
> Thanks,
> Sai
>
>> On Fri, Jan 4, 2019 at 2:39 AM Marc Chamberlin <ma...@marcchamberlin.com> wrote:
>>
>> (Thanks Benoit, Saibabu, and Simon for taking the time/trouble to answer
>> my previous question on MySQL. It helped a lot!)
>>
>> I have managed to get a little further setting up James 3.2.0 Spring
>> with MySQL/MariaDB but have ran into a problem which Google is not being
>> helpful.
>>
>> I appear to be having troubles with getting a connection going between
>> James and the MariaDB server. I will provide a description of what I
>> have done and then I will show the exception message I am getting which
>> is stopping James from starting up...
>>
>> First of all I downloaded the MariaDB Connector/J .jar file from
>> https://downloads.mariadb.org/connector-java/ and installed it in the
>> conf/lib directory within the James installation.
>>
>> I then set up a database and user in MariaDB as follows -
>>
>>> mysql --user=root -p
>>
>> MariaDB [mysql]> create database mail;
>> MariaDB [mysql]> create user 'james'@'localhost' identified by 'apassword';
>> MariaDB [mysql]> grant all privileges on mail to 'james'@'localhost';
>>
>> I also created a system user for james and assigned it the same password.
>>
>> Next I edited the james-database.properties file as follows -
>>
>> database.driverClassName=org.mariadb.jdbc.Driver
>> database.url=jdbc:mariadb://127.0.0.1:3306/mail
>> database.username=james
>> database.password=apassword
>> vendorAdapter.database=MYSQL
>> openjpa.streaming=false
>> datasource.testOnBorrow=true
>> datasource.validationQueryTimeoutSec=2
>> datasource.validationQuery=select 1
>>
>> Telnetting to localhost port 3306 does show that the mariadb server is
>> responding but hard to say exactly what is being communicated because a
>> lot of the text has non-printable characters. I assume it is working OK...
>>
>> Upon starting up James I am getting exceptions with a huge amount of
>> stack walkback messages, but I will try to capture just what appears to
>> be relevant -
>>
>> INFO  22:03:05,852 | org.apache.james.domainlist.lib.AbstractDomainList
>> | Set autodetectIP to: true
>> WARN  22:03:06,000 |
>> org.apache.james.container.spring.context.JamesServerApplicationContext
>> | Exception encountered during context initial
>> ization - cancelling refresh attempt:
>> org.springframework.beans.factory.UnsatisfiedDependencyException: Error
>> creating bean with name 'auth
>> enticator' defined in class path resource
>> [META-INF/org/apache/james/spring-mailbox-authenticator.xml]:
>> Unsatisfied dependency expressed th
>> rough constructor argument with index 0 of type
>> [org.apache.james.user.api.UsersRepository]: : Error creating bean with
>> name 'usersreposito
>> ry': Invocation of init method failed; nested exception is
>> <openjpa-3.0.0-r422266:1833209 nonfatal general error>
>> org.apache.openjpa.persis
>> tence.PersistenceException: There were errors initializing your
>> configuration: <openjpa-3.0.0-r422266:1833209 fatal user error> org.apache.
>> openjpa.util.UserException: A connection could not be obtained for
>> driver class "null" and URL "null".  You may have specified an invalid U
>> RL.
>>        at
>> org.apache.openjpa.jdbc.schema.DataSourceFactory.newConnectException(DataSourceFactory.java:272)
>>        at
>> org.apache.openjpa.jdbc.schema.DataSourceFactory.installDBDictionary(DataSourceFactory.java:258)
>>        at
>> org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getConnectionFactory(JDBCConfigurationImpl.java:735)
>> ... (Lots more trace back messages followed by -)
>> Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create
>> PoolableConnectionFactory (Access denied for user 'james@localhost'@'l
>> ocalhost' (using password: YES))
>>        at
>> org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1549)
>>        at
>> org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388)
>>        at
>> org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
>>
>> and these exceptions/stack trace walkbacks repeat several time in the
>> log file. Kinda hard for this poor soul to grok and I sure would
>> appreciate it if wiser eyes could provide me with some ideas/pointers. I
>> would be willing to send the entire log file if that would help, but
>> warning it is a LOT! I am missing something simple probably....  Thanks
>> again in advance for helping me over this bump...
>>
>>   Marc...
>>
>>
>>
>> Linux Counter
>
> ---------------------------------------------------------------------
> 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: A MySQL connection setup issue

Posted by Marc Chamberlin <ma...@marcchamberlin.com>.
Hi Sailbabu, Thanks for your thoughts but no joy...  MARIADB and MYSQL 
are identical in all respects, AFAIK, and according to OpenSUSE 
documentation fully compatible. Anywise, when I tried to change the 
vendorAdapter name as you suggested, to MARIADB, James threw a different 
exception basically saying that MARIADB is unrecognized/unknown. So I 
went back to MYSQL.  I suspect this only controls the construction of 
command/query syntax for working with a particular database, so my 
belief is that MYSQL should be the correct selection...   Marc...

On 1/4/19 3:47 AM, Saibabu Vallurupalli wrote:
> your configurations are incorrect is what the error shows and I see
> you have got:
>
> vendorAdapter.database=MYSQL
>
> This should be :
> vendorAdapter.database=MARIADB
>
> Try changing this.
>
> Thanks,
> Sai
>
> On Fri, Jan 4, 2019 at 2:39 AM Marc Chamberlin <ma...@marcchamberlin.com> wrote:
>> (Thanks Benoit, Saibabu, and Simon for taking the time/trouble to answer
>> my previous question on MySQL. It helped a lot!)
>>
>> I have managed to get a little further setting up James 3.2.0 Spring
>> with MySQL/MariaDB but have ran into a problem which Google is not being
>> helpful.
>>
>> I appear to be having troubles with getting a connection going between
>> James and the MariaDB server. I will provide a description of what I
>> have done and then I will show the exception message I am getting which
>> is stopping James from starting up...
>>
>> First of all I downloaded the MariaDB Connector/J .jar file from
>> https://downloads.mariadb.org/connector-java/ and installed it in the
>> conf/lib directory within the James installation.
>>
>> I then set up a database and user in MariaDB as follows -
>>
>>> mysql --user=root -p
>> MariaDB [mysql]> create database mail;
>> MariaDB [mysql]> create user 'james'@'localhost' identified by 'apassword';
>> MariaDB [mysql]> grant all privileges on mail to 'james'@'localhost';
>>
>> I also created a system user for james and assigned it the same password.
>>
>> Next I edited the james-database.properties file as follows -
>>
>> database.driverClassName=org.mariadb.jdbc.Driver
>> database.url=jdbc:mariadb://127.0.0.1:3306/mail
>> database.username=james
>> database.password=apassword
>> vendorAdapter.database=MYSQL
>> openjpa.streaming=false
>> datasource.testOnBorrow=true
>> datasource.validationQueryTimeoutSec=2
>> datasource.validationQuery=select 1
>>
>> Telnetting to localhost port 3306 does show that the mariadb server is
>> responding but hard to say exactly what is being communicated because a
>> lot of the text has non-printable characters. I assume it is working OK...
>>
>> Upon starting up James I am getting exceptions with a huge amount of
>> stack walkback messages, but I will try to capture just what appears to
>> be relevant -
>>
>> INFO  22:03:05,852 | org.apache.james.domainlist.lib.AbstractDomainList
>> | Set autodetectIP to: true
>> WARN  22:03:06,000 |
>> org.apache.james.container.spring.context.JamesServerApplicationContext
>> | Exception encountered during context initial
>> ization - cancelling refresh attempt:
>> org.springframework.beans.factory.UnsatisfiedDependencyException: Error
>> creating bean with name 'auth
>> enticator' defined in class path resource
>> [META-INF/org/apache/james/spring-mailbox-authenticator.xml]:
>> Unsatisfied dependency expressed th
>> rough constructor argument with index 0 of type
>> [org.apache.james.user.api.UsersRepository]: : Error creating bean with
>> name 'usersreposito
>> ry': Invocation of init method failed; nested exception is
>> <openjpa-3.0.0-r422266:1833209 nonfatal general error>
>> org.apache.openjpa.persis
>> tence.PersistenceException: There were errors initializing your
>> configuration: <openjpa-3.0.0-r422266:1833209 fatal user error> org.apache.
>> openjpa.util.UserException: A connection could not be obtained for
>> driver class "null" and URL "null".  You may have specified an invalid U
>> RL.
>>          at
>> org.apache.openjpa.jdbc.schema.DataSourceFactory.newConnectException(DataSourceFactory.java:272)
>>          at
>> org.apache.openjpa.jdbc.schema.DataSourceFactory.installDBDictionary(DataSourceFactory.java:258)
>>          at
>> org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getConnectionFactory(JDBCConfigurationImpl.java:735)
>> ... (Lots more trace back messages followed by -)
>> Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create
>> PoolableConnectionFactory (Access denied for user 'james@localhost'@'l
>> ocalhost' (using password: YES))
>>          at
>> org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1549)
>>          at
>> org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388)
>>          at
>> org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
>>
>> and these exceptions/stack trace walkbacks repeat several time in the
>> log file. Kinda hard for this poor soul to grok and I sure would
>> appreciate it if wiser eyes could provide me with some ideas/pointers. I
>> would be willing to send the entire log file if that would help, but
>> warning it is a LOT! I am missing something simple probably....  Thanks
>> again in advance for helping me over this bump...
>>
>>     Marc...
>>
>>
>>
>> Linux Counter
> ---------------------------------------------------------------------
> 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: A MySQL connection setup issue

Posted by Saibabu Vallurupalli <sa...@gmail.com>.
your configurations are incorrect is what the error shows and I see
you have got:

vendorAdapter.database=MYSQL

This should be :
vendorAdapter.database=MARIADB

Try changing this.

Thanks,
Sai

On Fri, Jan 4, 2019 at 2:39 AM Marc Chamberlin <ma...@marcchamberlin.com> wrote:
>
> (Thanks Benoit, Saibabu, and Simon for taking the time/trouble to answer
> my previous question on MySQL. It helped a lot!)
>
> I have managed to get a little further setting up James 3.2.0 Spring
> with MySQL/MariaDB but have ran into a problem which Google is not being
> helpful.
>
> I appear to be having troubles with getting a connection going between
> James and the MariaDB server. I will provide a description of what I
> have done and then I will show the exception message I am getting which
> is stopping James from starting up...
>
> First of all I downloaded the MariaDB Connector/J .jar file from
> https://downloads.mariadb.org/connector-java/ and installed it in the
> conf/lib directory within the James installation.
>
> I then set up a database and user in MariaDB as follows -
>
> > mysql --user=root -p
>
> MariaDB [mysql]> create database mail;
> MariaDB [mysql]> create user 'james'@'localhost' identified by 'apassword';
> MariaDB [mysql]> grant all privileges on mail to 'james'@'localhost';
>
> I also created a system user for james and assigned it the same password.
>
> Next I edited the james-database.properties file as follows -
>
> database.driverClassName=org.mariadb.jdbc.Driver
> database.url=jdbc:mariadb://127.0.0.1:3306/mail
> database.username=james
> database.password=apassword
> vendorAdapter.database=MYSQL
> openjpa.streaming=false
> datasource.testOnBorrow=true
> datasource.validationQueryTimeoutSec=2
> datasource.validationQuery=select 1
>
> Telnetting to localhost port 3306 does show that the mariadb server is
> responding but hard to say exactly what is being communicated because a
> lot of the text has non-printable characters. I assume it is working OK...
>
> Upon starting up James I am getting exceptions with a huge amount of
> stack walkback messages, but I will try to capture just what appears to
> be relevant -
>
> INFO  22:03:05,852 | org.apache.james.domainlist.lib.AbstractDomainList
> | Set autodetectIP to: true
> WARN  22:03:06,000 |
> org.apache.james.container.spring.context.JamesServerApplicationContext
> | Exception encountered during context initial
> ization - cancelling refresh attempt:
> org.springframework.beans.factory.UnsatisfiedDependencyException: Error
> creating bean with name 'auth
> enticator' defined in class path resource
> [META-INF/org/apache/james/spring-mailbox-authenticator.xml]:
> Unsatisfied dependency expressed th
> rough constructor argument with index 0 of type
> [org.apache.james.user.api.UsersRepository]: : Error creating bean with
> name 'usersreposito
> ry': Invocation of init method failed; nested exception is
> <openjpa-3.0.0-r422266:1833209 nonfatal general error>
> org.apache.openjpa.persis
> tence.PersistenceException: There were errors initializing your
> configuration: <openjpa-3.0.0-r422266:1833209 fatal user error> org.apache.
> openjpa.util.UserException: A connection could not be obtained for
> driver class "null" and URL "null".  You may have specified an invalid U
> RL.
>         at
> org.apache.openjpa.jdbc.schema.DataSourceFactory.newConnectException(DataSourceFactory.java:272)
>         at
> org.apache.openjpa.jdbc.schema.DataSourceFactory.installDBDictionary(DataSourceFactory.java:258)
>         at
> org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getConnectionFactory(JDBCConfigurationImpl.java:735)
> ... (Lots more trace back messages followed by -)
> Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create
> PoolableConnectionFactory (Access denied for user 'james@localhost'@'l
> ocalhost' (using password: YES))
>         at
> org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1549)
>         at
> org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388)
>         at
> org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
>
> and these exceptions/stack trace walkbacks repeat several time in the
> log file. Kinda hard for this poor soul to grok and I sure would
> appreciate it if wiser eyes could provide me with some ideas/pointers. I
> would be willing to send the entire log file if that would help, but
> warning it is a LOT! I am missing something simple probably....  Thanks
> again in advance for helping me over this bump...
>
>    Marc...
>
>
>
> Linux Counter

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