I have been having a lot of trouble using an external JAR, GPars, in an IntelliJ Grails project. I think it is a problem with specifying the dependency. I am using GPars-1.0.0. I saved it in the lib directory and included it as a dependency using the IntelliJ GUI-- Project Structure -> Module -> Add. I synchronized. I also tried adding directly to BuildConfig.groovy:
dependencies {
compile 'org.codehaus.gpars:gpars:1.0.0'
}
I get Code Assist when typing and it compiles. But when I run the following:
import static groovyx.gpars.*
...
GParsPool.withPool {
[1, 2, 3, 4, 5].eachParallel { println it }
}
I get ClassNotFoundException Message jsr166y.ForkJoinPool for the statement "GParsePool.withPool"
Line | Method
->> 156 | findClass in org.codehaus.groovy.tools.RootLoader
| 306 | loadClass in java.lang.ClassLoader
| 128 | loadClass . . . . . . . . in org.codehaus.groovy.tools.RootLoader
| 247 | loadClass in java.lang.ClassLoader
| 2427 | privateGetDeclaredMethods in java.lang.Class
| 1791 | getDeclaredMethods in ''
| 46 | getLocked . . . . . . . . in org.codehaus.groovy.util.LazyReference
| 33 | get in ''
| 80 | load . . . . . . . . . . in allison.zipcode.ZipcodeService$$ENsSBrUW
| 30 | load in allison.zipcode.CountryController
| 195 | doFilter . . . . . . . . in grails.plugin.cache.web.filter.PageFragmentCachingFilter
| 63 | doFilter in grails.plugin.cache.web.filter.AbstractFilter
| 886 | runTask . . . . . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
| 908 | run in ''
^ 680 | run . . . . . . . . . . . in java.lang.Thread
Any ideas? Did I specify the dependency correctly in BuildConfig? My code example may be wrong but it seems to follow this example.
Figured it out: I hadn't included jsr166y.jar
compile "org.codehaus.jsr166-mirror:jsr166y:1.7.0"
Related
I am using grails 2.5.2 and working on a taglib. When I execute grails run-app everything runs fine, but whenever I make a change in my taglib and save the file I get the following error
Error |
2016-02-26 16:29:30,628 [Thread-9] ERROR plugins.AbstractGrailsPluginManager - Plugin [groovyPages:2.5.2] could not reload changes to file [D:\...\BootstrapTagLib.groovy]: Ambiguous method overloading for method grails.spring.BeanBuilder#registerBeans.
Cannot resolve which method to invoke for [null] due to overlapping prototypes between:
[interface org.codehaus.groovy.grails.commons.spring.RuntimeSpringConfiguration]
[interface org.springframework.beans.factory.support.BeanDefinitionRegistry]
Message: Ambiguous method overloading for method grails.spring.BeanBuilder#registerBeans.
Cannot resolve which method to invoke for [null] due to overlapping prototypes between:
[interface org.codehaus.groovy.grails.commons.spring.RuntimeSpringConfiguration]
[interface org.springframework.beans.factory.support.BeanDefinitionRegistry]
Line | Method
->> 3241 | chooseMostSpecificParams in groovy.lang.MetaClassImpl
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 3194 | chooseMethodInternal in ''
| 3137 | chooseMethod . . . . . . . . in ''
| 1328 | getMethodWithCachingInternal in ''
| 3405 | createPogoCallSite . . . . . in ''
| 1314 | createPogoCallSite in groovy.lang.ExpandoMetaClass
| 150 | createPogoSite . . . . . . . in org.codehaus.groovy.runtime.callsite.CallSiteArray
| 164 | createCallSite in ''
| 48 | defaultCall . . . . . . . . in ''
| 113 | call in org.codehaus.groovy.runtime.callsite.AbstractCallSite
| 125 | call . . . . . . . . . . . . in ''
| 342 | doCall in org.codehaus.groovy.grails.plugins.web.GroovyPagesGrailsPlugin$_closure5
| -2 | invoke0 . . . . . . . . . . in sun.reflect.NativeMethodAccessorImpl
| 57 | invoke in ''
| 43 | invoke . . . . . . . . . . . in sun.reflect.DelegatingMethodAccessorImpl
| 606 | invoke in java.lang.reflect.Method
| 1426 | jlrMethodInvoke . . . . . . in org.springsource.loaded.ri.ReflectiveInterceptor
| 93 | invoke in org.codehaus.groovy.reflection.CachedMethod
| 325 | doMethodInvoke . . . . . . . in groovy.lang.MetaMethod
| 1210 | invokeMethod in groovy.lang.MetaClassImpl
| 1123 | invokeMethod . . . . . . . . in groovy.lang.ExpandoMetaClass
| 1019 | invokeMethod in groovy.lang.MetaClassImpl
| 426 | call . . . . . . . . . . . . in groovy.lang.Closure
| 767 | invokeOnChangeListener in org.codehaus.groovy.grails.plugins.DefaultGrailsPlugin
| 716 | notifyOfEvent . . . . . . . in ''
| 731 | notifyOfEvent in ''
| 408 | informOfClassChange . . . . in org.codehaus.groovy.grails.plugins.AbstractGrailsPluginManager
| 366 | informOfFileChange in ''
| 226 | informPluginManager . . . . in org.codehaus.groovy.grails.project.compiler.GrailsProjectWatcher
| 48 | access$400 in ''
| 152 | onNew . . . . . . . . . . . in org.codehaus.groovy.grails.project.compiler.GrailsProjectWatcher$1
| 76 | fireOnNew in org.codehaus.groovy.grails.compiler.AbstractDirectoryWatcher
| 104 | run . . . . . . . . . . . . in org.codehaus.groovy.grails.compiler.WatchServiceDirectoryWatcher
| 154 | run in org.codehaus.groovy.grails.compiler.DirectoryWatcher
^ 161 | run . . . . . . . . . . . . in org.codehaus.groovy.grails.project.compiler.GrailsProjectWatcher
I investigated a bit and found the following JIRA which says that this error was fixed since grails 2.3.3. I´ll be working extensively with taglibs, and having to restart the app every time I make a change is very time consuming.
Is there an override I could do in in resources.groovy? Is this error present in grails 2.5.3 or 2.5.1?
Good day and thanks.
We have a rather ancient Grails site (2.3) that has been serving our needs for quite a while. The server needs to call out to another service for customer details, and that service will soon require TLS 1.1 or higher only. Our site is running on java 1.7, which should support TLS 1.1 and 1.2, but requires it to be enabled explicitly. I'm having trouble enabling it in the grails site.
Primarily what I've tried is to start grails by running
grails -Dhttps.protocols=TLSv1.1 run-app
based on the instructions here, and the hint here. But when I do, the socket is still closed when I try to login to the other site:
Message: Connection reset
Line | Method
->> 196 | read in java.net.SocketInputStream
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 122 | read in ''
| 82 | flushBuffer . . . . . . in java.io.BufferedOutputStream
| 140 | flush in ''
| 191 | flush . . . . . . . . . in org.apache.commons.httpclient.ChunkedOutputStream
| 99 | flush in com.ctc.wstx.io.UTF8Writer
| 214 | flush . . . . . . . . . in com.ctc.wstx.sw.BufferingXmlWriter
| 311 | flush in com.ctc.wstx.sw.BaseStreamWriter
| 50 | flush . . . . . . . . . in org.apache.axiom.util.stax.wrapper.XMLStreamWriterWrapper
| 230 | flush in org.apache.axiom.om.impl.MTOMXMLStreamWriter
| 91 | serialize . . . . . . . in org.apache.axis2.databinding.ADBDataSource
| 638 | internalSerialize in org.apache.axiom.om.impl.llom.OMSourcedElementImpl
| 563 | serializeChildren . . . in org.apache.axiom.om.impl.util.OMSerializerUtil
| 846 | internalSerialize in org.apache.axiom.om.impl.llom.OMElementImpl
| 267 | serializeInternally . . in org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl
| 229 | internalSerialize in ''
| 188 | serializeAndConsume . . in org.apache.axiom.om.impl.llom.OMSerializableImpl
| 74 | writeTo in org.apache.axis2.transport.http.SOAPMessageFormatter
| 84 | writeRequest . . . . . in org.apache.axis2.transport.http.AxisRequestEntity
| 499 | writeRequestBody in org.apache.commons.httpclient.methods.EntityEnclosingMethod
| 2114 | writeRequest . . . . . in org.apache.commons.httpclient.HttpMethodBase
| 1096 | execute in ''
| 398 | executeWithRetry . . . in org.apache.commons.httpclient.HttpMethodDirector
| 171 | executeMethod in ''
| 397 | executeMethod . . . . . in org.apache.commons.httpclient.HttpClient
| 621 | executeMethod in org.apache.axis2.transport.http.AbstractHTTPSender
| 193 | sendViaPost . . . . . . in org.apache.axis2.transport.http.HTTPSender
| 75 | send in ''
| 404 | writeMessageWithCommons in org.apache.axis2.transport.http.CommonsHTTPTransportSender
| 231 | invoke in ''
| 443 | send . . . . . . . . . in org.apache.axis2.engine.AxisEngine
| 406 | send in org.apache.axis2.description.OutInAxisOperationClient
| 229 | executeImpl . . . . . . in ''
| 165 | execute in org.apache.axis2.client.OperationClient
| 3916 | login . . . . . . . . . in com.zuora.api.ZuoraServiceStub
| 51 | ___init___ in com.zuora.zortal.util.ZApi$$EPbnSoym
| 48 | <init> . . . . . . . . in com.zuora.zortal.repository.ZuoraRepository
| 40 | login in saaseiportal.unauthorized.LoginController
| 195 | doFilter . . . . . . . in grails.plugin.cache.web.filter.PageFragmentCachingFilter
| 63 | doFilter in grails.plugin.cache.web.filter.AbstractFilter
| 1145 | runWorker . . . . . . . in java.util.concurrent.ThreadPoolExecutor
| 615 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run . . . . . . . . . . in java.lang.Thread
I have confirmed that my system and system's java support TLS 1.1. I created an example java client to connect directly to the site. It gets a similar connection reset message when I run it regularly, but it gets a valid response when I try
java -Dhttps.protocols=TLSv1.1 SampleHttpTest
I suspect somewhere in grails is actually clearing out my setting. Immediately before the login call that generates the exception, I added a logging call to
System.out.println(System.getProperty("https.protocols"));
And it just logs a null. Setting that property immediately before I try to login has no effect, possibly because it's far too late in the application's life (some factory already created or something).
I'm actually something of a grails novice, so upgrading the app to grails 2.5 and java 8 is actually a rather daunting prospect. I'm hoping someone can point out something simple like:
"Here's where grails lets you set system properties before running any other java code"
or
"Here's where grails sets a bunch of default settings and you should check the values there already"
or
"It's probably the authentication plugin (or something) that needs to clear/fiddle with those settings"
Thanks in advance for any help!!
It may be the fork mode. To pass a JVM argument to a forked Java you have to change the BuildConfig.groovy a bit:
grails.project.fork = [
...
run : [maxMemory: 1280, minMemory: 128, debug: false, maxPerm: 256, forkReserve: true, jvmArgs: ['-Dhttps.protocols=TLSv1.1']],
...
]
But it could be something else as well.
I am using Grails with optaplanner 6.0.1.Final and drools jars (version 5.4.0) but getting some error while running the code. StackTrace is as follows :
ERROR errors.GrailsExceptionResolver - ClassNotFoundException occurred when processing request: [GET] /Volcare-BRMS/API/eventCreationDatePrePlanning
org.drools.core.event.AbstractEventSupport. Stacktrace follows:
Message: org.drools.core.event.AbstractEventSupport
Line | Method
->> 366 | run in java.net.URLClassLoader$1
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 355 | run in ''
| 354 | findClass . . . . . . . . . in java.net.URLClassLoader
| 425 | loadClass in java.lang.ClassLoader
| 800 | defineClass . . . . . . . . in ''
| 142 | defineClass in java.security.SecureClassLoader
| 449 | defineClass . . . . . . . . in java.net.URLClassLoader
| 71 | access$100 in ''
| 361 | run . . . . . . . . . . . . in java.net.URLClassLoader$1
| 355 | run in ''
| 354 | findClass . . . . . . . . . in java.net.URLClassLoader
| 425 | loadClass in java.lang.ClassLoader
| 48 | <init> . . . . . . . . . . . in org.optaplanner.core.impl.solver.DefaultSolver
| 129 | buildSolver in org.optaplanner.core.config.solver.SolverConfig
| 101 | buildSolver . . . . . . . . in org.optaplanner.core.config.solver.XmlSolverFactory
| 13 | createSolver in com.volcare.brms.CustomSolverFactory
| 74 | eventCreationDatePrePlanning in volcare.brms.api.APIController
| 200 | doFilter in grails.plugin.cache.web.filter.PageFragmentCachingFilter
| 63 | doFilter . . . . . . . . . . in grails.plugin.cache.web.filter.AbstractFilter
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run . . . . . . . . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run in java.lang.Thread
I have also included all JAR files in classpath.
The class org.drools.core.event.AbstractEventSupport seems to be part of the drools-core module. Optaplanner provides the correct Drools version so you DO NOT need to specify any Drools module in your BuildConfig.groovy.
compile 'org.optaplanner:optaplanner-core:6.0.1.Final'
compile 'org.optaplanner:optaplanner-benchmark:6.0.1.Final'
When I try to run my Grails 2.4.1 app, I get the following exception, which I don't really understand.
| Running Grails application
objc[15346]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/bin/java and /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/libinstrument.dylib. One of the two will be used. Which one is undefined.
| Error 2014-06-19 16:54:40,048 [localhost-startStop-1] ERROR context.GrailsContextLoaderListener - Error initializing the application: org/hibernate/event/spi/PreLoadEventListener
Message: org/hibernate/event/spi/PreLoadEventListener
Line | Method
->> 800 | defineClass in java.lang.ClassLoader
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 142 | defineClass in java.security.SecureClassLoader
| 449 | defineClass . . . . . . . in java.net.URLClassLoader
| 71 | access$100 in ''
| 361 | run . . . . . . . . . . . in java.net.URLClassLoader$1
| 355 | run in ''
| 354 | findClass . . . . . . . . in java.net.URLClassLoader
| 425 | loadClass in java.lang.ClassLoader
| 94 | doCall . . . . . . . . . in grails.plugin.hibernate4.HibernatePluginSupport$__clinit__closure1
| 754 | invokeBeanDefiningClosure in grails.spring.BeanBuilder
| 584 | beans . . . . . . . . . . in ''
| 527 | invokeMethod in ''
| 262 | run . . . . . . . . . . . in java.util.concurrent.FutureTask
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run . . . . . . . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 744 | run in java.lang.Thread
Caused by ClassNotFoundException: org.hibernate.event.spi.PreLoadEventListener
->> 366 | run in java.net.URLClassLoader$1
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 355 | run in ''
| 354 | findClass . . . . . . . . in java.net.URLClassLoader
| 425 | loadClass in java.lang.ClassLoader
| 800 | defineClass . . . . . . . in ''
| 142 | defineClass in java.security.SecureClassLoader
| 449 | defineClass . . . . . . . in java.net.URLClassLoader
| 71 | access$100 in ''
| 361 | run . . . . . . . . . . . in java.net.URLClassLoader$1
| 355 | run in ''
| 354 | findClass . . . . . . . . in java.net.URLClassLoader
| 425 | loadClass in java.lang.ClassLoader
| 94 | doCall . . . . . . . . . in grails.plugin.hibernate4.HibernatePluginSupport$__clinit__closure1
| 754 | invokeBeanDefiningClosure in grails.spring.BeanBuilder
| 584 | beans . . . . . . . . . . in ''
| 527 | invokeMethod in ''
| 262 | run . . . . . . . . . . . in java.util.concurrent.FutureTask
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run . . . . . . . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 744 | run in java.lang.Thread
| Error Forked Grails VM exited with error
Note that I don't have any complex code in my app so far, just a few domain classes reverse-engineered from an existing database using db-reverse-engineer plugin.
I imagine the error is coming from the db-reverse-engineer plugin which may rely on classes from Hibernate 3 whilst Grails 2.4 by default uses Hibernate 4. Try downgrade the Hibernate 3 plugin or remove the db-reverse-engineer plugin if you no longer need it
I have recently upgraded my Grails application to version 2.3.5 from 2.2.3
But after that my application is not statrting at all, after searching and debugging the application and plugins by adding all the plugins in a new application. The application runs only when i remove the below dependency from BuildConfig.groovy.
Apache Camel Plugin runtime dependency for Receiving emails from GMail
dependencies {
runtime 'org.apache.camel:camel-mail:2.9.0'
}
causing application to stop by throwing below Exception
Please help me in resolving the issue, I have also tried with Apache Camel Plugin latest version 1.2.9 but no luck so far.
Error |
2014-02-05 12:10:05,196 [localhost-startStop-1] ERROR context.GrailsContextLoader - Error initializing the application: null
Message: null
Line | Method
->> 3357 | <init> in java.util.Arrays$ArrayList
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 3343 | asList in java.util.Arrays
| 238 | getDeclaredFields . . . . in com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator
| 47 | getDeclaredFields in ''
| 359 | findFieldProperties . . . in com.sun.xml.internal.bind.v2.model.impl.ClassInfoImpl
| 290 | getProperties in ''
| 165 | getProperties . . . . . . in com.sun.xml.internal.bind.v2.model.impl.RuntimeClassInfoImpl
| 232 | getClassInfo in com.sun.xml.internal.bind.v2.model.impl.ModelBuilder
| 89 | getClassInfo . . . . . . in com.sun.xml.internal.bind.v2.model.impl.RuntimeModelBuilder
| 70 | getClassInfo in ''
| 198 | getClassInfo . . . . . . in com.sun.xml.internal.bind.v2.model.impl.ModelBuilder
| 84 | getClassInfo in com.sun.xml.internal.bind.v2.model.impl.RuntimeModelBuilder
| 70 | getClassInfo . . . . . . in ''
| 304 | getTypeInfo in com.sun.xml.internal.bind.v2.model.impl.ModelBuilder
| 319 | getTypeInfo . . . . . . . in ''
| 430 | getTypeInfoSet in com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl
| 277 | <init> . . . . . . . . . in ''
| 1100 | build in com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder
| 143 | createContext . . . . . . in com.sun.xml.internal.bind.v2.ContextFactory
| 110 | createContext in ''
| 191 | createContext . . . . . . in ''
| 128 | newInstance in javax.xml.bind.ContextFinder
| 290 | find . . . . . . . . . . in ''
| 372 | newInstance in javax.xml.bind.JAXBContext
| 337 | newInstance . . . . . . . in ''
| 188 | createJaxbContext in org.apache.camel.spring.handler.CamelNamespaceHandler
| 175 | getJaxbContext . . . . . in ''
| 303 | doParse in org.apache.camel.spring.handler.CamelNamespaceHandler$CamelContextBeanDefinitionParser
| 131 | invokeMethod . . . . . . in grails.spring.DynamicElementReader
| 61 | doCall in RoutingGrailsPlugin$_closure1
| 756 | invokeBeanDefiningClosure in grails.spring.BeanBuilder
| 584 | beans in ''
| 527 | invokeMethod . . . . . . in ''
| 303 | innerRun in java.util.concurrent.FutureTask$Sync
| 138 | run . . . . . . . . . . . in java.util.concurrent.FutureTask
| 886 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker
| 908 | run . . . . . . . . . . . in ''
^ 662 | run in java.lang.Thread