java.lang.OutOfMemoryError: PermGen space
%GRAILS_HOME%\bin\startGrails.bat
to include the following line (near bottem , e.g. on line 135 of grails1.3.5 startGrails.bat)
set JAVA_OPTS=%JAVA_OPTS% -Xms128m -Xmx512m -XX:MaxPermSize=512m
Stuff I think I should write down so I don't forget it....
java.lang.OutOfMemoryError: PermGen space
class Airport {
String name
static hasMany = [flights: Flight]
static mapping = {
flights lazy: false
}
}
flights association will be loaded at the same time as its Airport instance, although a second query will be executed to fetch the collection. You can also use fetch: 'join' instead of lazy: false
, in which case GORM will only execute a single query to get the
airports and their flights. This works well for single-ended
associations, but you need to be careful with one-to-manys. Queries will
work as you'd expect right up to the moment you add a limit to the
number of results you want. At that point, you will likely end up with
fewer results than you were expecting. The reason for this is quite
technical but ultimately the problem arises from GORM using a left outer
join.fetch: 'join' for single-ended associations and lazy: false for one-to-manys.mvn -Dtest=TestSquare,TestCi*le test
mvn -Dtest=TestCircle#test* test
mvn -Dmaven.tests.skip install
mvn -DskipTests=true isntall
1. Find java.security in /path_to_your_jvm/jre/lib/security
2. Add security.provider.9=org.bouncycastle.jce.provider.BouncyCastleProvider
Security.addProvider(new BouncyCastleProvider());
<Resource accessToUnderlyingConnectionAllowed="false"
defaultAutoCommit="true" defaultReadOnly="false"
driverClassName="com.sybase.jdbc3.jdbc.SybDriver"
factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"
initialSize="0" logAbandoned="false" maxActive="8"
maxIdle="8" maxOpenPreparedStatements="0" maxWait="-1"
minEvictableIdleTimeMillis="1800000" minIdle="0"
name="jdbc/myOtherDS" numTestsPerEvictionRun="3"
password="${my.password}" poolPreparedStatements="false"
removeAbandoned="false" removeAbandonedTimeout="300"
testOnBorrow="true" testOnReturn="false"
testWhileIdle="false" timeBetweenEvictionRunsMillis="-1"
type="javax.sql.DataSource" url="${myOther.url}"
username="${myOther.username}" validationQuery="select @@servername" />
<Resource accessToUnderlyingConnectionAllowed="false"
defaultAutoCommit="true" defaultReadOnly="false"
driverClassName="com.ibm.db2.jcc.DB2Driver"
factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"
initialSize="0" logAbandoned="false" maxActive="8" maxIdle="8"
maxOpenPreparedStatements="0" maxWait="-1"
minEvictableIdleTimeMillis="1800000" minIdle="0"
name="jdbc/myDS" numTestsPerEvictionRun="3"
password="${my.password}" poolPreparedStatements="false"
removeAbandoned="false" removeAbandonedTimeout="300"
testOnBorrow="true" testOnReturn="false" testWhileIdle="false"
timeBetweenEvictionRunsMillis="-1"
type="javax.sql.DataSource" url="${my.url}"
username="${my.username}" validationQuery="SELECT 1 from sysibm.sysdummy1" />
<Context path="myAppUrl" debug="1" reloadable="true" docBase="myAppDocBase" antiResourceLocking="true">
<ResourceLink global="jdbc/myDS" name="jdbc/myDS" type="javax.sql.Datasource"/>
<ResourceLink global="jdbc/myOtherDS" name="jdbc/myOtherDS" type="javax.sql.Datasource"/>
</Context>
Account.findByLabelInList(labels)
static findMyAccount(def name, def country, def accountType, def labels) {
(DcmAccount)DcmAccount.createCriteria().get {
eq("name", name
eq("country", country)
eq("accountType", accountType)
'in'("labels", labels)
}
}
def testB(){
parseCL(this.getClass().getClassLoader()) //This ClassLoader does NOT work
parseCL(AnotherService.getClassLoader()) // This class Loader does work
}
def parseCL(ClassLoader cl){
println "********************"
println cl
println "********************"
println "Parent ="+cl.getParent()
cl = cl.getParent()
def indent = "--"
while(cl){
println indent+cl
cl = cl.getParent()
println indent+"Parent ="+cl
indent = indent +"--"
}
}
******************** java.net.URLClassLoader@247510e7 // DOES NOT LOAD CLASS DYNAMICALLY ******************** Parent =java.net.URLClassLoader@77479ef9 --java.net.URLClassLoader@77479ef9 --Parent =org.codehaus.groovy.grails.cli.support.GrailsRootLoader@15ded0fd ----org.codehaus.groovy.grails.cli.support.GrailsRootLoader@15ded0fd ----Parent =sun.misc.Launcher$AppClassLoader@35a16869 ------sun.misc.Launcher$AppClassLoader@35a16869 ------Parent =sun.misc.Launcher$ExtClassLoader@77cde100 --------sun.misc.Launcher$ExtClassLoader@77cde100 --------Parent =null ******************** java.net.URLClassLoader@77479ef9 // LOADS CLASS DYNAMICALLY ******************** Parent =org.codehaus.groovy.grails.cli.support.GrailsRootLoader@15ded0fd --org.codehaus.groovy.grails.cli.support.GrailsRootLoader@15ded0fd --Parent =sun.misc.Launcher$AppClassLoader@35a16869 ----sun.misc.Launcher$AppClassLoader@35a16869 ----Parent =sun.misc.Launcher$ExtClassLoader@77cde100 ------sun.misc.Launcher$ExtClassLoader@77cde100 --------Parent =null
cmd /? to get some help on the matter)%~dp0/filename does not work. (However you can assign it to a variable
set DIR=%~dp0
set FILE=%DIR%/filename
groovyconsole -cp %CD%\jarfile.jar
import java.util.regex.*
def testString ="abc4567!TheEnd"
def pattern = Pattern.compile("\\D*(\\d*).*") // N.B. Double quotes to escape \ pattern == \D*(\d*).*.. i.e. not a number/ number/ anything
Matcher m = pattern.matcher(testString)
if(m.matches()){
def i=0
while(i<=m.groupCount()) println m.group(i++) }else println "Doesn't match"
"\\D*(\\d(\\d(\\d*))).*"group(0) == abc4567!TheEnd
group(1) == 4567
group(2) == 567
group(3) == 67