Grails db-reverse-engineer fails - mysql

I am trying to reverse engineer a database schema and I'm getting the following error:
Command execution error: org.hibernate.cfg.Configuration.buildSettings(Lorg/hibernate/service/ServiceRegistry;)Lorg/hibernate/cfg/Settings;
> Building 85% > :dbReverseEngineer :dbReverseEngineer FAILED
> Building 85%
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':dbReverseEngineer'.
Process 'command '/usr/lib/jvm/java-8-openjdk/bin/java'' finished with non-zero exit value 1
Grails version:
| Grails Version: 3.2.6
| Groovy Version: 2.4.7
| JVM Version: 1.8.0_141
Gradle version:
Gradle 3.4.1
I followed these the instructions.

That plugin was last released with Grails 3.0.x. That used gorm 4, I'm pretty sure. (The docs for Grails 3.1 advertise "What's New" to include gorm 5, and Grails 3.2 advertises gorm 6). Maybe Burt will chime in, but as far as I can tell, this plugin isn't going to work well in Grails 3.2.x without being re-released.
You could try running it in 3.0.11, just to reverse engineer your classes, and then move those into your real project, as a workaround.

Related

SOLVED Grails HelloWorld brakes down before i even start

Urlmappings
HelloController
Pls help i followed the "Hello-World-Instruction" on the grails homepage exactly but it throws an error (before i even start it breaks ;D)
tried looking for solution maybe it has to do with my Java Path?
I finished the helloWorld Tut on Tutorial then put "grails run-app" into the shell and then Error!
Linux debian based Distro
Grails Version: 5.1.2
JVM Version: 11.0.1
Groovy Version: 4.0.1 JVM: 11.0.14
Error creating bean 'compositeViewResolver'
enter image description here
enter image description here

JUnit are failing when upgraded from JDK 1.6 to JDK 1.8 in maven, but its works in eclipse

I am using the JUnit for code coverage in my project. For db i am using the dbunit as like mock DB. When i am running JUnit from Eclipse UI its getting passed, but its getting failed when run through maven.
Above set up is running fine in JDK 1.6.25 by using maven and its started failing when upgraded to 1.8.51. I had updated the maven compiler plugin, its doesn't work. I am used below versions, junit - 4.7 2.dbunit - 2.4.8 hsqldb - 2.0.0 maven - 2.2.1.
Issue:
-> All test cases which ran fine in JAVA 1.6, started failing on migrating to JDK 1.8.51.
-> Due this we faced build failure issue and also code coverage reduction.
Root Cause:
-> JUnit uses Java reflection to get the test methods from Test classes. In JAVA 1.6 test method order returned as same as declaration in source file.
-> But from JAVA 7 onwards the methods order returned the by JVM is not same as the source file, it will be returned randomly.
-> Since our test cases are dependent on each other, due to order change it started failing.
For Example below test cases are using the same data (Mock DB) for execution,
-> AddOperationTestCase()
-> EditOperationTestCase()
-> DeleteOperationTestCase()
If delete run first due JVM random order, for Add and Edit data won't be available it will fail.
Solution :
-> I had tried to find options in JUnit and Sure Fire plugin to maintain same order as like source file, but I could not find feasibility there.
-> I have identified the class which will returns the order of execution in JUnit library and override that accordingly to run it source file order.
-> As of now I had added this annotation wrapper to failed classes, now build is running successfully.
Link for Wrapper class:
https://somethingididnotknow.wordpress.com/2014/03/07/run-junit-tests-in-order/

unable to compile apache drill code

I cloned the drill git repository and when I run
mvn clean package -DskipTests
I get this error
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:1.3.1:enforce (validate_java_and_maven_version) on project drill-root: Some Enforcer rules have failed. Look above for specific messages explaining why the rule failed. -> [Help 1]
You need to use JDK 1.7 to build Apache Drill.
The Drill team added maven-enforcer-plugin to the build process to make sure that build gives an error if someone tries to build using an unsupported version of Java or Maven. If you scroll up you will see an earlier error message like the following:
[INFO] --- maven-enforcer-plugin:1.3.1:enforce (validate_java_and_maven_version) # drill-root ---
[WARNING] Rule 1: org.apache.maven.plugins.enforcer.RequireJavaVersion failed with message:
Detected JDK Version: 1.8.0-51 is not in the allowed range [1.7,1.8).
A lot of people want to run Drill using JDK 1.8. There's good news on that front. While you can't build using JDK 1.8, once you've built, you can run Drill with JDK 1.8 just fine.

