Grails Plugin Uploadr doesn't run - grails

I'm trying to use uploadr but I cannot put it to work... Even the Uploadr-demo does not run.
So, it's what I have tried so far:
Using Grails 2.4.2 and adding the plugin in a existing project:
I get this error when I run the project:
| Error 2014-07-16 16:00:54,667 [localhost-startStop-1] ERROR resource.ResourceMeta - Resource not found: /assets/jquery.tipTip.minified.js
| Error 2014-07-16 16:00:54,697 [localhost-startStop-1] ERROR resource.ResourceMeta - Resource not found: /assets/tipTip.css
| Error 2014-07-16 16:00:54,727 [localhost-startStop-1] ERROR resource.ResourceMeta - Resource not found: /assets/jquery.uploadr.js
| Error 2014-07-16 16:00:54,754 [localhost-startStop-1] ERROR resource.ResourceMeta - Resource not found: /assets/jquery.uploadr.css
However the server starts, but when I try to open the page using uploadr I get this error:
Error 500: Internal Server Error
[...]
Class: java.lang.IllegalArgumentException
Message: Module [tipTip] depends on resource [/assets/jquery.tipTip.minified.js] but the file cannot be found
The page I'm trying to open is just to call the uploadr demo:
<head>
<g:javascript library='jquery' />
<r:require modules="uploadr"/>
<r:layoutResources/>
</head>
<body>
<uploadr:demo/>
<r:layoutResources/>
</body>
The BuildConfig:
plugins {
// plugins for the build system only
build ":tomcat:7.0.54"
// plugins for the compile step
compile ":scaffolding:2.1.2"
compile ':cache:1.1.7'
compile ":asset-pipeline:1.8.11"
//uploadr
runtime ":resources:latest.integration"
compile ":modernizr:latest.integration"
compile ":uploadr:latest.integration"
compile ":quartz:latest.integration" //1.0.1"
// plugins needed at runtime but not for compilation
runtime ":hibernate4:4.3.5.4" // or ":hibernate:3.6.10.16"
runtime ":database-migration:1.4.0"
runtime ":jquery:1.11.1"
}
As it didn't work I tried to download the Uploadr-demo from github.
First it I couldn't import (I'm using Spring Tool Suite v.:3.5.1.RELEASE) because the demo is to grails 2.3.3. Fine, I got grails 2.3.3, and again it didn't work. This time a new error:
Loading Grails 2.3.3
|Environment set to development
........
|Compiling 10 source files
..
|Compiling 154 source files
.Error
|
Compilation error: startup failed:
/home/ainsoph/workspace-sts-3.5.1.RELEASE/grails-uploadr-demo/target/work/plugins/uploadr-0.8.2/grails-app/controllers/hungry/wombat/UploadController.groovy: -1: Repetitive method name/signature for method 'java.lang.Object withFormat(groovy.lang.Closure)' in class 'hungry.wombat.UploadController'.
# line -1, column -1.
/home/ainsoph/workspace-sts-3.5.1.RELEASE/grails-uploadr-demo/target/work/plugins/uploadr-0.8.2/grails-app/controllers/hungry/wombat/UploadController.groovy: -1: Repetitive method name/signature for method 'java.lang.Object withFormat(groovy.lang.Closure)' in class 'hungry.wombat.UploadController'.
# line -1, column -1.
/home/ainsoph/workspace-sts-3.5.1.RELEASE/grails-uploadr-demo/target/work/plugins/database-migration-1.3.8/grails-app/controllers/grails/plugin/databasemigration/DbdocController.groovy: -1: Repetitive method name/signature for method 'java.lang.Object withFormat(groovy.lang.Closure)' in class 'grails.plugin.databasemigration.DbdocController'.
# line -1, column -1.
/home/ainsoph/workspace-sts-3.5.1.RELEASE/grails-uploadr-demo/target/work/plugins/database-migration-1.3.8/grails-app/controllers/grails/plugin/databasemigration/DbdocController.groovy: -1: Repetitive method name/signature for method 'java.lang.Object withFormat(groovy.lang.Closure)' in class 'grails.plugin.databasemigration.DbdocController'.
# line -1, column -1.
4 errors
I also tried to create a new project with grails 2.3.3, but it doesn't even compile:
Command terminated with an exception: java.lang.Exception (see details for partial output)
Command: GrailsCommand(P/grails-uploadr> compile --non-interactive --refresh-dependencies)
---- System.out ----
Loading Grails 2.3.3
.
|Environment set to development
..........
|Compiling 79 source files
.Error
|
Compilation error: startup failed:
/home/ainsoph/workspace-sts-3.5.1.RELEASE/grails-uploadr/target/work/plugins/database-migration-1.3.8/grails-app/controllers/grails/plugin/databasemigration/DbdocController.groovy: -1: Repetitive method name/signature for method 'java.lang.Object withFormat(groovy.lang.Closure)' in class 'grails.plugin.databasemigration.DbdocController'.
# line -1, column -1.
/home/ainsoph/workspace-sts-3.5.1.RELEASE/grails-uploadr/target/work/plugins/database-migration-1.3.8/grails-app/controllers/grails/plugin/databasemigration/DbdocController.groovy: -1: Repetitive method name/signature for method 'java.lang.Object withFormat(groovy.lang.Closure)' in class 'grails.plugin.databasemigration.DbdocController'.
# line -1, column -1.
2 errors
When I tried to create a new project with grails 2.3.3 I first changed the $GRAILS_HOME to point to 2.3.3 and I called spring from a terminal that had its path updated
Well I tried everything that I could think or find on Google... Any ideas?

