User Tools

Site Tools


development:grails:grails25

Upgrading to Grails 2.5

The first step to upgrading is to read and understand the upgrade steps published by grails

Note : Everything below is in addition to what is in the articles above


Grails 2.3 Upgrade Notes

  • The big change here is that aether is used as dependency management instead of ivy, so far, for the SnmpManager and NocPortal upgrade, we have reverted back to ivy as it didn't look like aether was working for us
  • Update the hibernate plugin version to use the latest hibernate 3 version, you can try hibernate 4 if you wish
    • compile “:hibernate:3.6.10.19”
  • Update the tomcat plugin to use the new versioning
    • build “:tomcat:7.0.55.2”
  • Add the scaffolding plugin
    • compile “:scaffolding:2.1.2”
  • Remove spock plugin
  • The remoting plugin needs to be updated, however, if you are interacting with an application that uses the older version of hessian, you need to force the new version of the remoting plugin to use the old hessian jar and include hessian-3.2.0.jar in the lib directory as in the NocPortal
    compile ":remoting:1.3", {
      excludes 'hessian'
    }
  • Upgrade the searchable plugin
    • ':searchable:0.6.9'
  • Note that during both the SnmpManager and NocPortal upgrade, the integration tests never passed, these issues were more easily resolved with Grails 2.5.x

Grails 2.5.5 Upgrade

  • Upgrade quartz
    • compile ':quartz:1.0.2'
    • quartz-monitor is not usable with this version
    • Ensure you update the quartz-shiro exclude
  compile("org.apache.shiro:shiro-quartz:1.2.2") {
      //http://stackoverflow.com/questions/4224484/why-do-grails-quartz-jobs-die-after-a-few-minutes-on-production
      excludes("quartz")
    }
  • Need to use Holders as ApplicationHolder is deprecated
  • Upgrade resources plugin
    • runtime “:resources:1.2.14”
  • If you are using websockets, you probably want to start using tomcat8

Hardcoded Dependencies

It seems that ivy is less than optimal, these were added to the NocPortal to finally resolve all dependency issues

    //THESE ARE REQUIRED BECAUSE WE ARE USING IVY!  MUST BE LOOKED AT EVERY GRAILS UPGRADE!!!!!
    runtime 'org.springframework:spring-aop:4.1.9.RELEASE'//grails needs this and can't resolve it with ivy, be sure to match the other spring jar versions
    runtime 'org.springframework:spring-expression:4.1.9.RELEASE'//grails needs this and can't resolve it with ivy, be sure to match the other spring jar versions
    test 'org.hamcrest:hamcrest-all:1.3'//spock needs this and can't resolve it
    compile 'cglib:cglib:2.2.2'//grails needs this and apate can't find it
    compile 'commons-io:commons-io:2.1'//the GWT plugin needs this
    compile 'org.codehaus.groovy:groovy-all:2.4.5'//required because of this issue https://github.com/grails/grails-core/issues/10011#issuecomment-245138488

Integration Tests

Note that any Integration Tests that extend GroovyTestCase are no longer transactional and thus will not work. The easiest thing to do it is make them JUnit 4 tests and use the @Test, @Before and @After annotation

  • any assertNotNull, assertNull can be changed with Assert.assertNotNull etc - USE SEARCH AND REPLACE, see SnmpConfigTests in the NocPortal
  • any groovy asserts can remian the same
  • import org.junit.Assert
  • import org.junit.Before
  • import org.junit.Test

Forked Mode

It looks as though there's Sql class loading issues when using forked mode, for this reason, it was disabled in the SnmpManager and NocPortal.

BuildConfig.groovy

grails.project.fork = [
    test   : false,
    run    : false,
    war    : false,
    console: false
]//disabled

Errigal Plugin Upgrade

A lot of Errigal Plugin uses Grails 1.3.9 maven-publisher plugin is used to publish plugin but it is deprecated. All you need to do is change that to following plugin

    build "org.grails.plugins:release:3.1.2"

Command to publish plugin is changed.

publish-plugin --repository=errigalPlugins

You don't need to change repository setting in BuildConfig.grovy


Development

Revving CPU

It was noticed that when developing on OSX, the SnmpManager was sometimes revving the CPU and making application navigation very very slow. This seems to be related to grails now using more memory in development when reloading is enabled, if you would like to disable reloading, it will likely fix the issue, you can do so in your run config

However, reloading is great and disabling it sucks. To make grails more performant, ensure your Xms and Xmx are exactly the same, if they are not, it seems to get confused when reloading is enabled.

Secondly, it is more memory hungry when reloading is enabled, therefore, you should add more memory. To get the SnmpManager working nicely with reloading, these properties were used