Getting 'java.sql.SQLException: com.mysql.jdbc.Driver' with grails run-app (when BuildConfig.groovy doesn't need to be recompiled)

I've upgraded my grails application from 1.3.9 to 2.2.3 and then to 2.3.3. I read the release and upgrade notes for 1.3.9->2.2.3 and then from 2.2.3->2.3.3
I am using OpenJDK 6, Jetty 6 and the plugin jetty 1.1, MySQL 5.5 and I have the connector library under lib
Now my issue is if I run grails clean and then grails run-app the application runs without any problems but if I stop it and run grails run-app again I get a gigantic error (see here: http://pastebin.com/36MpXhir)
I also found that changing something like adding a space somewhere in BuildConfig.groovy (anything that makes it be recompiled) makes the application run normally.
Looking at the stacktrace the first thing that puzzles me is
[02.12.13 16:13:59.919] [main] pool.ConnectionPool Unable to create initial connections of pool.
java.sql.SQLException: com.mysql.jdbc.Driver
at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:254)
at org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:182)
at org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:701)
at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:635)
at org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:486)
at org.apache.tomcat.jdbc.pool.ConnectionPool.<init>(ConnectionPool.java:144)
at org.apache.tomcat.jdbc.pool.DataSourceProxy.pCreatePool(DataSourceProxy.java:116)
at org.apache.tomcat.jdbc.pool.DataSourceProxy.createPool(DataSourceProxy.java:103)
at org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:127)
at org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy.afterPropertiesSet(LazyConnectionDataSourceProxy.java:162)
There are references to org.apache.tomcat even though I'm using jetty (and removed tomcat from BuildConfig.groovy).
Did anyone else encounter such a problem?
Don't put jar files in the lib directory if they're available in a public Maven repo. It's far better to download jars once and keep them in a local cache, and reuse them as needed.
The MySQL driver is used as the commented-out example in the generated BuildConfig.groovy - just un-comment it :) You might want to bump up the version to the latest, e.g.
dependencies {
runtime 'mysql:mysql-connector-java:5.1.27'
}
This is a good site for finding Maven artifacts: http://mvnrepository.com/artifact/mysql/mysql-connector-java
If you do have a jar that's not in a Maven repo (e.g. one with shared code at your company) then you can put it in the lib directory, but it's not auto-discovered. Run grails compile --refresh-dependencies to get it added to the classpath.
For me same error has occurred while running the Grails Application.Then I debug and view the code history of my code which was committed recently.
From that I found the issue that was:
Inside the controller file I send the instance with-out properly
Eg:
**def list=[personInstance.]---> error occurred.**
**render list as JSON**
Then I correct my mistake-->clean the app --> run the app
Now its working fine.

Grails IncompatibleClassChangeError

I deploy a war made with "grails war" to a jetty server.
As far as I can determine, Grails builds with Sun JDK 1.6.0_17-b04 and jetty runs on Sun JDK 1.6.0.16 (both on linux).
2010-08-18 07:33:47.018:WARN::Nested in org.springframework.beans.factory.access.BootstrapException: Error executing bootstraps; nested exception is org.codehaus.groovy.runtime.InvokerInvocationException:
java.lang.IncompatibleClassChangeError: the number of constructors during runtime and compile time for java.lang.ClassLoader do not match. Expected 3 but got 2:
java.lang.IncompatibleClassChangeError: the number of constructors during runtime and compile time for java.lang.ClassLoader do not match. Expected 3 but got 2
at grails.plugin.scopedproxy.AlwaysReloadableSmartClassLoader.<init>(AlwaysReloadableSmartClassLoader.groovy:28)
at grails.plugin.scopedproxy.ScopedProxyUtils.wrapInSmartClassLoader(ScopedProxyUtils.groovy:154)
How can this problem be solved or debugged further?
Run grails clean before you run grails war.
According to another post, Groovy code that uses exceptions that was compiled with a version of Java prior to 7 is not compatible with Java 7.
More information can be found here.
You are probably running into a JAR conflict. Namely your build environment is using one jar, and runtime (Jetty) is using a conflicting jar. This used to often happen with various XML parsing stacks.
Try looking at the Jars used by jetty and compare them to the ones in your project.