You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by eclideria <jr...@gmail.com> on 2016/06/22 20:48:18 UTC

JavaEE + eclipseLink + TomEE gives java.sql.SQLSyntaxErrorException: user lacks privilege or object not found

Hello guys,

I try to make a simple app using a rest service, eclipseLink and mysql. I
want to make this run on a TomEE server (apache-tomee-plume-1.7.4).

But I'm facing a strange issue:

java.sql.SQLSyntaxErrorException: user lacks privilege or object not found

The query is running perfectly on mysql console.

A strange thing is that I get the same issue if my mysql server is not
running, so i suppose that the db server is never reach.

Here is my logs:
logsWhenAccessingURL.txt
<http://tomee-openejb.979440.n4.nabble.com/file/n4679015/stackWhenAccessingURL.txt>  
logsWhenDeploying.txt
<http://tomee-openejb.979440.n4.nabble.com/file/n4679015/stackWhenDeploying.txt>  
persistence.xml
<http://tomee-openejb.979440.n4.nabble.com/file/n4679015/persistence.xml>  

My code is accessible on  gitlab <https://gitlab.com/julienD/MyTestApp>  

I have also ask the question on  stackoverflow
<http://stackoverflow.com/questions/37954385/javaee-eclipselink-tomee-gives-java-sql-sqlsyntaxerrorexception-user-lacks>  

Thanks a lot for your help



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/JavaEE-eclipseLink-TomEE-gives-java-sql-SQLSyntaxErrorException-user-lacks-privilege-or-object-not-fd-tp4679015.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: JavaEE + eclipseLink + TomEE gives java.sql.SQLSyntaxErrorException: user lacks privilege or object not found

Posted by 4rsgoldzyy <jz...@gmail.com>.
Ricky helped me step by step to ensure i got my gp as fast as possible, keep
up the good work man...

____________________
RS gold at http://www.4rsgold.com/



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/JavaEE-eclipseLink-TomEE-gives-java-sql-SQLSyntaxErrorException-user-lacks-privilege-or-object-not-fd-tp4679015p4679073.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: JavaEE + eclipseLink + TomEE gives java.sql.SQLSyntaxErrorException: user lacks privilege or object not found

Posted by eclideria <jr...@gmail.com>.
 Can not believe that I missed that.

Everything is working now. 

Thank you again for your time.



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/JavaEE-eclipseLink-TomEE-gives-java-sql-SQLSyntaxErrorException-user-lacks-privilege-or-object-not-fd-tp4679015p4679040.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: JavaEE + eclipseLink + TomEE gives java.sql.SQLSyntaxErrorException: user lacks privilege or object not found

Posted by Romain Manni-Bucau <rm...@gmail.com>.
misses root tag so likely not readable:

<?xml version="1.0" encoding="UTF-8"?>

<resources>

<Resource id="myDatasource" type="DataSource">
JdbcDriver com.mysql.jdbc.Driver
JdbcUrl jdbc:mysql://localhost:3306/notes_eleves
UserName root
</Resource>

</resources>



Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2016-06-23 17:27 GMT+02:00 eclideria <jr...@gmail.com>:

> If I remove my datasource configuration (resource) from tomee.xml and if I
> put it in a WEB-INF/resources.xml I face the same issue as the first I had:
> user lacks privilege or object not found: ELEVE
>
> I tried on 1.7 and 7, with the file in WEB-INF and META-INF.
>
> resources.xml is ignore but I don't know why.
>
> I have updated the project on git if you want to take a quick look
>
>
>
>
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/JavaEE-eclipseLink-TomEE-gives-java-sql-SQLSyntaxErrorException-user-lacks-privilege-or-object-not-fd-tp4679015p4679034.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>

Re: JavaEE + eclipseLink + TomEE gives java.sql.SQLSyntaxErrorException: user lacks privilege or object not found

Posted by eclideria <jr...@gmail.com>.
If I remove my datasource configuration (resource) from tomee.xml and if I
put it in a WEB-INF/resources.xml I face the same issue as the first I had:
user lacks privilege or object not found: ELEVE

