tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leonardo K. Shikida" <shik...@gmail.com>
Subject Re: TomEE/OpenJPA/MySQL issue
Date Sun, 27 Oct 2013 20:43:32 GMT
are you using properties like this in your persistence.xml?

    <properties>
        <property name="openjpa.jdbc.DBDictionary"
value="oracle(maxEmbeddedBlobSize=-1,maxEmbeddedClobSize=-1)"/>
        <property name="openjpa.jdbc.SynchronizeMappings"
value="buildSchema(ForeignKeys=true)"/>
    </properties>

[]

Leo


On Sun, Oct 27, 2013 at 4:14 PM, almos <almos@ukr.net> wrote:

> Hi,
>
> I have an issue with TomEE/OpenJPA.
> Tried to use MySQL+OpenJPA in TomEE webprofile, however have encountered
> strange exception when provider tries to create schema:
>
> <openjpa-2.2.0-r422266:1244990 nonfatal general error>
> org.apache.openjpa.persistence.PersistenceException: unexpected token:
> AUTO_INCREMENT {stmnt 1347764796 CREATE TABLE hosting_plan (hp_id INTEGER
> NOT NULL AUTO_INCREMENT, hp_name VARCHAR(255), PRIMARY KEY (hp_id)) ENGINE
> =
> innodb} [code=-5581, state=42581]
>
> If I change primary key definition so hp_id is not AUTO_INCREMENT, it
> complains in the same way on "ENGINE = innodb" statement.
> Could you please advise what's wrong?
>
> MySQL library version is 5.1.26, TomEE is 1.5.2 (webprofile) taken from
> here
> - http://tomee.apache.org/downloads.html.
>
> Here are my resources:
>
> tomee.xml
>
> <Resource id="mydb_resource" type="DataSource">
>   JdbcDriver com.mysql.Driver
>   JdbcUrl jdbc:mysql://127.0.0.1:3306/mydb
>   UserName root
>   Password root
>   JtaManaged true
> </Resource>
>
>
> persistnce.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="mydb_pu" transaction-type="JTA">
>                 <jta-data-source>mydb_resource</jta-data-source>
>
> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>                 <class>com.test.entities.TestUser</class>
>                 <properties>
>                         <property name="openjpa.Log"
> value="DefaultLevel=INFO, Tool=INFO" />
>                         <property name="openjpa.jdbc.DBDictionary"
> value="org.apache.openjpa.jdbc.sql.MySQLDictionary" />
>                         <property name="openjpa.jdbc.SynchronizeMappings"
> value="buildSchema(ForeignKeys=true)"/>
>                 </properties>
>         </persistence-unit>
> </persistence>
>
> TestBean.java
>
> @Stateless
> @LocalBean
> public class TestBean {
>
>     @PersistenceContext(unitName="mydb_pu")
>     private EntityManager em;
>
>     public void persist() {
>         TestUser h = new TestUser();
>         h.setName("test name");
>         em.persist(h);
>     }
>
>
> 132922  INFO   [http-bio-8080-exec-5] openjpa.Runtime - Starting OpenJPA
> 2.2.0
> 133126  INFO   [http-bio-8080-exec-5] openjpa.jdbc.JDBC - Using dictionary
> class "org.apache.openjpa.jdbc.sql.MySQLDictionary".
> окт 27, 2013 7:38:36 PM org.apache.catalina.core.StandardWrapperValve
> invoke
> SEVERE: Servlet.service() for servlet [TestServlet] in context with path
> [/test1] threw exception
> javax.ejb.EJBException: The bean encountered a non-application exception;
> nested exception is:
>         <openjpa-2.2.0-r422266:1244990 nonfatal general error>
> org.apache.openjpa.persistence.PersistenceException: unexpected token:
> AUTO_INCREMENT {stmnt 1347764796 CREATE TABLE hosting_plan (hp_id INTEGER
> NOT NULL AUTO_INCREMENT, hp_name VARCHAR(255), PRIMARY KEY (hp_id)) ENGINE
> =
> innodb} [code=-5581, state=42581]
>         at
>
> org.apache.openejb.core.ivm.BaseEjbProxyHandler.convertException(BaseEjbProxyHandler.java:363)
>         at
>
> org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:283)
>         at com.test.TestBean$LocalBeanProxy.getData(com/test/TestBean.java)
>         at TestServlet.doGet(TestServlet.java:37)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
>         at
>
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
>         at
>
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
>         at
>
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
>         at
>
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
>         at
> org.apache.tomee.catalina.OpenEJBValve.invoke(OpenEJBValve.java:45)
>         at
>
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
>         at
>
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
>         at
>
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
>         at
> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
>         at
>
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
>         at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
>         at
>
> org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
>         at
>
> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
>         at
>
> org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
>         at
>
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>         at
>
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>         at java.lang.Thread.run(Thread.java:724)
> Caused by: <openjpa-2.2.0-r422266:1244990 nonfatal general error>
> org.apache.openjpa.persistence.PersistenceException: unexpected token:
> AUTO_INCREMENT {stmnt 1347764796 CREATE TABLE hosting_plan (hp_id INTEGER
> NOT NULL AUTO_INCREMENT, hp_name VARCHAR(255), PRIMARY KEY (hp_id)) ENGINE
> =
> innodb} [code=-5581, state=42581]
>         at
> org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:559)
>         at
> org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:455)
>         at
>
> org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.synchronizeMappings(JDBCBrokerFactory.java:160)
>         at
>
> org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.synchronizeMappings(JDBCBrokerFactory.java:164)
>         at
>
> org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.newBrokerImpl(JDBCBrokerFactory.java:122)
>         at
>
> org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:209)
>         at
>
> org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:156)
>         at
>
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:227)
>         at
>
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:60)
>         at
>
> org.apache.openejb.assembler.classic.ReloadableEntityManagerFactory.createEntityManager(ReloadableEntityManagerFactory.java:160)
>         at
>
> org.apache.openejb.persistence.JtaEntityManagerRegistry.getEntityManager(JtaEntityManagerRegistry.java:115)
>         at
>
> org.apache.openejb.persistence.JtaEntityManager.getEntityManager(JtaEntityManager.java:80)
>         at
>
> org.apache.openejb.persistence.JtaEntityManager.persist(JtaEntityManager.java:126)
>         at com.test.TestBean.persist(TestBean.java:34)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>         at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:606)
>         at
>
> org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:181)
>         at
>
> org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:163)
>         at
> org.apache.openejb.cdi.CdiInterceptor.invoke(CdiInterceptor.java:126)
>         at
> org.apache.openejb.cdi.CdiInterceptor.access$000(CdiInterceptor.java:42)
>         at
> org.apache.openejb.cdi.CdiInterceptor$1.call(CdiInterceptor.java:63)
>         at
> org.apache.openejb.cdi.CdiInterceptor.aroundInvoke(CdiInterceptor.java:69)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>         at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:606)
>         at
>
> org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:181)
>         at
>
> org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:163)
>         at
>
> org.apache.openejb.monitoring.StatsInterceptor.record(StatsInterceptor.java:176)
>         at
>
> org.apache.openejb.monitoring.StatsInterceptor.invoke(StatsInterceptor.java:95)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>         at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:606)
>         at
>
> org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:181)
>         at
>
> org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:163)
>         at
>
> org.apache.openejb.core.interceptor.InterceptorStack.invoke(InterceptorStack.java:138)
>         at
>
> org.apache.openejb.core.stateless.StatelessContainer._invoke(StatelessContainer.java:239)
>         at
>
> org.apache.openejb.core.stateless.StatelessContainer.invoke(StatelessContainer.java:191)
>         at
>
> org.apache.openejb.core.ivm.EjbObjectProxyHandler.synchronizedBusinessMethod(EjbObjectProxyHandler.java:246)
>         at
>
> org.apache.openejb.core.ivm.EjbObjectProxyHandler.businessMethod(EjbObjectProxyHandler.java:241)
>         at
>
> org.apache.openejb.core.ivm.EjbObjectProxyHandler._invoke(EjbObjectProxyHandler.java:83)
>         at
>
> org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:279)
>         ... 21 more
> Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: unexpected
> token: AUTO_INCREMENT {stmnt 1347764796 CREATE TABLE hosting_plan (hp_id
> INTEGER NOT NULL AUTO_INCREMENT, hp_name VARCHAR(255), PRIMARY KEY (hp_id))
> ENGINE = innodb} [code=-5581, state=42581]
>         at
>
> org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:247)
>         at
>
> org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:231)
>         at
>
> org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.access$700(LoggingConnectionDecorator.java:72)
>         at
>
> org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingStatement.executeUpdate(LoggingConnectionDecorator.java:942)
>         at
>
> org.apache.openjpa.lib.jdbc.DelegatingStatement.executeUpdate(DelegatingStatement.java:114)
>         at
> org.apache.openjpa.jdbc.schema.SchemaTool.executeSQL(SchemaTool.java:1224)
>         at
> org.apache.openjpa.jdbc.schema.SchemaTool.createTable(SchemaTool.java:975)
>         at
> org.apache.openjpa.jdbc.schema.SchemaTool.add(SchemaTool.java:551)
>         at
> org.apache.openjpa.jdbc.schema.SchemaTool.add(SchemaTool.java:366)
>         at
> org.apache.openjpa.jdbc.schema.SchemaTool.run(SchemaTool.java:343)
>         at
> org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:505)
>         ... 65 more
>
>
>
> Regards,
> Alex
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/TomEE-OpenJPA-MySQL-issue-tp4665748.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message