I managed a work around, it's running, but still with errors...
I installed Grails 2.3.3 and Oracle jdk1.7.0_65. Using both I can create a new project where uploadr works, and I also can run the uploadr-demo, but both with the errors below:
Groovy: compiler mismatch Project level is: 2.1 Workspace level is 2.3
Groovy compiler level expected by the project does not match workspace compiler level.
Go to Project properties -> Groovy compiler to set the Groovy compiler level for this project uploadr-Grails2.3.3-JDK7 uploadr-Grails2.3.3-JDK7 Groovy compiler mismatch problem
The resource is a duplicate of .link_to_grails_plugins/hibernate-3.6.10.4/grails-app/i18n/messages.properties and was not copied to the output folder messages.properties /uploadr-Grails2.3.3-JDK7/.link_to_grails_plugins/resources-1.2.1/grails-app/i18n Unknown Java Problem
Groovy:Repetitive method name/signature for method 'java.lang.Object withFormat(groovy.lang.Closure)' in class 'br.eti.andersonq.UploadrController'. UploadrController.groovy /uploadr-Grails2.3.3-JDK7/grails-app/controllers/br/eti/andersonq line 1 Java Problem
Groovy:Repetitive method name/signature for method 'java.lang.Object withFormat(groovy.lang.Closure)' in class 'br.eti.andersonq.UploadrController'. UploadrController.groovy /uploadr-Grails2.3.3-JDK7/grails-app/controllers/br/eti/andersonq line 1 Java Problem
The resource is a duplicate of .link_to_grails_plugins/resources-1.2.9-SNAPSHOT/grails-app/i18n/messages.properties and was not copied to the output folder messages.properties /Blogito/.link_to_grails_plugins/uploadr-0.8.2/grails-app/i18n Unknown Java Problem
Groovy:Repetitive method name/signature for method 'java.lang.Object withFormat(groovy.lang.Closure)' in class 'grails.plugin.databasemigration.DbdocController'. DbdocController.groovy /uploadr-Grails2.3.3-JDK7/.link_to_grails_plugins/database-migration-1.3.8/grails-app/controllers/grails/plugin/databasemigration line 1 Java Problem
Groovy:Repetitive method name/signature for method 'java.lang.Object withFormat(groovy.lang.Closure)' in class 'grails.plugin.databasemigration.DbdocController'. DbdocController.groovy /uploadr-Grails2.3.3-JDK7/.link_to_grails_plugins/database-migration-1.3.8/grails-app/controllers/grails/plugin/databasemigration line 1 Java Problem

Finally I found out a solution to everything \o/
uploadr doesn't seem to work with any grails version newer then 2.3.3
The errors 'Groovy:Repetitive method name/signature' are due a incompatibility between grails 2.3.3 and JDK8. However to solve properly it is necessary to also change the STS.ini from spring to use JDK7. Because even though I had changed all my system and preferences inside spring to use JDK7 it wasn't enough.
STS.ini is located at:
springsource/sts-3.5.1.RELEASE/STS.ini
and add/change:
-vm
/path/to/your/jdk/installation
to me it was:
-vm
/usr/lib/jvm/jdk1.7.0_65/bin/java

Related

Upgrading Grails from v3.0 to v3.1 or v3.2