I tried on 1.7 and 7, with the file in WEB-INF and META-INF.

resources.xml is ignore but I don't know why. 

I have updated the project on git if you want to take a quick look







--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/JavaEE-eclipseLink-TomEE-gives-java-sql-SQLSyntaxErrorException-user-lacks-privilege-or-object-not-fd-tp4679015p4679034.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: JavaEE + eclipseLink + TomEE gives java.sql.SQLSyntaxErrorException: user lacks privilege or object not found

Posted by Romain Manni-Bucau <rm...@gmail.com>.
will paraphrase you to answer this resources.xml thing:

"META-INF/resources.xml [is ignored but doc says] WEB-INF/resources.xml
[can be used]" ;)

Basically we read the descriptor folder of the root module/archive, if a
war it is WEB-INF, if an ejbmodule or ear META-INF.


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2016-06-23 13:37 GMT+02:00 eclideria <jr...@gmail.com>:

> By the way I have updated the git project
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/JavaEE-eclipseLink-TomEE-gives-java-sql-SQLSyntaxErrorException-user-lacks-privilege-or-object-not-fd-tp4679015p4679024.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>

Re: JavaEE + eclipseLink + TomEE gives java.sql.SQLSyntaxErrorException: user lacks privilege or object not found

Posted by eclideria <jr...@gmail.com>.
By the way I have updated the git project



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/JavaEE-eclipseLink-TomEE-gives-java-sql-SQLSyntaxErrorException-user-lacks-privilege-or-object-not-fd-tp4679015p4679024.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: JavaEE + eclipseLink + TomEE gives java.sql.SQLSyntaxErrorException: user lacks privilege or object not found

Posted by eclideria <jr...@gmail.com>.
Thanks again for you help,

I finally managed to make it works on  TomEE 1.7 and 7.

This is the changes I had to do:

- Remove the database related properties from the persistence.xml
- Replace <non-jta-data-source> tag by
<jta-data-source>myDatasource</jta-data-source> in persistence.xml
- Put the mysql connector jar in my server /lib
- In my server /conf/tomee.xml I have add myDatasource configuration as a
resource
 <Resource id="myDatasource" type="DataSource">
    JdbcDriver  com.mysql.jdbc.Driver
    JdbcUrl	jdbc:mysql://localhost:3306/notes_eleves
    UserName	root
</Resource>
- Put @XmlRootElement(name = "eleve") over my Eleve entity (this seems to be
only mandatory on TomEE 1.7)

By the way i have read the  http://tomee.apache.org/datasource-config.html
<http://tomee.apache.org/datasource-config.html>   and it says that "A
DataSource can be declared via xml in the <tomee-home>/conf/tomee.xml file
or in a WEB-INF/resources.xml file using a declaration like the following.
All properties in the element body are optional." Should the
WEB-INF/resources.xml be taken in account using EE ? because I tried to use
this (/src/main/resources/META-INF/resources.xml) but it seems to be ignore





--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/JavaEE-eclipseLink-TomEE-gives-java-sql-SQLSyntaxErrorException-user-lacks-privilege-or-object-not-fd-tp4679015p4679023.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: JavaEE + eclipseLink + TomEE gives java.sql.SQLSyntaxErrorException: user lacks privilege or object not found

Posted by Romain Manni-Bucau <rm...@gmail.com>.
PS: yes confirming it is only on 7 with a flag:
https://issues.apache.org/jira/browse/TOMEE-1455


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2016-06-23 7:35 GMT+02:00 Romain Manni-Bucau <rm...@gmail.com>:

