Search code examples
moqui

What is the proper way to add Moqui framework in Intellij IDE


At first (for some day), I have practiced Moqui from the command line. Now I want to start with Intellij IDEA. So I add Moqui framework in my project directory and add all the jar files in the runtime/lib directory. But when I compile, it will gave me following errors.

/org/moqui/impl/pollEmailServer.groovy Error:(27,1) Groovyc: Modifier 'static' not allowed here. also generate Following error.

net.sf.ehcache.CacheException: Unable to load class net.sf.ehcache.store.DefaultElementValueComparator. Initial cause was net.sf.ehcache.store.DefaultElementValueComparator.<init>(net.sf.ehcache.config.CacheConfiguration) at net.sf.ehcache.util.ClassLoaderUtil.createNewInstance(ClassLoaderUtil.java:100) at net.sf.ehcache.config.ElementValueComparatorConfiguration.createElementComparatorInstance(ElementValueComparatorConfiguration.java:57) at net.sf.ehcache.Cache.<init>(Cache.java:797) at net.sf.ehcache.Cache.clone(Cache.java:2817) at net.sf.ehcache.Cache.clone(Cache.java:170) at net.sf.ehcache.CacheManager.cloneDefaultCache(CacheManager.java:1952) at net.sf.ehcache.CacheManager.addCacheIfAbsent(CacheManager.java:1934) at net.sf.ehcache.CacheManager$addCacheIfAbsent$1.call(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116) at org.moqui.impl.context.CacheFacadeImpl.initCache(CacheFacadeImpl.groovy:109) at org.moqui.impl.context.CacheFacadeImpl.getCacheImpl(CacheFacadeImpl.groovy:71) at org.moqui.impl.context.CacheFacadeImpl.getCache(CacheFacadeImpl.groovy:63) at org.moqui.context.CacheFacade$getCache.call(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116) at org.moqui.impl.context.renderer.FtlTemplateRenderer.init(FtlTemplateRenderer.groovy:42) at org.moqui.context.TemplateRenderer$init.call(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116) at org.moqui.impl.context.ResourceFacadeImpl.<init>(ResourceFacadeImpl.groovy:66) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:526) at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77) at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:190) at org.moqui.impl.context.ExecutionContextFactoryImpl.<init>(ExecutionContextFactoryImpl.groovy:182) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:526) at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77) at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:186) at org.moqui.impl.webapp.MoquiContextListener.contextInitialized(MoquiContextListener.groovy:44) at net.winstone.core.WebAppConfiguration.<init>(WebAppConfiguration.java:782) at net.winstone.core.HostConfiguration.initWebApp(HostConfiguration.java:282) at net.winstone.core.HostConfiguration.addWebAppConfiguration(HostConfiguration.java:190) at net.winstone.core.HostConfiguration.<init>(HostConfiguration.java:111) at net.winstone.core.HostGroup.addHostConfiguration(HostGroup.java:115) at net.winstone.core.HostGroup.<init>(HostGroup.java:85) at net.winstone.Server.initialize(Server.java:122) at net.winstone.Server.start(Server.java:106) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at MoquiStart.main(MoquiStart.java:152) Caused by: java.lang.NoSuchMethodException: net.sf.ehcache.store.DefaultElementValueComparator.<init>(net.sf.ehcache.config.CacheConfiguration) at java.lang.Class.getConstructor0(Class.java:2849) at java.lang.Class.getConstructor(Class.java:1718) at net.sf.ehcache.util.ClassLoaderUtil.createNewInstance(ClassLoaderUtil.java:91) ... 56 more Error initializing webapp context: net.sf.ehcache.CacheException: Unable to load class net.sf.ehcache.store.DefaultElementValueComparator. Initial cause was net.sf.ehcache.store.DefaultElementValueComparator.<init>(net.sf.ehcache.config.CacheConfiguration) ERROR 25/08/14 18:51:20.625 [main]: Error during context startup for webapp webapp net.sf.ehcache.CacheException: Unable to load class net.sf.ehcache.store.DefaultElementValueComparator. Initial cause was net.sf.ehcache.store.DefaultElementValueComparator.<init>(net.sf.ehcache.config.CacheConfiguration) at net.sf.ehcache.util.ClassLoaderUtil.createNewInstance(ClassLoaderUtil.java:100) at net.sf.ehcache.config.ElementValueComparatorConfiguration.createElementComparatorInstance(ElementValueComparatorConfiguration.java:57) at net.sf.ehcache.Cache.<init>(Cache.java:797) at net.sf.ehcache.Cache.clone(Cache.java:2817) at net.sf.ehcache.Cache.clone(Cache.java:170) at net.sf.ehcache.CacheManager.cloneDefaultCache(CacheManager.java:1952) at net.sf.ehcache.CacheManager.addCacheIfAbsent(CacheManager.java:1934) at net.sf.ehcache.CacheManager$addCacheIfAbsent$1.call(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116) at org.moqui.impl.context.CacheFacadeImpl.initCache(CacheFacadeImpl.groovy:109) at org.moqui.impl.context.CacheFacadeImpl.getCacheImpl(CacheFacadeImpl.groovy:71) at org.moqui.impl.context.CacheFacadeImpl.getCache(CacheFacadeImpl.groovy:63) at org.moqui.context.CacheFacade$getCache.call(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116) at org.moqui.impl.context.renderer.FtlTemplateRenderer.init(FtlTemplateRenderer.groovy:42) at org.moqui.context.TemplateRenderer$init.call(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116) at org.moqui.impl.context.ResourceFacadeImpl.<init>(ResourceFacadeImpl.groovy:66) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:526) at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77) at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:190) at org.moqui.impl.context.ExecutionContextFactoryImpl.<init>(ExecutionContextFactoryImpl.groovy:182) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:526) at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77) at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:186) at org.moqui.impl.webapp.MoquiContextListener.contextInitialized(MoquiContextListener.groovy:44) at net.winstone.core.WebAppConfiguration.<init>(WebAppConfiguration.java:782) at net.winstone.core.HostConfiguration.initWebApp(HostConfiguration.java:282) at net.winstone.core.HostConfiguration.addWebAppConfiguration(HostConfiguration.java:190) at net.winstone.core.HostConfiguration.<init>(HostConfiguration.java:111) at net.winstone.core.HostGroup.addHostConfiguration(HostGroup.java:115) at net.winstone.core.HostGroup.<init>(HostGroup.java:85) at net.winstone.Server.initialize(Server.java:122) at net.winstone.Server.start(Server.java:106) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at MoquiStart.main(MoquiStart.java:152)

I think I have done something wrong. Can you suggest me what is the proper way to add the Moqui framework in Intellij IDE?


Solution

  • The easiest way to setup inside IntelliJ IDEA is to create a new project based on the Gradle build files (IntelliJ now supports this).

    This particular error is happening because the files in the framework/src/main/resources directory are just classpath resources and should be copied into the JAR as-is, not compiled. This groovy file is a script and meant to be interpreted at runtime, not compiled in advance.