Showing posts with label Tips. Show all posts
Showing posts with label Tips. Show all posts

[SOLVED] Hangs while Configuring CLASSPATH

Posted by Anantha Narayanan On 11:15 AM

I had created a new app in grails, and my colleague was trying to access this app after copying this folder to his local machine. Our environments were setup as follows:

GRAILS Version - 2.4.0
GROOVY Version - 2.3.3
JAVA Version - 1.8

Both of our environments matched. When he created a fresh application, grails created the application, however he was not able to run the application. The same was case with the copied application.

After 5 odd minutes the error was thrown into the screen:

C:\MyTrainigs\GroovyApp\test123>grails
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=32m; support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; sup
| Configuring classpath
| Error Resolve error obtaining dependencies: Failed to read artifact descriptor for xalan erializer:jar:2.7.1 (Use --stacktrace to see the full trace)
| Error Required Grails build dependencies were not found. This is normally due to internet connectivity issues (such as a misconfigured proxy) or missing repositories in grails-app/conf/BuildConfig.groovy. Please verify your configuration to continue.


Only then we realized that this is internet access issue as grails pointed out. We were both accessing the application from corporate network, through internet proxy. The my colleague tried to access internet through data card and it worked. He was able to execute the application.

So if you have tried all other resolutions and if it has not worked, setup your proxy in startGrails.bat and it will work.

The example for setting up this is as below:
set JAVA_OPTS=%JAVA_OPTS% -Dhttps.proxyHost=yourproxyserver -Dhttps.proxyPort=proxyport

Let me know if this works for you.

Difference between nullable and blank

Posted by Anantha Narayanan On 12:10 AM

What is the difference between nullable and blank constraints in Grails domain class? 

Consider the following constraint defined within a domain class:
Package nulltest

Class Test1{
 String someValue
 static constraints = {
   someValue blank:true
 }
}
Grails while compling and running the application creates the fiels someValue to allow blank value.

You will get the following error if you have a controller action for this domain:
Property [someValue] of class [class nulltest.Test1] cannot be null

This property blank is only applicable for a String field. The reason, the term blank does not sound good for non-string fields. To achieve the same for a non-string field, use nullable constraint here.

Package nulltest

Class Test1{
 BigDecimal someValue
 static constraints = {
   someValue nullable:true
 }
}
Note: By default, all domain class properties have an implicit nullable:false constraint.

Recommended Post Slide Out For Blogger