> That's what EE expects. TomEE 7 has several enhancements - config or
> "automatic guess" cause this constraint was breaking some apps not designed
> for EE but it was the way to do it originally yes.
>
>
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
> <http://rmannibucau.wordpress.com> | Github
> <https://github.com/rmannibucau> | LinkedIn
> <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> <http://www.tomitribe.com> | JavaEE Factory
> <https://javaeefactory-rmannibucau.rhcloud.com>
>
> 2016-06-22 23:27 GMT+02:00 eclideria <jr...@gmail.com>:
>
>> Thanks for your answer.
>>
>> It's pretty  late there too ^^
>>
>> So you mean that i should use <non-jta-datasource> and configure my
>> datasource on the server and not in the persistence.xml properties ?
>>
>>
>>
>> --
>> View this message in context:
>> http://tomee-openejb.979440.n4.nabble.com/JavaEE-eclipseLink-TomEE-gives-java-sql-SQLSyntaxErrorException-user-lacks-privilege-or-object-not-fd-tp4679015p4679017.html
>> Sent from the TomEE Users mailing list archive at Nabble.com.
>>
>
>

Re: JavaEE + eclipseLink + TomEE gives java.sql.SQLSyntaxErrorException: user lacks privilege or object not found

Posted by Romain Manni-Bucau <rm...@gmail.com>.
That's what EE expects. TomEE 7 has several enhancements - config or
"automatic guess" cause this constraint was breaking some apps not designed
for EE but it was the way to do it originally yes.


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2016-06-22 23:27 GMT+02:00 eclideria <jr...@gmail.com>:

> Thanks for your answer.
>
> It's pretty  late there too ^^
>
> So you mean that i should use <non-jta-datasource> and configure my
> datasource on the server and not in the persistence.xml properties ?
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/JavaEE-eclipseLink-TomEE-gives-java-sql-SQLSyntaxErrorException-user-lacks-privilege-or-object-not-fd-tp4679015p4679017.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>

Re: JavaEE + eclipseLink + TomEE gives java.sql.SQLSyntaxErrorException: user lacks privilege or object not found

Posted by eclideria <jr...@gmail.com>.
Thanks for your answer.

It's pretty  late there too ^^

So you mean that i should use <non-jta-datasource> and configure my
datasource on the server and not in the persistence.xml properties ?



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/JavaEE-eclipseLink-TomEE-gives-java-sql-SQLSyntaxErrorException-user-lacks-privilege-or-object-not-fd-tp4679015p4679017.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: JavaEE + eclipseLink + TomEE gives java.sql.SQLSyntaxErrorException: user lacks privilege or object not found

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hello

didnt take time to run your sample - it is pretty late there ;) - but think
you need to add <non-jta-datasource> to the persistence.xml instead of
using javax.persistence properties to setup the connection. Think we
workaround this EE constraint on tomee 7 but no more sure for 1.x.


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2016-06-22 22:48 GMT+02:00 eclideria <jr...@gmail.com>:

> Hello guys,
>
> I try to make a simple app using a rest service, eclipseLink and mysql. I
> want to make this run on a TomEE server (apache-tomee-plume-1.7.4).
>
> But I'm facing a strange issue:
>
> java.sql.SQLSyntaxErrorException: user lacks privilege or object not found
>
> The query is running perfectly on mysql console.
>
> A strange thing is that I get the same issue if my mysql server is not
> running, so i suppose that the db server is never reach.
>
> Here is my logs:
> logsWhenAccessingURL.txt
> <
> http://tomee-openejb.979440.n4.nabble.com/file/n4679015/stackWhenAccessingURL.txt
> >
> logsWhenDeploying.txt
> <
> http://tomee-openejb.979440.n4.nabble.com/file/n4679015/stackWhenDeploying.txt
> >
> persistence.xml
> <http://tomee-openejb.979440.n4.nabble.com/file/n4679015/persistence.xml>
>
> My code is accessible on  gitlab <https://gitlab.com/julienD/MyTestApp>
>
> I have also ask the question on  stackoverflow
> <
> http://stackoverflow.com/questions/37954385/javaee-eclipselink-tomee-gives-java-sql-sqlsyntaxerrorexception-user-lacks
> >
>
> Thanks a lot for your help
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/JavaEE-eclipseLink-TomEE-gives-java-sql-SQLSyntaxErrorException-user-lacks-privilege-or-object-not-fd-tp4679015.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>