Showing posts with label Grail. Show all posts
Showing posts with label Grail. Show all posts

Tuesday, October 2, 2012

java.lang.IllegalStateException: Imbalanced frame stack! (exit() called too many times) !

If you started using SpringSource Insight,It's highly recommended to increase the memory of the tc Runtime Instance to more than what your application requires on its own . The following is the exception you might see in case there is not enough memory.
type Exception report

descriptionThe server encountered an internal error () that prevented it from fulfilling this request.
java.lang.IllegalStateException: Imbalanced frame stack! (exit() called too many times)

note The full stack trace of the root cause is available in the VMware vFabric tc Runtime 2.6.2.RELEASE/7.0.22.A.RELEASE logs.

There are few options to resolve this issue.
  1. Increase the max heap
    For example: -Xmx512m
  2. or max PermGen size JVM option.
    For example: -XX:MaxPermSize=256m
  3. Increase the Spring insight max frame
    For example: -Dinsight-max-frames=6000
OR you can have all of the above JVM parameters.


Tuesday, October 13, 2009

Read a variable defined on the config file from a controller in a grail application

Let's say, you have the config.groovy file as follow.


environments {
production {
myVariable1="I am variable1 on RPOD"
myVariable1="I am variable1 on RPOD"

development {
myVariable1="I am variable1 on DEV"
myVariable1="I am variable1 on RPOD"

log4j {
appender.stdout = "org.apache.log4j.ConsoleAppender"

Now the above varaible can be easily access through any of the controller as follow.

def config = ConfigurationHolder.config
def myVaraible1 = config.myVaraible1
def myVaraible2 = config.myVaraible2


Tuesday, November 4, 2008

Spring’s JDBC Template Set Up for a Grail Application

To take an advantage of the Spring JDBC Template for any Grail application, the first thing you need to do, is to define the DataSource bean in resources.groovy , Don’t forget to have the jdbc driver(.jar) corresponding to your backend database server under the lib folder of your grail application.

For example ,resources.groovy is shown as below,

import org.springframework.jdbc.core.JdbcTemplate
import org.apache.commons.dbcp.BasicDataSource

beans = {
myDataSource(BasicDataSource) {
driverClassName = "oracle.jdbc.OracleDriver"
url ="jdbc:oracle:thin:@ . . . . . “
username = "myUser"
password = "myPass"


If you have used MS SQL server as your back end database, the driver class name and the url format is as follow.

myDataSource(BasicDataSource) {
driverClassName = ""
url = "jdbc:microsoft:sqlserver://myDataBaseServerURL"

Similarly for MYSQL database server, the driver class name and the url format could be as follows :

dataSource {
driverClassName = "com.mysql.jdbc.Driver"
url = "jdbc:mysql:// myDataBaseServerURL "
username = "myUser"
password = "myPass"

Once its set up you can simply make a query as follows
myResult = jdbcTemplate.queryForList (myQuery)

where myQuery is the query that needs to be execute on the remoteDatabase.


 © 2006-2010