Grails compilation errors with xml-apis - SAXParserException - grails

My lib directory only has 1 jar. xml-apis 2.8.1. When I remove it, everything compiles. This is the error I get:
java.lang.LinkageError: Class org/xml/sax/SAXParseException violates loader constraints
Any idea what's going on?

The xml-apis classes are included in the JRE. This issue is also known as being part of the "jar hell" problem, and - in the JVM space - typically occurs with XML libraries being included multiple times in the classpath, i.e. from the JRE rt.jar, by the application server or as a dependency of third-party libraries. This leads to LinkageError exceptions as the one provided above.
This is one example that describes how to solve this issue in Grails 1.3.7.

Related

Issue with Unity.Tasks in the ios-firebase unity plugin

I'm trying to upgrade to the latest IOS-Unity plugin and I keep getting this compilation error:
Assets/Scripts/Analytics.cs(38,16): error CS0012: The type
System.Threading.Tasks.Task' is defined in an assembly that is not
referenced. Consider adding a reference to assemblyUnity.Tasks,
Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
It's worth noting that before this error it complained about a duplicate UnityCompat.dll file (defined in both Firebase/Plugins and Parse/Plugins -- I ended up removing the one in the Parse directory, but I have tried the opposite as well).
Any pointers would be great. Also worth noting that this happened after removing obsolete files from the PlayServices plugin when prompted.
Answering my own question (from https://groups.google.com/forum/#!topic/firebase-talk/2w1Lk62VIcg)
Parse/Plugins/Unity.Tasks needs to the enabled for compilation (using Unity's Inspector)
Parse/Plugins/Unity.Compat needs to be disabled
I had a similar problem and resolved it by following the documentation :
(https://firebase.google.com/docs/unity/setup#set_up_environment)
Assets > Play Services Resolver > Version Handler > Update to enable the correct DLLs for your project.

BUILD FAILED : a module is not authorized to depend on itself: com.vaadin.external.atmosphere#atmosphere-compat-jbossweb;2.0.1-vaadin1

my project is VaadinFramework based project.I was run build.xml file through jenkins.
i struck with error like this.
/build.xml:28: impossible to resolve dependencies:
java.lang.IllegalArgumentException: a module is not authorized to depend on itself: com.vaadin.external.atmosphere#atmosphere-compat-jbossweb;2.0.1-vaadin1,
if you know the answer please help me out
the above three addons i was added in ivy.xml file.my problem was salved.
Becouse my project is vaadin based project.so it using vaadin dependencies in compile and runtime.
anyhow im also looking otherways to soughtout this problem inspite of addons.

Picasso crashing on app startup

I'm trying to use Picasso with disk caching. To do so, I understand I need to include the okhttp and okio libraries. When I do so, I get the following:
compile 'com.squareup.okio:okio:1.0.1'
compile 'com.squareup.okhttp:okhttp:2.0.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.0.0'
compile 'com.squareup.picasso:picasso:2.3.4'
java.lang.NoSuchMethodError: No static method source(Ljava/io/File;)Lokio/Source; in class Lokio/Okio; or its super classes (declaration of 'okio.Okio' appears in /system/framework/okhttp.jar)
at com.squareup.okhttp.internal.DiskLruCache.readJournal(DiskLruCache.java:243)
at com.squareup.okhttp.internal.DiskLruCache.open(DiskLruCache.java:224)
at com.squareup.okhttp.Cache.<init>(Cache.java:146)
at com.squareup.picasso.OkHttpDownloader.<init>(OkHttpDownloader.java:74)
at com.squareup.picasso.OkHttpDownloader.<init>(OkHttpDownloader.java:51)
at com.squareup.picasso.OkHttpDownloader.<init>(OkHttpDownloader.java:41)
at com.squareup.picasso.Utils$OkHttpLoaderCreator.create(Utils.java:407)
at com.squareup.picasso.Utils.createDefaultDownloader(Utils.java:255)
at com.squareup.picasso.Picasso$Builder.build(Picasso.java:605)
at com.squareup.picasso.Picasso.with(Picasso.java:482)
This is with a brand new app.
Any ideas what's going wrong?
Switching to okhttp 1.6.0 seems to solve the crash. Although I'm still not able to get disk caching working
You can remove the Okio dependency, it's transitive.
The problem is that the L preview was improperly packaged and incorrectly exposed Okio on the system classpath. All crashes from this can be ignored completely as a function of pre-release software. The actual L release will not behave this way.
More details are available at https://github.com/square/okhttp/issues/967

"Groovy:unable to resolve class ..." (import error in LoginController.groovy)

I am trying to use the ":spring-security-core:2.0-RC2" (using Grails version 2.3.1), but have my own LoginController.groovy. Following Burt's notes (here and here), I copied the LoginController.groovy from the original location at "myapp\target\work\plugins\spring-security-core-2.0-RC2\grails-app\controllers\grails\plugin\springsecurity" to my project location at "myapp\grails-app\controllers\com\company". Now I get a bunch of import error messages like "Groovy:unable to resolve class ..." (I have attached am image below showing all the imports giving errors). How do I take care of these errors?
Sorry if this is a trivial question (still getting used to Grails), and thank you for the help!
It looks like GGTS/STS isn't entirely aware that the plugin is installed, since those classes are from the two jars that the plugin depends on. Try right-clicking the project node in the tree and running Grails Tools > Refresh Dependencies. If that's not enough, run Project | Clean to force a full recompile.

Grails compiler keeps running again and again, possibly because of syntax error

I got this problem several times: Sometimes when I command : grails run-app, the compiler just running again and again, even though I change nothing after that. It looks like:
Running Grails application..
Server running. Browse to http://localhost:8080/LiningTest
[groovyc] Compiling 1 source file to E:\workspace\W1\LiningTest\target\classes
[groovyc] Compiling 2 source files to E:\workspace\W1\LiningTest\target\classe
s
[delete] Deleting directory C:\Documents and Settings\Long\.grails\1.3.6\proj
ects\LiningTest\tomcat
Running Grails application..
Server running. Browse to http://localhost:8080/LiningTest
[groovyc] Compiling 1 source file to E:\workspace\W1\LiningTest\target\classes
[groovyc] Compiling 2 source files to E:\workspace\W1\LiningTest\target\classe
s
[delete] Deleting directory C:\Documents and Settings\Long\.grails\1.3.6\proj
ects\LiningTest\tomcat
Running Grails application..
Server running. Browse to http://localhost:8080/LiningTest
[groovyc] Compiling 1 source file to E:\workspace\W1\LiningTest\target\classes
...
The compiler succeeded when "Server running", but then it automatically re-compile some files (I don't know which file), and run again, and then recompile again...
I have met this problem once when I have a syntax error
constraint {
number(min:0.50) // the right way is "min: 0..50"
}
The question is why this problem happened, and how I can find the cause of the problem. (I guess that I miss some comma/dot somewhere, but now it's hard to find, because of there's no error message!)
UPDATE: Now I see the problem is that I don't follow the folder structure rules when placing non-domain class in src/groovy.
The first thing to do is to run:
grails compile -verboseCompile
That will at least tell you what the problematic file is.
Apparently this can happen when
The package name does not match the directory (under your source root) the file is in.
The class name is different from the file name.
Have a look at this:
http://www.pubbs.net/201007/grails/58100-grails-user-groovyc-causing-grails-to-loop-.html
And Peter Ledbrook mentioned it in his talk at the Groovy & Grails Exchange last week (at 29:20):
http://skillsmatter.com/podcast/java-jee/talk-by-peter-ledbrook
I can confirm the strange behaviour.
I had two groovy classes in src/groovy belonging to some package com.acme.foobar.
Although for a while all went fine and Grails even compiled the classes and started the application (which was useable without exceptions) - at some point it did not stop to compile, start, delete all over again.
After I put the classes in src/groovy/com/acme/foobar the behaviour stopped instantly.
The remark of using grails compile -verboseCompile was useful. At least you can check if everything is allright as follows:
Call grails compile twice:
If there is the same output of classes being compiled the second time you compile there will be a problem.
If grails splutters something like this:
Running script /Users/ug/Software/grails/scripts/Compile.groovy
Environment set to development
returning to prompt directly afterwards - the problem should be gone.
Ok, it's a strange behavior with Grails that a senior programmer just told it to me:
I put one of my non-domain class in src/groovy/warm.groovy. But the warm.groovy belongs to the package "liningtest". It seems that I must put "Warm" class inside "src/groovy/liningtest/warm.groovy" instead.
There's an implicit rule here:
The non-domain class put in src/groovy, must follow the folder structure that is alike to the package structure.
That's really a strange behavior, because it doesn't report any errors, just repeat compiling again and again... And for the most strange part, that works for me in the first time!

Resources