0

Eclipse STS 3.2.0 を使用しています。これは私がこれまで行ったことです:

  1. grails run-app コマンドが動作する
  2. grails の war コマンドが機能する
  3. Tomcat を個別に実行し、Tomcat を介して生成された war を展開します。エラーも貼り付けます (STS エラー レポートの後)。

  4. Maven を使用する必要があるため、コマンド「grails create-pom」を実行し、ここで説明されているように「pom true」を追加しました: http://grails.org/doc/2.3.x/ref/Command%20Line/create -pom.html

    • Maven (行「pom true」を追加) となし (行「pom true」にコメント) の両方を試しました。
  5. 「C:\Users\ch.grails\ivy-cache」、「project\target」のフォルダーを削除し、コマンド「grails clean」、「grails run-war」を再度実行しましたが、同じエラー結果になりました。

A) これは STS の完全なエラー レポートです。

    | Environment set to development.....
    | Packaging Grails application....
    | Compiling 22 source files.....
    | Error 2013-05-16 18:50:20,674 [main] ERROR plugins.DefaultGrailsPlugin  - This class is not an ArtefactHandler:org.grails.plugin.resources.artefacts.ResourceMapperArtefactHandler
    | Error 2013-05-16 18:50:20,678 [main] ERROR plugins.DefaultGrailsPlugin  - This class is not an ArtefactHandler:org.grails.plugin.resources.artefacts.ResourcesArtefactHandler
    | Error 2013-05-16 18:50:20,718 [main] ERROR plugins.DefaultGrailsPlugin  - This class is not an ArtefactHandler:grails.plugin.cache.CacheConfigArtefactHandler
    | Compiling 3 GSP files for package [alojamiento]..
    | Compiling 4 GSP files for package [databaseMigration]..
    | Building WAR file.....
    | Done creating WAR target\Alojamiento-0.1.war
    | Error java.lang.NullPointerException
    | Error     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    | Error     at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    | Error     at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    | Error     at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
    | Error     at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77)
    | Error     at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102)
    (...)
    | Error     at org.codehaus.groovy.grails.cli.GrailsScriptRunner.executeWithGantInstance(GrailsScriptRunner.java:768)
    | Error     at org.codehaus.groovy.grails.cli.GrailsScriptRunner.executeScriptFile(GrailsScriptRunner.java:566)
    | Error     at org.codehaus.groovy.grails.cli.GrailsScriptRunner.executeScriptWithCaching(GrailsScriptRunner.java:465)
    | Error     at org.codehaus.groovy.grails.cli.GrailsScriptRunner.executeScriptWithCaching(GrailsScriptRunner.java:416)
    | Error     at org.grails.ide.api.impl.GrailsConnectorImpl.executeCommand(GrailsConnectorImpl.java:144)
    | Error     at org.grails.ide.eclipse.longrunning.process.GrailsProcess.run(GrailsProcess.java:126)
    | Error     at org.grails.ide.eclipse.longrunning.process.GrailsProcess.main(GrailsProcess.java:89)
    | Error     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    | Error     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    | Error     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    | Error     at java.lang.reflect.Method.invoke(Method.java:601)
    | Error     at org.codehaus.groovy.grails.cli.support.GrailsStarter.rootLoader(GrailsStarter.java:234)
    | Error     at org.codehaus.groovy.grails.cli.support.GrailsStarter.main(GrailsStarter.java:262)
    | Error Caused by: java.lang.NullPointerException
    | Error     at org.codehaus.groovy.runtime.callsite.AbstractCallSite.createGroovyObjectGetPropertySite(AbstractCallSite.java:254)
    | Error     at org.codehaus.groovy.runtime.callsite.AbstractCallSite.acceptGroovyObjectGetProperty(AbstractCallSite.java:239)
    | Error     at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:231)
    | Error     at org.grails.plugins.tomcat.TomcatServer.<init>(TomcatServer.groovy:58)
    | Error     at org.grails.plugins.tomcat.IsolatedWarTomcatServer.<init>(IsolatedWarTomcatServer.groovy:35)
    | Error     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    | Error     at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    | Error     at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    | Error     at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
    | Error     at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77)
    | Error     at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102)
    | Error     at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57)
    | Error     at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182)
    | Error     at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:194)
    | Error     at org.grails.plugins.tomcat.TomcatServerFactory.createForWAR(TomcatServerFactory.groovy:88)
    | Error     at org.codehaus.groovy.grails.project.container.GrailsProjectRunner.runWarInternal(GrailsProjectRunner.groovy:151)
    | Error     at org.codehaus.groovy.grails.project.container.GrailsProjectRunner.runWar(GrailsProjectRunner.groovy:96)
    | Error     at org.codehaus.groovy.grails.project.container.GrailsProjectRunner$runWar.call(Unknown Source)
    | Error     at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
    (...)
    | Error     at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
    | Error     at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1082)
    | Error     at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1106)
    | Error     at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:906)
    | Error     at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1027)
    | Error     at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1106)
    | Error     at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:66)
    | Error     at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:149)
    | Error     at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16.doCall(GantBinding.groovy:185)
    | Error     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    | Error     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    | Error     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    | Error     at java.lang.reflect.Method.invoke(Method.java:601)
    | Error     at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSite.invoke(PogoMetaMethodSite.java:231)
    | Error     at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:52)
    | Error     at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141)
    | Error     at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16.doCall(GantBinding.groovy)
    | Error     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    | Error     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    | Error     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    | Error     at java.lang.reflect.Method.invoke(Method.java:601)
    | Error     at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:272)
    | Error     at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.call(PogoMetaMethodSite.java:64)
    | Error     at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
    | Error     at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
    | Error     at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:112)
    | Error     at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:381)
    | Error     ... 76 more