I'm in process of upgrading an app from Grails v2 to v3 .
I got to a point where it works reasonably well with Grails 3.0.17.
I wanted to upgrade it to v3.1 or v3.2. But after changing the version in gradle.properties that's what I get after executing grails run-app:
me#host:[~/](feature/grails3-migration) : grails run-app
| Error Error occurred running Grails CLI: startup failed:
script14867378818131525390840.groovy: 3: unable to resolve class xxx.yyy.CollectorsJob
# line 3, column 1.
import xxx.yyy.jobs.CollectorsJob
^
script14867378818131525390840.groovy: 6: unable to resolve class xxx.yyy.domain.business.Company
# line 6, column 1.
import xxx.yyy.domain.business.Company
^
script14867378818131525390840.groovy: 5: unable to resolve class xxx.yyy.domain.access.User
# line 5, column 1.
import xxx.yyy.domain.access.User
^
...
There's about 15 errors like that printed.
What's the problem here? I've tried clear the project and change the jdk version fro 1.8 -> 1.7. Each time the same result.
If you are referencing application classes in grails-app/conf/application.groovy these will need to be moved to your runtime configuration in grails-app/conf/runtime.groovy
The application.groovy file is parsed by the build system in addition to the runtime so cannot contain references to classes that are not yet compiled

Grails - Fatal error during compilation org.springframework.beans.factory.BeanDefinitionStoreException

I'm developing a Grails 2.4.4 plugin. I added the following dependencies to the plugin BuildConfig file:
String springSocialVersion = "1.1.0.RELEASE"
String springSecurityVersion = '3.2.7.RELEASE'
compile("org.springframework.social:spring-social-core:${springSocialVersion}") {
excludes "spring-aop", "spring-beans", "spring-context", "spring-core",
"spring-expression", "spring-web", "spring-webmvc"
}
compile "org.springframework.security:spring-security-crypto:$springSecurityVersion"
compile("com.fasterxml.jackson.core:jackson-databind:2.2.2")
compile "org.apache.httpcomponents:httpclient:4.3.1"
The problem is when I add the plugin as a compile-time dependency in my app, I get the following exception:
Fatal error during compilation org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: URL [jar:file:/Users/jeff/.grails/ivy-cache/org.grails/grails-core/jars/grails-core-2.2.3.jar!/org/codehaus/groovy/grails/compiler/DirectoryWatcher$FileChangeListener.class]; nested exception is java.lang.NoClassDefFoundError: org/springframework/core/type/classreading/AnnotationMetadataReadingVisitor (NOTE: Stack trace has been filtered. Use --verbose to see entire trace.)
If I remove the dependencies from the plugin and add them directly to the BuildConfig in the app everything works fine
Any ideas?

Grails 3 scaffolding issue

I'm trying to port my project from Grails 2.4 to 3.0. Nothing fancy: 12 Domains, 13 Controllers and a service.
Everything works fine, except when I try to include the Scaffolding plugin. I literally follow the manual here, but the syntax must be wrong. Adding the plugin line as specified:
plugins {
…
compile ":scaffolding:2.0.0"
…
}
leads to this:
BUILD FAILED
Total time: 1.559 secs
| Error Error initializing classpath: startup failed:
build file 'E:\GrailsIdeaProjects\HcaServer\build.gradle': 17: only id(String) method calls allowed in plugins {} script block
See http://gradle.org/docs/2.3/userguide/plugins.html#sec:plugins_block for information on the plugins {} block
# line 17, column 5.
compile ":scaffolding:2.0.0"
^
1 error
(Use --stacktrace to see the full trace)
Somebody knows the right syntax to include the Scaffolding plugin in Grails 3?
EDIT: Thanks to Casey for pointing me in the right direction: Scaffolding plugin is actually already included in default build.gradle. Anyway, i still get a webpage like this on every controller:
Error: Page Not Found (404)
Path: /*controllerName*/index
I've been using the same syntax as per the manual, declaring a static scaffold = true on each controller. Why do I get a 404 page then? I do have index.gsp, error.gsp and notFound.gsp in my views folder.
It looks like that documentation hasn't been updated for Grails 3.0 yet. Your build.gradle file should have a dependencies block, where you can specify the dependency:
dependencies {
// ...
runtime "org.grails.plugins:scaffolding"
}
You can also see this by creating a new app using Grails 3.0 and checking out the default build.gradle file.
After researching for a while, turns out dynamic scaffolding hasn't made it yet into Grails 3:
https://groups.google.com/forum/m/#!topic/grails-dev-discuss/6R2YaF96Uts
Try this, It works for me.
dependencies {
compile "org.grails.plugins:scaffolding"
}
I am using grails 3.09.

Grails-Camel Plugin won't install or run

