Grails 2.4.0.RC1 seems to lock javascript files on Windows 7 - 64bit - grails

I am using Grails 2.4.0.RC1 (and JDK 1.7.0_55) and whenever I browse to any app view that makes use of javascript files from the web-app folder, the java process seems to lock those files.
So I cannot work on any of those javascript files any more since when I try to save changes Windows 7 will not let me do it.
I used Process Explorer to check which process is locking the files and it's the java process running the grails app indeed.
At first I thought that this problem could be related to the new asset-pipeline:1.8.7 plugin which I am using. So I uninstalled it to check if the problem was still there... and it was.
The same app was running on Grails 2.3.5 just fine (although we were using an older JDK too... I must check with JDK 1.7.0_55).
By the way, something similar happened with a much older version of Grails: https://jira.grails.org/browse/GRAILS-3585
Is Anyone experiencing the same problem?
UPDATE 1:
I have tested this problem running the app on different versions of java and these are my results:
Win7-64bits, grails2.4.0.RC1, jdk1.7.0_55 -> PROBLEM OCCURS
Win7-64bits, grails2.4.0.RC1, jdk1.7.0_25 -> PROBLEM OCCURS
Win7-64bits, grails2.4.0.RC1, jdk1.6.0_18 -> OK
UPDATE 2:
I created a blank app (which uses Tomcat by default) and everything works fine.
The same blank app using jetty-plugin (with Jetty8) DOES present the problem.
I am further investigating this now.

I found the problem.
It had to do with the jetty-plugin indeed.
On the official version of the plugin 2.0.3 which uses Jetty7, the locking problem is NOT present. But this plugin uses a very old version of Jetty, so it's no use.
On the branch of the plugin created to run Jetty8:
https://github.com/grails-plugins/grails-jetty/tree/2.0.x
... the problem is there.
Also, on the new grails jetty plugin version 3.0.x (which uses Jetty 9.0.x), the problem is there too!
UPDATE 1:
Have a look at:
Jetty locking static files in Windows
Apparently the "useFileMappedBuffer" init-param of Jetty has to be set to false to prevent file locking.
You can use a local version of the jetty plugin and modify the above-mentioned property on [jetty-plugin]/grails-app/conf/webdefault.xml

Related

How to generate grails jar components for glassfish

Found in this tuto the cmd to deploy a grails app on Glassfish application server:
asadmin deploy --libraries $GRAILS_HOME/lib/glassfish-grails.jar helloworld-0.1.war
Browsing to $GRAILS_HOME/lib/ , don't find glassfish-grails.jar file .
From where can someone get this library ? i mean :glassfish-grails.jar
That stuff is badly dated and I don't think they've updated it in 4 years. For some reason it didn't even appear to be open source when I look at this a year or so ago.
There was plugin but it's almost as dated. The repo has seen some updates fairly recently, so if you wanted to get this thing to the finish line it seems very doable and I think it'd be a great addition.
I would be willing to help out some after the holidays It looks like just updating the glassfish-embedded-all dependency to 'org.glassfish.main.extras:glassfish-embedded-all:4.1' and ensuring that the plugin code compiles would be a chunk of the work, with ensuring that it functions being the remaining :) See http://mvnrepository.com/ for more info, dependencies, etc.
Feel free to email me if you get stuck or want to know anything about getting a new server to act like Tomcat and Jetty do in run-app - I've worked on both of those.
The tutorial was written for the Glassfish v3 Prelude version, a very early version of Glassfish 3, and seems to be invalid for current versions of Glassfish 3.
The file glassfish-grails.jar doesn't exist anymore in the GRAILS lib folder, but it isn't needed anyway.
To make a shared-war (a WAR without the lib files) work, you have to do the following:
Copy all the libs from $GRAILS_HOME/lib/ to $GLASSFISH_HOME/glassfish/lib/.
Deploy it via: asadmin deploy helloworld-0.1.war (or use the Glassfish Admin GUI)
Everything else should work as described in the tutorial.
See also:
Grails - trying to deploy a nojars application into glassfish 3.0.1

What Grails Version is Needed for WeCeem

I have literally tried every possible combination that I can think of to install weceem as a plugin into an existing sample application that I'm practicing grails development on, nothing has worked. I've tried all the recommended repositories in various combinations and that did not work. I have tried several versions of grails between 2.3.7 to 2.4.2 and cannot get it to work. I followed the documentation on the site for installing the plugin and was not able to get it to successfully work.
Is there another CMS that runs in grails applications that's worth looking at?
Yes, there is one (indeed a new one) called spud cms which can be used. BTW, what was the error you were getting while using weceem plugin?
The plugin should be defined in the plugin section in BuildConfig.groovy as:
plugins {
compile ":weceem:1.2"
}
The plugin should work for version of grails-2.3.x (version 2.3.7 should be ok -- the demo application for weceem you can find there https://github.com/jCatalog/weceem-app ); the version of grails-2.4 is not supported yet in weceem-1.2 (but should be supported in new release that is planned in month or two). Please, provide the error stack-trace, to see the problem.
After some help from July Antonicheva, this is what I did to get it working:
1) Switched to NetBeans IDE
2) I downloaded version 7 of Java (Oracle)
3) Created a brand new project based on Grails 2.3.7
4) Added weceem plugin and made some adjustments to Datasource.groovy to add MySQL support
Everything is working fine now without errors. The current version of weceem needs Grails 2.3.7 and Java 7 in order for it work. I mentioned that I switched to NetBeans IDE, I found it to be a little easier to work with than eclipse and for some reason it seemed to run a little faster.

Grails extension in SpringSource Tool Suite errors