B) Tomcat コンソールのエラーレポートは既に修正されています (@Sérgio Michels の回答に従って):

    may 16, 2013 6:57:17 PM org.apache.catalina.startup.HostConfig deployWAR
    INFO: Despliegue del archivo D:\Software\IW-apache-tomcat-7.0.37\webapps\Alojami
    ento-0.1.war de la aplicaci¾n web
    may 16, 2013 6:57:34 PM org.apache.catalina.startup.TaglibUriRule body
    INFO: TLD skipped. URI: http://www.springframework.org/tags is already defined
    2013-05-16 18:57:50,613 [localhost-startStop-1] ERROR context.GrailsContextLoade
    r  - Error initializing the application: Error creating bean with name 'transact
    ionManagerPostProcessor': Initialization of bean failed; nested exception is org
    .springframework.beans.factory.BeanCreationException: Error creating bean with n
    ame 'transactionManager': Cannot resolve reference to bean 'sessionFactory' whil
    e setting bean property 'sessionFactory'; nested exception is org.springframewor
    k.beans.factory.BeanCreationException: Error creating bean with name 'sessionFac
    tory': Cannot resolve reference to bean 'lobHandlerDetector' while setting bean
    property 'lobHandler'; nested exception is org.springframework.beans.factory.Bea
    nCreationException: Error creating bean with name 'lobHandlerDetector': Invocati
    on of init method failed; nested exception is org.springframework.jdbc.support.M
    etaDataAccessException: Error while extracting DatabaseMetaData; nested exceptio
    n is org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of cl
    ass 'com.mysql.jdbc.Driver' for connect URL 'jdbc:h2:prodDb;MVCC=TRUE'
    org.springframework.beans.factory.BeanCreationException: Error creating bean wit
    h name 'transactionManagerPostProcessor': Initialization of bean failed; nested
    exception is org.springframework.beans.factory.BeanCreationException: Error crea
    ting bean with name 'transactionManager': Cannot resolve reference to bean 'sess
    ionFactory' while setting bean property 'sessionFactory'; nested exception is or
    g.springframework.beans.factory.BeanCreationException: Error creating bean with
    name 'sessionFactory': Cannot resolve reference to bean 'lobHandlerDetector' whi
    le setting bean property 'lobHandler'; nested exception is org.springframework.b
    eans.factory.BeanCreationException: Error creating bean with name 'lobHandlerDet
    ector': Invocation of init method failed; nested exception is org.springframewor
    k.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData;
     nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create J
    DBC driver of class 'com.mysql.jdbc.Driver' for connect URL 'jdbc:h2:prodDb;MVCC
    =TRUE'
            at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
            at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
            at java.util.concurrent.FutureTask.run(FutureTask.java:166)
            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:722)
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creati
    ng bean with name 'transactionManager': Cannot resolve reference to bean 'sessio
    nFactory' while setting bean property 'sessionFactory'; nested exception is org.
    springframework.beans.factory.BeanCreationException: Error creating bean with na
    me 'sessionFactory': Cannot resolve reference to bean 'lobHandlerDetector' while
     setting bean property 'lobHandler'; nested exception is org.springframework.bea
    ns.factory.BeanCreationException: Error creating bean with name 'lobHandlerDetec
    tor': Invocation of init method failed; nested exception is org.springframework.
    jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; n
    ested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create JDB
    C driver of class 'com.mysql.jdbc.Driver' for connect URL 'jdbc:h2:prodDb;MVCC=T
    RUE'
    (...)
    INFO: Server startup in 39571 ms