Please note: Although this question involves a lib called Apache Camel I really think this is just a question about how modern Grails plugins work.
I am on Grails 2.4.2 here, and I am trying to use Apache Camel with Grails and found the Grails Routing plugin annd cannot even get it to install.
The directions say to install by issuing a grails install-plugin routing. When I do this I get:
grails install-plugin routing
Starting process on LT-IE-ZH/10.10.99.14
Loading Grails 2.4.2
|Configuring classpath
.
|Environment set to development
......Warning
|
Since Grails 2.3, it is no longer possible to install plugins using the install-plugin command.
Plugins must be declared in the grails-app/conf/BuildConfig.groovy file.
Example:
grails.project.dependency.resolution = {
...
plugins {
compile ":routing:1.3.2"
}
}
So I modify my BuildConfig.groovy like so:
plugins {
// plugins for the build system only
build ":tomcat:7.0.54"
compile ":routing:1.3.2"
...lots of other stuff omitted for brevity
}
Then the plugin says to create routes, issue a grails create-route <RouteName>. So I do exactly that:
grails create-route OrderListener
Starting process on LT-IE-ZH/10.10.99.14
Loading Grails 2.4.2
|Configuring classpath
|Running pre-compiled script
|Script 'CreateRoute' not found, did you mean:
1) CreateFilters
2) CreatePom
3) CreateApp_
4) CreateController
5) CreateHibernateCfgXml
Please make a selection or enter Q to quit:
What is going on here?!? How do I install/use this plugin?!? Am I losing my mind, or does this plugin simply not work?
Update
I run grails clean-all, then grails refresh-dependencies then grails create-route OrderListener and I get:
Loading Grails 2.4.2
.
|Environment set to development
.....Error
|
groovy.lang.MissingMethodException: No signature of method: CreateRoute.createArtifact() is applicable for argument types: () values: []
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:526)
Error |
<huge stacktrace omitted>
Error |
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:207)
Error |
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.call(PogoMetaMethodSite.java:68)
Error |
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:112)
Error |
at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:381)
Error |
... 68 more
Whenever you make a change in BuildConfig.groovy be sure to run grails compile to trigger dependency resolution, which will download new and updated plugins and jars, and it will also compile your code which helps to ensure that things are minimally compatible at least.
But the core issue here is that the plugin's CreateRoute.groovy script is badly broken. It's missing an important include and doesn't come close to calling createArtifact correctly. As a workaround until the authors get this fixed, create a script in your app's scripts folder called CreateCamelRoute.groovy with this content:
includeTargets << grailsScript('_GrailsCreateArtifacts')
target(createCamelRoute: "Creates a new Camel Route.") {
createArtifact(type: 'Route', path: 'grails-app/routes', name: argsMap.params?.get(0) ?: 'Example', suffix: 'Route')
}
setDefaultTarget(createCamelRoute)
It's intentionally named differently from the original because if Grails finds two with the same name it asks which one to use. This way you can just run
grails create-camel-route com.foo.bar.OrderListener
and it will work. Note that I changed the example a bit to include a package - always use packages :)

Grails 2.0 and PayPal plugin

I've installed the newest Grails PayPal-Plugin (0.6.4) and got the following error:
Problems occurred (un)installing plugins. See details for more information
------System.out:-----------
| Loading Grails 2.0.0
| Configuring classpath.
| Environment set to development.....
| Compiling 97 source files
| Compiling 97 source files.
| Error Compilation error: startup failed:
C:\Users\username\.grails\2.0.0\projects\projectname\plugins\paypal-0.6.4\grails-app\controllers\org\grails\paypal\PaypalController.groovy: -1: The return type of java.lang.Object notify() in org.grails.paypal.PaypalController is incompatible with void notify() in java.lang.Object
. At [-1:-1] # line -1, column -1.
1 error
------System.err:-----------
I fixed it by renaming notify() into notifyPaypal() => Error PayPal plugin on grails 2.0.0.RC3
But the plugin seems to disturb springSecurity because I got the following error if I try to login:
| Error 2012-02-05 21:42:07,245 ["http-bio-8080"-exec-8] ERROR [/projectname].[default] - Servlet.service() for servlet [default] in context with path [/projectname] threw exception
Message: The specified user domain class 'Person' is not a domain class
How can I fix it?
Notice that two versions have been released since 0.6.4, and it now behaves as you asked regarding the 'notify()' method (probably thanks to your report).
http://grails.org/plugin/paypal/
(just saying it here for any casual reader to know)

Resources