-Xms2548m -Xmx2548m -XX:PermSize=256m -XX:MaxPermSize=400m

Trouble Debugging

It was noticed on some versions of IDEA that breakpoints were not working. If this happens to you, you should manually add the debug options to the run configuration of your grails application, Run that configuration and attach a new remote debug configuration to the ports you opened.

Add this to your VM options

-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=1044

Create a remote debug configuration


Misc

New quartz tables

#
# In your Quartz properties file, you'll need to set
# org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.StdJDBCDelegate
#
#
# By: Ron Cordell - roncordell
#  I didn't see this anywhere, so I thought I'd post it here. This is the script from Quartz to create the tables in a MySQL database, modified to use INNODB instead of MYISAM.

DROP TABLE IF EXISTS QRTZ_CLUSTER_FIRED_TRIGGERS;
DROP TABLE IF EXISTS QRTZ_CLUSTER_PAUSED_TRIGGER_GRPS;
DROP TABLE IF EXISTS QRTZ_CLUSTER_SCHEDULER_STATE;
DROP TABLE IF EXISTS QRTZ_CLUSTER_LOCKS;
DROP TABLE IF EXISTS QRTZ_CLUSTER_SIMPLE_TRIGGERS;
DROP TABLE IF EXISTS QRTZ_CLUSTER_SIMPROP_TRIGGERS;
DROP TABLE IF EXISTS QRTZ_CLUSTER_CRON_TRIGGERS;
DROP TABLE IF EXISTS QRTZ_CLUSTER_BLOB_TRIGGERS;
DROP TABLE IF EXISTS QRTZ_CLUSTER_TRIGGERS;
DROP TABLE IF EXISTS QRTZ_CLUSTER_JOB_DETAILS;
DROP TABLE IF EXISTS QRTZ_CLUSTER_CALENDARS;

CREATE TABLE QRTZ_CLUSTER_JOB_DETAILS(
SCHED_NAME VARCHAR(120) NOT NULL,
JOB_NAME VARCHAR(200) NOT NULL,
JOB_GROUP VARCHAR(200) NOT NULL,
DESCRIPTION VARCHAR(250) NULL,
JOB_CLASS_NAME VARCHAR(250) NOT NULL,
IS_DURABLE VARCHAR(1) NOT NULL,
IS_NONCONCURRENT VARCHAR(1) NOT NULL,
IS_UPDATE_DATA VARCHAR(1) NOT NULL,
REQUESTS_RECOVERY VARCHAR(1) NOT NULL,
JOB_DATA BLOB NULL,
PRIMARY KEY (SCHED_NAME,JOB_NAME,JOB_GROUP))
ENGINE=InnoDB;

CREATE TABLE QRTZ_CLUSTER_TRIGGERS (
SCHED_NAME VARCHAR(120) NOT NULL,
TRIGGER_NAME VARCHAR(200) NOT NULL,
TRIGGER_GROUP VARCHAR(200) NOT NULL,
JOB_NAME VARCHAR(200) NOT NULL,
JOB_GROUP VARCHAR(200) NOT NULL,
DESCRIPTION VARCHAR(250) NULL,
NEXT_FIRE_TIME BIGINT(13) NULL,
PREV_FIRE_TIME BIGINT(13) NULL,
PRIORITY INTEGER NULL,
TRIGGER_STATE VARCHAR(16) NOT NULL,
TRIGGER_TYPE VARCHAR(8) NOT NULL,
START_TIME BIGINT(13) NOT NULL,
END_TIME BIGINT(13) NULL,
CALENDAR_NAME VARCHAR(200) NULL,
MISFIRE_INSTR SMALLINT(2) NULL,
JOB_DATA BLOB NULL,
PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
FOREIGN KEY (SCHED_NAME,JOB_NAME,JOB_GROUP)
REFERENCES QRTZ_CLUSTER_JOB_DETAILS(SCHED_NAME,JOB_NAME,JOB_GROUP))
ENGINE=InnoDB;

CREATE TABLE QRTZ_CLUSTER_SIMPLE_TRIGGERS (
SCHED_NAME VARCHAR(120) NOT NULL,
TRIGGER_NAME VARCHAR(200) NOT NULL,
TRIGGER_GROUP VARCHAR(200) NOT NULL,
REPEAT_COUNT BIGINT(7) NOT NULL,
REPEAT_INTERVAL BIGINT(12) NOT NULL,
TIMES_TRIGGERED BIGINT(10) NOT NULL,
PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
REFERENCES QRTZ_CLUSTER_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP))
ENGINE=InnoDB;

