isis-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chuangyu <zhu.chuan...@gmail.com>
Subject Re: mysql error when upgrade from 1.8 to 1.10
Date Wed, 25 Nov 2015 02:19:23 GMT
Dan,

I try it follow your way. but it seems need put all name query into
package.jdo.
otherwise it prompt errors as follow:

javax.jdo.JDOUserException: Query "findByRoleAndRuleAndFeature" for class
"class org.isisaddons.module.security.dom.permission.ApplicationPermission"
was not found!

If put one query into package.jdo, it will not show error of this query,
but show others which were not in file.

This is my package.jod file content:

<?xml version="1.0" encoding="UTF-8" ?>
<jdo xmlns="http://xmlns.jcp.org/xml/ns/jdo/jdo"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/jdo/jdo
http://xmlns.jcp.org/xml/ns/jdo/jdo_3_0.xsd" version="3.0">

    <package name="org.isisaddons.module.security.dom.user">
        <class name="ApplicationUser"
                     schema="xxx"
                     table="IsisSecurityApplicationUser">

        </class>
    </package>
    <package name="org.isisaddons.module.security.dom.tenancy">
        <class name="ApplicationTenancy"
                     schema="xxx"
                     table="IsisSecurityApplicationTenancy">
        <query name="findByName" language="JDOQL">
        SELECT FROM
org.isisaddons.module.security.dom.tenancy.ApplicationTenancy WHERE name ==
:name
        </query>
        </class>
    </package>
    <package name="org.isisaddons.module.security.dom.permission">
        <class name="ApplicationPermission"
                     schema="xxx"
                     table="IsisSecurityApplicationPermission">
        </class>
    </package>
    <package name="org.isisaddons.module.security.dom.role">
        <class name="ApplicationRole"
                     schema="xxx"
                     table="IsisSecurityApplicationRole">
        <query name="findByName" language="JDOQL">
        SELECT FROM org.isisaddons.module.security.dom.role.ApplicationRole
WHERE name == :name
        </query>
        </class>
    </package>
<package name="org.isisaddons.module.command.dom">
        <class name="CommandJdo"
                     schema="xxx"
                     table="IsisCommand">
        </class>
    </package>
<package name="org.isisaddons.module.sessionlogger.dom">
        <class name="SessionLogEntry"
                     schema="xxx"
                     table="isisSessionLogEntry">
        </class>
    </package>
</jdo>

Thanks,

James


2015-11-19 22:40 GMT+08:00 Dan Haywood <dan@haywood-associates.co.uk>:

> Hi James,
>
> With DataNucleus the metadata can be specified either in XML or in
> annotations.  (I haven't tried this out, but my understanding is that)...
> if both are present, then the XML files take precedence over any
> annotations.
>
>
> So, in this case, we have the following source (abbreviated):
>
> package org.isisaddons.module.security.dom.user;
> @javax.jdo.annotations.PersistenceCapable(
>         identityType = IdentityType.DATASTORE,
>         schema = "isissecurity",
>         table = "ApplicationUser")
> public class ApplicationUser ... { ... }
>
>
> So, you should be able to create META-INF/package.jdo file:
>
>
> <?xml version="1.0" encoding="UTF-8" ?>
> <jdo xmlns="http://xmlns.jcp.org/xml/ns/jdo/jdo"
>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>     xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/jdo/jdo
>         http://xmlns.jcp.org/xml/ns/jdo/jdo_3_0.xsd" version="3.0">
>
>     <package name="org.isisaddons.module.security.dom.user">
>         <class name="ApplicationUser"
>                      schema="xxx"
>                               <!-- whatever works here... -->
>                      table="IsisSecurityApplicationUser">
>         </class>
>     </package>
> </jdo>
>
>
> There are lots of other ways of splitting out and providing this XML
> metadata; see the docs below.
>
> Let us know how you get on; if it works I'll add to the hints/tips on our
> website.
>
> Thx
> Dan
>
> http://www.datanucleus.org/products/accessplatform_4_1/jdo/metadata.html
>
> http://www.datanucleus.org/products/accessplatform_4_1/jdo/metadata_xml.html#class
>
> http://www.datanucleus.org/products/accessplatform_4_1/jdo/class_mapping.html
>
>
> On 19 November 2015 at 14:25, Chuangyu <zhu.chuangyu@gmail.com> wrote:
>
> > Thank you, Jeroen.
> >
> > If do not create schema manually, it can run so far, just ignore "create
> > schema" errors.
> >
> > MySQL official document comment:
> > CREATE SCHEMA is a synonym for CREATE DATABASE as of MySQL 5.0.2
> >
> > I don't want to create separate database for isis addons.
> >
> >
> > James
> >
> > 2015-11-16 23:51 GMT+08:00 Jeroen van der Wal <jeroen@stromboli.it>:
> >
> > > We actively use Apache Isis with HSQLDB, PostgreSQL and MS SQL Server
> and
> > > they all support separate schemas within the same database. I would
> like
> > to
> > > see Apache Isis run without issues in the scenario you have but I don't
> > > want to lose the security that database schemas provide in preventing
> > > similar named entities to clash.
> > >
> > > What options do you have? Can you
> > >
> > > On 16 November 2015 at 14:40, Chuangyu <zhu.chuangyu@gmail.com> wrote:
> > >
> > > > Hi Jeroen and Stephen,
> > > > Thanks for your response.
> > > > Jeroen ,your solution may not fit my scenario.
> > > > I run 3 instance of this system but all 3 databases on one server
> .(eg.
> > > >  db1,db2,db3)
> > > > Each instance has username/password separately.(eg, user1, user2,
> > user3)
> > > > If create schema on this server , all databases would share the
> schema.
> > > >
> > > > If tables will create in the default schema, as Stephen said, it may
> be
> > > can
> > > > work.
> > > > But it is hard to maintenance.
> > > >
> > > >
> > > > James.
> > > >
> > > >
> > > > 2015-11-16 19:27 GMT+08:00 Stephen Cameron <
> steve.cameron.62@gmail.com
> > >:
> > > >
> > > > > Yes, that was a problem for me with MySQL and I used the same
> > solution
> > > to
> > > > > manually create the schemas, but then the module tables seem to
> have
> > > been
> > > > > created in the default schema anyway, so presently a mystery!
> > > > >
> > > > > On Mon, Nov 16, 2015 at 10:22 PM, Jeroen van der Wal <
> > > > jeroen@stromboli.it>
> > > > > wrote:
> > > > >
> > > > > > Hi James,
> > > > > >
> > > > > > Starting with Isis 1.10.0 we've moved the tables of the modules
> to
> > > > their
> > > > > > own database schema to avoid clashes with similar named entities
> in
> > > > your
> > > > > > own domain or other modules. Here's [1] a sample of an MSSQL
> script
> > > > that
> > > > > we
> > > > > > used. You have create something similar for MySQL I guess.
> > > > > >
> > > > > > Looking at the error message I also suspect that the automatic
> > > creation
> > > > > of
> > > > > > schemas does not work on MySQL, perhaps it requires delimiters
> > around
> > > > the
> > > > > > schema name? Try creating the schemas manually as a workaround.
> > > > > >
> > > > > > [1] https://gist.github.com/jcvanderwal/c30e2d8c4d11aec5b0c0
> > > > > >
> > > > > >
> > > > > > On 16 November 2015 at 11:10, Chuangyu <zhu.chuangyu@gmail.com>
> > > wrote:
> > > > > >
> > > > > > > Hi,
> > > > > > >
> > > > > > > I create a new 1.10 simple app and copy all code from 1.8
to
> > 1.10.
> > > > > > > And made some change to fit new 1.10 specs.
> > > > > > > When start system , Eclipse show errors on console box.
> > > > > > > It seems each addon module occur one error.
> > > > > > > Below is one of errors:
> > > > > > >
> > > > > > > Unable to create schema
> > > > > > > com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException:
You
> > have
> > > > an
> > > > > > > error in your SQL syntax; check the manual that corresponds
to
> > your
> > > > > MySQL
> > > > > > > server version for the right syntax to use near
> > > '"isissessionlogger"'
> > > > > at
> > > > > > > line 1
> > > > > > > at
> sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> > > > > Method)
> > > > > > > at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
> > > > > > > at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
> > > > > > > at
> > java.lang.reflect.Constructor.newInstance(Constructor.java:422)
> > > > > > > at com.mysql.jdbc.Util.handleNewInstance(Util.java:408)
> > > > > > > at com.mysql.jdbc.Util.getInstance(Util.java:383)
> > > > > > > at
> com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1062)
> > > > > > > at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4226)
> > > > > > > at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4158)
> > > > > > > at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2615)
> > > > > > > at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2776)
> > > > > > > at
> > com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2834)
> > > > > > > at
> > com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2783)
> > > > > > > at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:908)
> > > > > > > at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:788)
> > > > > > > at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.apache.isis.objectstore.jdo.datanucleus.CreateSchemaObjectFromClassMetadata.exec(CreateSchemaObjectFromClassMetadata.java:117)
> > > > > > > at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.apache.isis.objectstore.jdo.datanucleus.CreateSchemaObjectFromClassMetadata.loaded(CreateSchemaObjectFromClassMetadata.java:76)
> > > > > > > at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.datanucleus.metadata.MetaDataManagerImpl.processListenerLoadingCall(MetaDataManagerImpl.java:1705)
> > > > > > > at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.datanucleus.metadata.MetaDataManagerImpl.getMetaDataForClass(MetaDataManagerImpl.java:1681)
> > > > > > > at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.datanucleus.metadata.MetaDataManagerImpl.getMetaDataForClass(MetaDataManagerImpl.java:1580)
> > > > > > > at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.datanucleus.metadata.MetaDataManagerImpl.getReferencedClasses(MetaDataManagerImpl.java:3009)
> > > > > > > at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.datanucleus.store.rdbms.RDBMSStoreManager$ClassAdder.addClassTables(RDBMSStoreManager.java:2981)
> > > > > > > at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.datanucleus.store.rdbms.RDBMSStoreManager$ClassAdder.run(RDBMSStoreManager.java:2872)
> > > > > > > at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.datanucleus.store.rdbms.AbstractSchemaTransaction.execute(AbstractSchemaTransaction.java:119)
> > > > > > > at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.datanucleus.store.rdbms.RDBMSStoreManager.createSchemaForClasses(RDBMSStoreManager.java:3842)
> > > > > > > at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.apache.isis.core.runtime.system.persistence.DataNucleusApplicationComponents.createSchema(DataNucleusApplicationComponents.java:191)
> > > > > > > at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.apache.isis.core.runtime.system.persistence.DataNucleusApplicationComponents.createPmfAndSchemaIfRequired(DataNucleusApplicationComponents.java:150)
> > > > > > > at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.apache.isis.core.runtime.system.persistence.DataNucleusApplicationComponents.initialize(DataNucleusApplicationComponents.java:105)
> > > > > > > at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.apache.isis.core.runtime.system.persistence.DataNucleusApplicationComponents.<init>(DataNucleusApplicationComponents.java:98)
> > > > > > > at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.apache.isis.core.runtime.system.persistence.PersistenceSessionFactory.createDataNucleusApplicationComponents(PersistenceSessionFactory.java:92)
> > > > > > > at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.apache.isis.core.runtime.system.persistence.PersistenceSessionFactory.init(PersistenceSessionFactory.java:73)
> > > > > > > at
> > > > > >
> > > >
> > org.apache.isis.core.runtime.system.IsisSystem.init(IsisSystem.java:203)
> > > > > > > at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.apache.isis.core.runtime.runner.IsisInjectModule.provideIsisSystem(IsisInjectModule.java:140)
> > > > > > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
> > > > > > > at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> > > > > > > at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> > > > > > > at java.lang.reflect.Method.invoke(Method.java:497)
> > > > > > > at
> > > > >
> > com.google.inject.internal.ProviderMethod.get(ProviderMethod.java:104)
> > > > > > > at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)
> > > > > > > at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
> > > > > > > at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1031)
> > > > > > > at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
> > > > > > > at com.google.inject.Scopes$1$1.get(Scopes.java:65)
> > > > > > > at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)
> > > > > > > at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> com.google.inject.internal.SingleFieldInjector.inject(SingleFieldInjector.java:53)
> > > > > > > at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> com.google.inject.internal.MembersInjectorImpl.injectMembers(MembersInjectorImpl.java:110)
> > > > > > > at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> com.google.inject.internal.MembersInjectorImpl$1.call(MembersInjectorImpl.java:75)
> > > > > > > at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> com.google.inject.internal.MembersInjectorImpl$1.call(MembersInjectorImpl.java:73)
> > > > > > > at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1024)
> > > > > > > at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> com.google.inject.internal.MembersInjectorImpl.injectAndNotify(MembersInjectorImpl.java:73)
> > > > > > > at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> com.google.inject.internal.MembersInjectorImpl.injectMembers(MembersInjectorImpl.java:60)
> > > > > > > at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> com.google.inject.internal.InjectorImpl.injectMembers(InjectorImpl.java:944)
> > > > > > > at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.apache.isis.viewer.wicket.viewer.IsisWicketApplication.init(IsisWicketApplication.java:265)
> > > > > > > at
> > > > > >
> > > tm.webapp.TruckMonitorApplication.init(TruckMonitorApplication.java:75)
> > > > > > > at
> > > > org.apache.wicket.Application.initApplication(Application.java:823)
> > > > > > > at
> > > > > >
> > > >
> > org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:427)
> > > > > > > at
> > > > > >
> > > >
> > org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:351)
> > > > > > > at
> > > > > >
> > > >
> > org.eclipse.jetty.servlet.FilterHolder.initialize(FilterHolder.java:138)
> > > > > > > at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:852)
> > > > > > > at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:298)
> > > > > > > at
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1349)
> > > > > > > at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1342)
> > > > > > > at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:741)
> > > > > > > at
> > > > >
> > org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:505)
> > > > > > > at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
> > > > > > > at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)
> > > > > > > at org.eclipse.jetty.server.Server.start(Server.java:387)
> > > > > > > at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114)
> > > > > > > at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
> > > > > > > at org.eclipse.jetty.server.Server.doStart(Server.java:354)
> > > > > > > at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
> > > > > > > at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.apache.isis.core.webserver.WebServerBootstrapper.bootstrap(WebServerBootstrapper.java:91)
> > > > > > > at
> > org.apache.isis.core.webserver.WebServer.run(WebServer.java:107)
> > > > > > > at
> > org.apache.isis.core.webserver.WebServer.main(WebServer.java:71)
> > > > > > > at org.apache.isis.WebServer.main(WebServer.java:25)
> > > > > > >
> > > > > > >
> > > > > > > I check addon's dom module adn find
> > > > > > >
> > > > > > > @javax.jdo.annotations.PersistenceCapable(
> > > > > > >         identityType = IdentityType.DATASTORE,
> > > > > > >         schema = "isissecurity",
> > > > > > >         table = "ApplicationUser")
> > > > > > >
> > > > > > > There is schema = "isissecurity" than version 1.8.0  and
 table
> > is
> > > > > > > ApplicationUser not IsisSecurityApplicationUser.
> > > > > > >
> > > > > > > So how to migration these tables? And how to avoid "schema"
> > clause
> > > in
> > > > > > > MySQL?
> > > > > > >
> > > > > > > Thanks,
> > > > > > >
> > > > > > > James Chu.
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>

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