アップデート:

C) @Sérgio Michels の修正後の Tomcat コンソールの新しいエラー レポート:

    INFO: Despliegue del archivo D:\Software\IW-apache-tomcat-7.0.37\webapps\Alojami
    ento-0.1.war de la aplicaci¾n web
    may 16, 2013 10:09:12 PM org.apache.catalina.startup.TaglibUriRule body
    INFO: TLD skipped. URI: http://www.springframework.org/tags is already defined
    2013-05-16 22:09:20,376 [localhost-startStop-1] ERROR plugins.DefaultGrailsPlugi
    n  - This class is not an ArtefactHandler:org.grails.plugin.resources.artefacts.
    ResourceMapperArtefactHandler
    2013-05-16 22:09:20,381 [localhost-startStop-1] ERROR plugins.DefaultGrailsPlugi
    n  - This class is not an ArtefactHandler:org.grails.plugin.resources.artefacts.
    ResourcesArtefactHandler
    2013-05-16 22:09:20,429 [localhost-startStop-1] ERROR plugins.DefaultGrailsPlugi
    n  - This class is not an ArtefactHandler:grails.plugin.cache.CacheConfigArtefac
    tHandler
    2013-05-16 22:09:27,435 [localhost-startStop-1] ERROR context.GrailsContextLoade
    r  - Error initializing the application: HttpServletRequest
    java.lang.NoClassDefFoundError: HttpServletRequest
            at java.lang.Class.privateGetDeclaredMethods(Class.java:2451)
            at java.lang.Class.getDeclaredMethods(Class.java:1810)
            at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:47
    1)
            at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
            at java.util.concurrent.FutureTask.run(FutureTask.java:166)
            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:722)
    Caused by: java.lang.ClassNotFoundException: HttpServletRequest
            ... 8 more
    2013-05-16 22:09:27,439 [localhost-startStop-1] ERROR context.GrailsContextLoade
    r  - Error initializing Grails: HttpServletRequest
    java.lang.NoClassDefFoundError: HttpServletRequest
            at java.lang.Class.privateGetDeclaredMethods(Class.java:2451)
            at java.lang.Class.getDeclaredMethods(Class.java:1810)
            at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:47
    1)
            at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
            at java.util.concurrent.FutureTask.run(FutureTask.java:166)
            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:722)
    Caused by: java.lang.ClassNotFoundException: HttpServletRequest
            ... 8 more
    may 16, 2013 10:09:27 PM org.apache.catalina.core.StandardContext startInternal
    SEVERE: Error listenerStart
    may 16, 2013 10:09:27 PM org.apache.catalina.core.StandardContext startInternal
    SEVERE: Fall¾ en arranque del Contexto [/Alojamiento-0.1] debido a errores previ
    os

更新 2

D) テストを実行した後も同じように失敗します!

    | Tests FAILED  - view reports in D:\ch\eclipse_workspaces\IW-grails\Alojamiento\target\test-reports
    | Error java.lang.NullPointerException
    | Error     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    | Error     at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    | Error     at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    | Error     at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
4

1 に答える 1

2

データソースを正しく定義していないため、2 番目のエラーが発生します。

DatabaseMetaData の抽出中にエラーが発生しました。ネストされた例外は org.apache.commons.dbcp.SQLNestedException: 接続 URL 'jdbc:h2:prodDb;MVCC =TRUE' のクラス 'com.mysql.jdbc.Driver' の J DBC ドライバーを作成できません

h2MySQL ドライバー (com.mysql.jdbc.Driver) で jdbc URL を使用しています。

DataSource.groovyデプロイされたインスタンスを調整すると、機能するはずです。

于 2013-05-16T17:23:20.373 に答える