Using tomee-webprofile-1.5.2 The following exception is thrown when the application tries to access the database:

SEVERE: Servlet.service() for servlet [Faces Servlet] in context with path [/DynamicWebProject] threw exception [The bean encountered a non-application exception; nested exception is: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: java.sql.SQLSyntaxErrorException: user lacks privilege or object not found: CONTACT_DATA
Error Code: -5501
Call: SELECT t1.ID, t1.company_name, t1.DESCRIPTION, t1.REMARK, t1.screen_name, t1.valid_from, t1.valid_until, t1.contact_data_id, t1.IMAGE_ID FROM contact_data t0, RESTAURANT t1 WHERE (((ABS((t0.LATITUDE - 0.0)) <= 0.08993216059187306) AND (ABS((t0.LONGITUDE - 0.0)) <= 0.09009009009009009)) AND (t0.ID = t1.contact_data_id)) Query: ReadAllQuery(referenceClass=Restaurant sql="SELECT t1.ID, t1.company_name, t1.DESCRIPTION, t1.REMARK, t1.screen_name, t1.valid_from, t1.valid_until, t1.contact_data_id, t1.IMAGE_ID FROM contact_data t0, RESTAURANT t1 WHERE (((ABS((t0.LATITUDE - ?)) <= ?) AND (ABS((t0.LONGITUDE - ?)) <= ?)) AND (t0.ID = t1.contact_data_id))")] with root cause org.hsqldb.HsqlException: user lacks privilege or object not found: CONTACT_DATA

my tomee.xml looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<tomee>
  <!-- see http://tomee.apache.org/containers-and-resources.html -->

  <Resource id="MySQL" type="DataSource">
    JdbcDriver  com.mysql.jdbc.Driver
    JdbcUrl jdbc:mysql://localhost:3306/database
    UserName    root
    Password    secret
    JtaManaged true
</Resource>
</tomee>

this is the persistence.xml:

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0"
xmlns="http://java.sun.com/xml/ns/persistence"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd";>

    <persistence-unit name="DynamicWebProject" transaction-type="JTA">
    <jta-data-source>MySQL</jta-data-source>
 <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
 <exclude-unlisted-classes>false</exclude-unlisted-classes>
        <shared-cache-mode>ALL</shared-cache-mode>
        <properties>
            <property name="eclipselink.logging.exceptions" value="true"/>
        </properties>
    </persistence-unit>
</persistence>

i even added the following to my web.xml:

<resource-ref>
        <description>DB Connection</description>
        <res-ref-name>MySQL</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
    </resource-ref>

I also added mysql-connector-java-5.1.20-bin.jar, eclipselink.jar and javax.persistence_2.0.4.v201112161009.jar to apache-tomee-webprofile-1.5.2/lib and added the directory to the projects java built path.
Unfortunately I did not have any success yet.

Reply via email to