I recently installed SpringSource Tool Suite. And I want to start working with Grails projects. So, I went to the Dashboard -> Extension, where I saw two extensions: Grails (current production release) and Grails Support as in the image below.
But when I try to install them, I get the following errors :
Problems occurred while performing installation: Operation details
Operation details
Cannot complete the install because one or more required items could not be found.
Software currently installed: Shared profile 1.0.0.1340820181092 (SharedProfile_com.springsource.sts.ide 1.0.0.1340820181092)
Missing requirement: Shared profile 1.0.0.1340820181092 (SharedProfile_com.springsource.sts.ide 1.0.0.1340820181092) requires 'org.maven.ide.eclipse [1.0.100.20110804-1717]' but it could not be found
What can I do to resolve this error ? Or are there any other options I can follow to install Grails extension?
Thank you!
I would switch to the new "Groovy/Grails Tool Suite" that was recently announced (see http://www.springsource.org/node/3582). Go to the standard download page at http://www.springsource.org/downloads/sts and click "Other Downloads >". Download the version for your OS under "Milestone Version - Groovy/Grails Tool Suite 3.0.0.M2".
It is a beta/milestone release but I've been using it since it was released and it's as stable as a final release so far. It's convenient since the Groovy-Eclipse plugin and the Grails support are already configured for you, in addition to the latest Grails (2.0.4). Any other plugins that you need from the standard STS can always be installed using the standard install/update procedure.
Yes, what #BurtBeckwith said. You should move to the new GGTS.
However, to address your particular problem, you installed STS into a read-only directory (or in C:\Program files). You need to re-install it somewhere else.
The Eclipse p2 installer cannot handle installing feature patches into a read-only directory. Groovy-Eclipse ships with a feature patch to extend the JDT compiler. I believe that this problem was fixed in the Juno release of Eclipse (4.2), which came out last week.
Deleting corresponding application from Windows memory removed the problem (Grails extension in SpringSource Tool Suite errors). Double running applications (earlier and new) could also be reason why GGS or STS sometimes cannot save .groovy files (with error message or without).

IntelliJ IDEA/ Grails not resolving plugins

I have been using IntelliJ for almost a year ad I have always been really happy with it. However, yesterday I set it up on my new laptop (Ubuntu 11.04), and haven't seen the plugins module since.. :-(
Ran grails clean, tried to change the project structure/settings to include $HOME/.grails/1.3.x/projects/projectName/plugins, but still nothing. My understanding is that it should pick up the plugins automatically, am I right?
For the record, I am using Grails 1.3.4, IntelliJ IDEA Ultimate 9.0.4.
I'd strongly recommend switching to the latest Intellij version (10.5.1 as of now). Support for Grails has been improved a lot since 9.x. If you don't want to upgrade, check the following areas:
are all used classpath variables set correctly?
are you referencing the correct Grails version?
I'm using IntelliJ 11.1.3 with Grails 2.1.1.
General Issue:
The IDE Build/Make Project/Run Unit-tests sometimes fails to resolve classes referenced as dependencies within Plugins and produces 'no class...' errors. Normal grails targets (compile, run-app, test-app) work without issue!
Workaround:
Restarting IntelliJ 'magically' corrected my Plugin related 'no class...' errors.
What didn't work:
grails resolve-dependencies (makes sense because grails run-app worked fine!)
grails clean (again makes sense this is just purging the output)
Seems like the IDE Build/Make Project/Run Unit-tests uses a stale classpath in some circumstances. Unfortunately I don't have a repeatable test case but noticed that modifying BuildConfig and doing grails refresh-dependencies or compile or run-app doesn't make the IDE update it's list of grailsPlugins!
I've had IDEA do this once in a while to me as well. Even in the latest version (though I do agree you should upgrade, but 9->10 isn't free). For me, I just had to kill IDEA and restarted it.
IMPORTANT UPDATE! It will be fixed in 11.1.2! YEEAAAH!
In my case plugins not resolving because of custom system property 'grails.work.dir'. If your project using default 'grails.work.dir' than OK otherwise plugins won't be resolved. Tested on Idea 10.5.4, 11.1.1 and windows 7.

How do I upgrade the Grails version for an existing application?

I have an example Grails application (from Grails in Action) that was created a while ago under version 1.1.1 on a different PC.
I am now loading Grails 1.2.0 and want to revisit the app. However, when I try to run it I get this message:
Application expects grails version [1.1.1], but GRAILS_HOME is version [1.2.0] - use the correct Grails version or run 'grails upgrade' if this Grails version is newer than the version your application expects.
After reading around a bit I cleared out the 1.2.0 folder under .grails in my home directory (from previous attempts while exploring the issue), ran "grails clean" and "grails upgrade" (answering "y" where prompted).
However, I consistently get "Invalid duplicate class definition" conflicts between classes in \grails\qotd\src\java and \grails\qotd\grails-app{controllers,services,conf}.
Are there any additional manual steps that I need to perform?
I understood your problem.
The solution is just modify the grails vesion to 1.2.0 in application.properties file in your application
If, as you pointed out in the comments, your /src/java contains .groovy files - that could definitely cause unexpected behavior. I haven't hit your particular issue, but any time I had a .groovy file mismatched with the class name inside it, I'd get strange compilation issues - so I guess you could be having a similar issue.
If you have files / classes with the same names in two locations, that's the likely culprit. If you have .groovy files in /src/java, that's another potential source.
Also, putting BootStrap, Config, DataSource and URLMappings into /src/java, that's another potential source of issues. I'd clear out your /src/java by making sure all the files are in their appropriate places under grails-app.
You can upgrade grails version with 5 steps
Project -> Clean
application.properties -> Change app.grails.version
Your project -> Properties -> Grails -> Change grails installation
to new grails version.
Your project -> Grails tools -> Refresh Dependencies
I think this may be help you

Resources