CREATE TABLE QRTZ_CLUSTER_CRON_TRIGGERS (
SCHED_NAME VARCHAR(120) NOT NULL,
TRIGGER_NAME VARCHAR(200) NOT NULL,
TRIGGER_GROUP VARCHAR(200) NOT NULL,
CRON_EXPRESSION VARCHAR(120) NOT NULL,
TIME_ZONE_ID VARCHAR(80),
PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
REFERENCES QRTZ_CLUSTER_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP))
ENGINE=InnoDB;

CREATE TABLE QRTZ_CLUSTER_SIMPROP_TRIGGERS
  (         
    SCHED_NAME VARCHAR(120) NOT NULL,
    TRIGGER_NAME VARCHAR(200) NOT NULL,
    TRIGGER_GROUP VARCHAR(200) NOT NULL,
    STR_PROP_1 VARCHAR(512) NULL,
    STR_PROP_2 VARCHAR(512) NULL,
    STR_PROP_3 VARCHAR(512) NULL,
    INT_PROP_1 INT NULL,
    INT_PROP_2 INT NULL,
    LONG_PROP_1 BIGINT NULL,
    LONG_PROP_2 BIGINT NULL,
    DEC_PROP_1 NUMERIC(13,4) NULL,
    DEC_PROP_2 NUMERIC(13,4) NULL,
    BOOL_PROP_1 VARCHAR(1) NULL,
    BOOL_PROP_2 VARCHAR(1) NULL,
    PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
    FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
    REFERENCES QRTZ_CLUSTER_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP))
ENGINE=InnoDB;

CREATE TABLE QRTZ_CLUSTER_BLOB_TRIGGERS (
SCHED_NAME VARCHAR(120) NOT NULL,
TRIGGER_NAME VARCHAR(200) NOT NULL,
TRIGGER_GROUP VARCHAR(200) NOT NULL,
BLOB_DATA BLOB NULL,
PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
INDEX (SCHED_NAME,TRIGGER_NAME, TRIGGER_GROUP),
FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
REFERENCES QRTZ_CLUSTER_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP))
ENGINE=InnoDB;

CREATE TABLE QRTZ_CLUSTER_CALENDARS (
SCHED_NAME VARCHAR(120) NOT NULL,
CALENDAR_NAME VARCHAR(200) NOT NULL,
CALENDAR BLOB NOT NULL,
PRIMARY KEY (SCHED_NAME,CALENDAR_NAME))
ENGINE=InnoDB;

CREATE TABLE QRTZ_CLUSTER_PAUSED_TRIGGER_GRPS (
SCHED_NAME VARCHAR(120) NOT NULL,
TRIGGER_GROUP VARCHAR(200) NOT NULL,
PRIMARY KEY (SCHED_NAME,TRIGGER_GROUP))
ENGINE=InnoDB;

CREATE TABLE QRTZ_CLUSTER_FIRED_TRIGGERS (
SCHED_NAME VARCHAR(120) NOT NULL,
ENTRY_ID VARCHAR(95) NOT NULL,
TRIGGER_NAME VARCHAR(200) NOT NULL,
TRIGGER_GROUP VARCHAR(200) NOT NULL,
INSTANCE_NAME VARCHAR(200) NOT NULL,
FIRED_TIME BIGINT(13) NOT NULL,
SCHED_TIME BIGINT(13) NOT NULL,
PRIORITY INTEGER NOT NULL,
STATE VARCHAR(16) NOT NULL,
JOB_NAME VARCHAR(200) NULL,
JOB_GROUP VARCHAR(200) NULL,
IS_NONCONCURRENT VARCHAR(1) NULL,
REQUESTS_RECOVERY VARCHAR(1) NULL,
PRIMARY KEY (SCHED_NAME,ENTRY_ID))
ENGINE=InnoDB;

CREATE TABLE QRTZ_CLUSTER_SCHEDULER_STATE (
SCHED_NAME VARCHAR(120) NOT NULL,
INSTANCE_NAME VARCHAR(200) NOT NULL,
LAST_CHECKIN_TIME BIGINT(13) NOT NULL,
CHECKIN_INTERVAL BIGINT(13) NOT NULL,
PRIMARY KEY (SCHED_NAME,INSTANCE_NAME))
ENGINE=InnoDB;

CREATE TABLE QRTZ_CLUSTER_LOCKS (
SCHED_NAME VARCHAR(120) NOT NULL,
LOCK_NAME VARCHAR(40) NOT NULL,
PRIMARY KEY (SCHED_NAME,LOCK_NAME))
ENGINE=InnoDB;

