How to generate grails jar components for glassfish - grails

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

Related

Grails - Message bundles (i18n) broken for war build only

After upgrading from 2.5.5 to 3.1.1, when I build my application as an executable war (or deploy to tomcat container), messages cannot be resolved from message.properties or any i18n properties files.
org.springframework.context.NoSuchMessageException: No message found under code 'timeZoneId' for locale 'en_US'.
When run in IntelliJ, it all works fine.
In terms of configuration, I’ve tried to make my build as close to the “out of box” Grails app as possible.
I’m wondering if anyone could provide a hint or suggestion as an avenue of investigation I could travel down as I’m just about out of ideas. Happy to add configuration detail as requested.
I'm using a multi-module build with a plugin as a dependency.
I suspect that maybe you have done some modification on your Grails project (2.5.5) that cant be support on the newest grails 3.3.0.
I would suggest you to check 3.3.0 documentation on how to customise your msg.
You can refer to https://docs.grails.org/latest/guide/validation.html. There is an example of how to modify your own label or msg.
In the case of the blank constraint this would be user.login.blank so you would need a message such as the following in your grails-app/i18n/messages.properties file:
user.login.blank=Your login name must be specified!
Hope it helps. Cheers

Grails run-app 'Application metadata not found'

I downloaded a serverpush example called GrailsChat and trying to run is on grails 2.4.4.
I had some issues with dependencies missing that took me a while to figure out (don't think it's related but just mentioning it).
When I run grails run-app I get:
| Application metadata not found, please run: grails upgrade
When I run grails upgrade I get
| Script 'Upgrade' not found, did you mean:
1) MigrateDocs
2) IntegrateWith
3) SetGrailsVersion
4) InstallDependency
5) DependencyReport
> Please make a selection or enter Q to quit:
I figure the issue is probably to do with the grails version I have being newer than the grails version that the sample app was targetting but I don't want to move back version simply to run an example (I'd rather understand the underlying issue).
Can anyone point me to some documentation that will help me understand what the application metadata is and how to move forward please?
Grails Upgrade command is removed in 2.4. You might have to upgrade the app manually following the guide.
Or you can just run the service wrapper which will download the grails version automatically base on the app.
./grailsw run-app
It seems like you have missed any one of mentioned
Not set grails proper Version
Missing application.properties file (with proper grails version)

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 2.4.0.RC1 seems to lock javascript files on Windows 7 - 64bit

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

Grails JBOSSAS Plugin -- How To get it To Work?

Newbie Question:
I've been required to deploy a grails app to jboss 5. I'm having a hell of a time figuring out how to take advantage of the grails jbossas plugin. I've followed the documentation as best as I know how, but I get the same exceptions just as if the plugin was never there.
Here's the documentation i've been following:
http://grails-plugins.github.com/grails-jbossas/docs/manual/guide/2%20Usage.html
I've added the plugin to the BuildConfig.groovy plugin{} closure. I then called grails war. Nothing happens and my war deploy bombs out.
Could somebody give a newbie a little hand holding to get this plugin to work? Unfortunately, I'm finding the documentation to be wanting in the regard of actually telling you how to use it, or when the plugin will do its magic.
UPDATE:
My environment:
Mac OS X Lion Dev machine
Grails 2.0.3
JBoss 5.1.0 -- running a Liferay instance.
Burt, I've done the following:
grails generate-jboss-deploy 5
grails war.
scp the generated war file to the deploy-jboss directory on my remote server.
Dutifully, jboss picked up the new war and attempted to deploy it. I'm getting the following (now dreaded) exception:
Caused by: java.lang.NoSuchMethodException: org.hibernate.validator.ClassValidator
Per the usage instructions, I've modified Datasource.groovy's hibernate configuration:
hibernate {
cache.use_second_level_cache = true
cache.use_query_cache = true
cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory'
validator.apply_to_ddl = false
validator.autoregister_listeners = false
}
The only file that seems to have been modified or created by running the generate-jboss-delpoy 5 script is WEB-INF/jboss-web.xml. It's contents are:
<jboss-web>
<class-loading java2ClassLoadingCompliance="false">
<loader-repository>
sappi-label:loader=sappi-label.war
<loader-repository-config>java2ParentDelegation=false</loader-repository-config>
</loader-repository>
</class-loading>
</jboss-web>
I confirmed that the jboss-web.xml file is present in the generated war file (exploded, then checked the directory).
Burt: what files other than jboss-web.xml should have been altered?
UPDATE (Again):
I don't think there's anything wrong with the jbossas plugin. I've done more testing and see that the plugin is doing what it is supposed to do: remove jars, put in jboss-web.xml. I haven't been able to confirm that it modifies the hibernate config, but I assume it is. I think the problem lies within the server I'm attempting to deploy to, a Liferay instance.
regardless of what I'm doing I get an exception saying that slf4j was unable to load successfully. Nothing more, nothing less. I'll keep whacking away at the problem, but it is out of scope of my original question. Burt, thanks for your help. If you have any ideas about why slf4j vomits in a Liferay/jboss environment, please let me know.
Regards.
Thanks!
I guess I didn't make it clear that you need to run the generate-jboss-deploy script, passing in the major version of JBoss that you're using, so in your case generate-jboss-deploy 5. I've updated the docs to describe this.
If this doesn't help please update your question with some indication of what the errors that you're seeing are.

Resources