Grails IntelliJ run-app loader constraint violation - intellij-idea

First of all: I have no experience with grails and groovy.
I have a legacy project based on Grails 2.4.5, and have a problem with running it from IntelliJ.
Error executing script RunApp: loader constraint violation: when resolving method "org.springsource.loaded.TypeRegistry.getReloadableType(II)Lorg/springsource/loaded/ReloadableType;" the class loader (instance of java/net/URLClassLoader) of the current class, Config, and the class loader (instance of sun/misc/Launcher$AppClassLoader) for the method's defining class, org/springsource/loaded/TypeRegistry, have different Class objects for the type org/springsource/loaded/ReloadableType used in the signature (Use --stacktrace to see the full trace)
However when I try to run it manually by: "grails run-app" it runs without a problem.
I tried creating an empty project in IntelliJ and it compiles and runs.
I've wasted 5 hours already trying to compare empty project and mine and found no clue. What should I check?

Related

Unable to call utilities in another module of karate maven project

I am getting following exception when trying to call feature file of another module from different module with logs as,
org.graalvm.polyglot.PolyglotException: TypeError: Access to host class utils.Utils is not allowed or does not exist.
Following is the file which I am trying to run as,
https://github.com/bipin-k/karate-automation/blob/master/sample-automation/src/main/java/sample.feature
https://github.com/bipin-k/karate-automation
karate error description
Please read this answer for hints on how to handle re-use across Java modules: https://stackoverflow.com/a/58339662/143475
Recommendation is to avoid it as far as possible. And things like call read('../../../../core-utilities/src/main/java/java-functions-calls.feature') lead to un-maintainable tests: https://stackoverflow.com/a/54126724/143475
Most likely the problem is because in the project where you make the call - the utils.Utils class is simply not on the Java "classpath". You should probably take the help of someone who knows Java well, or stick to a simpler "single module" Java project.

Can not run Clojure project with Cursive using Leiningen

I am unable to run a simple test project using the intellij plugin cursive. I am able to open a REPL without any problems and can even call functions defined in the core.clj file.
Running the project directly however yields this error message:
Error running 'new-project.core': failed to access class com.intellij.execution.impl.ProcessStreamsSynchronizer from class com.intellij.execution.impl.ConsoleViewRunningState (com.intellij.execution.impl.ProcessStreamsSynchronizer is in unnamed module of loader com.intellij.util.lang.UrlClassLoader #402f32ff; com.intellij.execution.impl.ConsoleViewRunningState is in unnamed module of loader com.intellij.ide.plugins.cl.PluginClassLoader #c9a79eb)
Intellij run configuration here. Changing How to run it and What to run does nothing.
Starting the project via the Leiningen tab yields the same error message.
There is an issue open about it.
https://github.com/cursive-ide/cursive/issues/2350
Also I tried to do lein run Let me know if this work for you.

Hibernate IllegalArgumentException persistence.xml does not exist - unit test without persistence.xml

I am using OpenEJB in some unit (integration) tests for my database module, following this example here: http://tomee.apache.org/examples-trunk/application-composer/README.html
I am using an #Module annotation to provide PersistenceUnit java object as opposed to a 'test' persistence.xml file and I am overriding the provider to use hibernate (for specific reasons) as below.
unit.setProvider(org.hibernate.jpa.HibernatePersistenceProvider.class);
Using version 4.2.11.Final version of Hibernate this works fine, but in upgrading to 4.3.8.Final i am now getting an IllegalArgumentException stating that no persistence.xml exists.
Caused by: java.lang.IllegalArgumentException: File [FullParthToMyJar.jar:file:FullParthToMyJar.jar!/META-INF/persistence.xml] referenced by given URL [file:FullParthToMyJar/jar:file:FullParthToMyJar.jar!/META-INF/persistence.xml] does not exist
Is there anyway to stop this scanning from occuring as my project maven enforcer plugin is forcing me to use the later version.
Thanks.
Thanks for your response, but we ended up using a persistence.xml file to avoid losing time, which fixed the issue.

Worklight 5.0.5: Loader constraint violation when running Application Builder

during "Build All and Deploy" of a worklight application, I get the following error.
An internal error occurred during: "Worklight application builder".
loader constraint violation: when resolving method "org.apache.commons.io.FileUtils.iterateFiles(Ljava/io/File;Lorg/apache/commons/io/filefilter/IOFileFilter;Lorg/apache/commons/io/filefilter/IOFileFilter;)Ljava/util/Iterator;"
the class loader (instance of org/eclipse/osgi/internal/baseadaptor/DefaultClassLoader)
of the current class, com/worklight/builder/skins/impl/SkinBuilderImpl,
and the class loader (instance of org/eclipse/osgi/internal/baseadaptor/DefaultClassLoader)
for resolved class, org/apache/commons/io/FileUtils,
have different Class objects for the type leUtils.iterateFiles(Ljava/io/File;Lorg/apache/commons/io/filefilter/IOFileFilter;Lorg/apache/commons/io/filefilter/IOFileFilter;)Ljava/util/Iterator;
used in the signature
Console output is
[2013-03-26 15:30:13] Worklight Server started successfully on localhost:8080
[2013-03-26 15:30:13] Activating Worklight project: AA...
[2013-03-26 15:30:28] FWLSE3005I: Application raw reports are disabled.
[2013-03-26 15:30:28] FWLST0010I: ====== Started server for project AA-project-customization; Worklight version=5.0.5.20130115-0926-developer-edition
[2013-03-26 15:30:28] Activation done.
[2013-03-26 15:30:28] Starting build process: application 'ap', all environments
I believe this bug is also discussed in https://www.ibm.com/developerworks/forums/thread.jspa?threadID=465649 (read only)
For me it seems that this bug is pretty well reproducable.
It occurs every time another plugin is installed which contains/uses the org.apache.commons.io package
In my case I have an org.apache.commons.io_2.0.1.v201105210651.jar in my plugins folder (which was delivered by Sonar 2.4.0). It contains the same java classes as plugins\com.worklight.worklight-3rd-parties_5.0.5.20130115-0926\target\dependency.
This is also a matter of ordering, as the error only occurs if Worklight is installed AFTER another org.apache.commons.io-using package was installed.
So I strongly believe that the problem is because there are different classes with the same (package) name (WHY ??)
I thought about setting classloader preferences (parent first etc). but I don´t know how and I don´t know where to set.
Just deleting the 3rd parties .jar´s only leads to other errors ...
Any hints are greatly appreciated.
Thank you very much !
As a workaround, can you try and delete the commons.io plugin from your eclipse?
Hopefully, Sonar is using import-package and not require-bundle, and it will work, and this way Worklight won't have conflicts.

Team Build sends error when trying to compile a Structuremap method

I'm getting a strange error when trying to compile a solution that is using StructureMap on Team Build.
When I try to compile the solution locally on Visual Studio it works fine, but when trying to queue a new build in Team Build I get the following error:
Overload resolution failed because no accessible 'Use' can be called with these arguments:
The line of code that gets this error is the second one:
ForSingletonOf(Of ISessionFactory)().Use(NHibernateSessionFactory.SessionFactory)
Me.For(Of ISession)().lifecycleIs(New HybridLifecycle()).Use(Function(x) x.GetInstance(Of ISessionFactory)().OpenSession())
It's a standard registration for the NHibernate session, so I don't really get why this error pops up.
Thanks in advance for the clues.
Make sure you have the correct version of NHibernate on the build server, and that your hint paths are all appropriately set in your project file. We haven't had this specific issue (as we're not using NHibernate), but we've had weird issues like that being related to version mismatches of "infrastructure" DLLs between local and build.