CREATE INDEX IDX_QRTZ_CLUSTER_J_REQ_RECOVERY ON QRTZ_CLUSTER_JOB_DETAILS(SCHED_NAME,REQUESTS_RECOVERY);
CREATE INDEX IDX_QRTZ_CLUSTER_J_GRP ON QRTZ_CLUSTER_JOB_DETAILS(SCHED_NAME,JOB_GROUP);

CREATE INDEX IDX_QRTZ_CLUSTER_T_J ON QRTZ_CLUSTER_TRIGGERS(SCHED_NAME,JOB_NAME,JOB_GROUP);
CREATE INDEX IDX_QRTZ_CLUSTER_T_JG ON QRTZ_CLUSTER_TRIGGERS(SCHED_NAME,JOB_GROUP);
CREATE INDEX IDX_QRTZ_CLUSTER_T_C ON QRTZ_CLUSTER_TRIGGERS(SCHED_NAME,CALENDAR_NAME);
CREATE INDEX IDX_QRTZ_CLUSTER_T_G ON QRTZ_CLUSTER_TRIGGERS(SCHED_NAME,TRIGGER_GROUP);
CREATE INDEX IDX_QRTZ_CLUSTER_T_STATE ON QRTZ_CLUSTER_TRIGGERS(SCHED_NAME,TRIGGER_STATE);
CREATE INDEX IDX_QRTZ_CLUSTER_T_N_STATE ON QRTZ_CLUSTER_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP,TRIGGER_STATE);
CREATE INDEX IDX_QRTZ_CLUSTER_T_N_G_STATE ON QRTZ_CLUSTER_TRIGGERS(SCHED_NAME,TRIGGER_GROUP,TRIGGER_STATE);
CREATE INDEX IDX_QRTZ_CLUSTER_T_NEXT_FIRE_TIME ON QRTZ_CLUSTER_TRIGGERS(SCHED_NAME,NEXT_FIRE_TIME);
CREATE INDEX IDX_QRTZ_CLUSTER_T_NFT_ST ON QRTZ_CLUSTER_TRIGGERS(SCHED_NAME,TRIGGER_STATE,NEXT_FIRE_TIME);
CREATE INDEX IDX_QRTZ_CLUSTER_T_NFT_MISFIRE ON QRTZ_CLUSTER_TRIGGERS(SCHED_NAME,MISFIRE_INSTR,NEXT_FIRE_TIME);
CREATE INDEX IDX_QRTZ_CLUSTER_T_NFT_ST_MISFIRE ON QRTZ_CLUSTER_TRIGGERS(SCHED_NAME,MISFIRE_INSTR,NEXT_FIRE_TIME,TRIGGER_STATE);
CREATE INDEX IDX_QRTZ_CLUSTER_T_NFT_ST_MISFIRE_GRP ON QRTZ_CLUSTER_TRIGGERS(SCHED_NAME,MISFIRE_INSTR,NEXT_FIRE_TIME,TRIGGER_GROUP,TRIGGER_STATE);

CREATE INDEX IDX_QRTZ_CLUSTER_FT_TRIG_INST_NAME ON QRTZ_CLUSTER_FIRED_TRIGGERS(SCHED_NAME,INSTANCE_NAME);
CREATE INDEX IDX_QRTZ_CLUSTER_FT_INST_JOB_REQ_RCVRY ON QRTZ_CLUSTER_FIRED_TRIGGERS(SCHED_NAME,INSTANCE_NAME,REQUESTS_RECOVERY);
CREATE INDEX IDX_QRTZ_CLUSTER_FT_J_G ON QRTZ_CLUSTER_FIRED_TRIGGERS(SCHED_NAME,JOB_NAME,JOB_GROUP);
CREATE INDEX IDX_QRTZ_CLUSTER_FT_JG ON QRTZ_CLUSTER_FIRED_TRIGGERS(SCHED_NAME,JOB_GROUP);
CREATE INDEX IDX_QRTZ_CLUSTER_FT_T_G ON QRTZ_CLUSTER_FIRED_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP);
CREATE INDEX IDX_QRTZ_CLUSTER_FT_TG ON QRTZ_CLUSTER_FIRED_TRIGGERS(SCHED_NAME,TRIGGER_GROUP);

commit;

Testing

Run single integration test (single integration test method): test-app integration: ClusterServiceTests.testVisibilitiesWithFullInfoCanSync –verbose

How to test your views: http://mrhaki.blogspot.ie/2013/05/grails-goodness-testing-views-and.html

Mocking static methods in Groovy: https://gist.github.com/jvmvik/6782130

development/grails/grails25.txt · Last modified: 2021/06/25 10:09 by 127.0.0.1