Tuesday, February 23, 2016

IllegalAccessError: tried to access class javax.xml.stream.FactoryFinder from class javax.xml.stream.FactoryFinder$ClassLoaderFinder

Act application throws the following exception on startup:

Exception in thread "main" org.osgl.exception.UnexpectedException: Unknown error captured starting the application
 at org.osgl.util.E.unexpected(E.java:127)
 at act.boot.app.RunApp.start(RunApp.java:52)
 at act.boot.app.RunApp.start(RunApp.java:26)
 at com.pixolut.connectable.Application.main(Application.java:10)
Caused by: java.lang.IllegalAccessError: tried to access class javax.xml.stream.FactoryFinder from class javax.xml.stream.FactoryFinder$ClassLoaderFinder
 at java.lang.Class.getDeclaringClass0(Native Method)
 at java.lang.Class.getDeclaringClass(Class.java:1235)
 at java.lang.Class.getEnclosingClass(Class.java:1277)
 at java.lang.Class.getCanonicalName(Class.java:1392)
 at act.util.ClassInfoRepository.canonicalName(ClassInfoRepository.java:65)
 at act.boot.app.FullStackAppBootstrapClassLoader.cache(FullStackAppBootstrapClassLoader.java:99)
 at act.boot.app.FullStackAppBootstrapClassLoader.pluginClasses(FullStackAppBootstrapClassLoader.java:46)
 at act.Act.pluginClasses(Act.java:123)
 at act.plugin.PluginScanner.scan(PluginScanner.java:25)
 at act.Act.loadPlugins(Act.java:305)
 at act.Act.start(Act.java:222)
 at act.Act.startApp(Act.java:208)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:497)
 at act.boot.app.RunApp.start(RunApp.java:46)
 ... 2 more

Sunday, June 24, 2012

Strange enhancement exception caused by generic getId() method of morphia model

The exception stack:


morphia model code caused the trouble:


morphia model code that will not cause the trouble:


Root cause: Not found

Wednesday, June 20, 2012

Scope variable not workign in MongoDB MapReduce function

So I am trying to create map reduce aggregation functions. Since I need to aggregate on multiple dimensions, I don't want to copy/paste map and reduce function and only change the dimension from one to another.

I follow the manual http://www.mongodb.org/display/DOCS/MapReduce and defines the scope variable to pass in the dimension info:


// the map function
var map = function() {
    var dimension = this[dimension] ? this[dimension] : "_";
    var key = this.inst + "|" + this.bar + "|" + dimension;
    var result = {hit: 1};
    emit(key, result);
};
// the statement to call mapreduce
db.foo.mapReduce(map, reduce, {
  out: {inline: 1}, 
  query: q, 
  scope: {dimension: "red"}});

I run the above map reduce and found the dimension is always empty unless I noticed that dimension is redefined in the map function. Change the map funciton to the following solves the problem:
// the map function
var map = function() {
    var d= this[dimension] ? this[dimension] : "_"; // changed
    var key = this.inst + "|" + this.bar + "|" + d; // changed
    var result = {hit: 1};
    emit(key, result);
};

Thursday, June 14, 2012

Strange Morphia Exception caused by Rythm


This very strange exception drives me crazy!

The exception pops up when I've updated a model class, and it won't go away unless I've restart my play app. Crazy!

Initially it looks like it's a problem of PlayMorphia, and I was thinking it is a PlayMorphia problem because I've just added an new feature allow processing @Converters annotation intelligently. I've tried to switch back to previous version and I found it's still there! And rewind to the version before previous version, it's even still there!

Finally I found it's caused by a recent updates to PlayRythm. Specifically the following code:

And the problem has gone when I changed it to 

So obviously I need to reconfigure the Rythm Engine in dev mode even when the engine has been configured and initialized during pre-compilation process.

This is very strange and I've still no idea on why it happens


Saturday, May 26, 2012

Play cannot start with "TypeError: stat() argument 1 must be (encoded string without NULL bytes), not str"

I suddenly come into the trouble that I cannot start play on my project. Here is the error message:


Traceback (most recent call last):
  File "j:\play\play", line 143, in <module>
    cmdloader.load_play_module(module)
  File "j:\play\framework\pym\play\cmdloader.py", line 31, in load_play_module
    if os.path.exists(commands):
  File "j:\play\python\lib\genericpath.py", line 18, in exists
    st = os.stat(path)
TypeError: stat() argument 1 must be (encoded string without NULL bytes), not str
I tried to do play clean but it got the same problem. I was very annoyed and even restart the machine, the same result!!!!
And when I come to other project it was all good. So I realized that something is run with this project instead of my system. I add a "print path" statement in the genericpath.py, and it prints out this sequences:
c:\w\_lgl\play-morphia
c:\w\_lgl\play-morphia\samples-and-tests\unit-tests\modules
j:\play\modules\crud\commands.py
K-*╬╠¤│R0È3ÓÕr,J╬╚,K-õñVö▬+└$x╣£ïR‼KRStØ*üz╠¶♀tô♀ì§4éK¾¶|3ôï‗ï+ïKRsï§<¾Æ§4y╣x╣ PK♥♦
     ♦ì⌂<                  META-INF/PK♥♦¶  K½~<♥        yR♠☻  T♠  -   net/sf/oval/collection/CollectionFactory.java┼S┴j▄0►=»┴ 0Ã$deoáùñöäðÊʶB↕z▼╦│Â↕Y2Æ╝ï)²¸Äõf‼¿│öÆÂ:YofÌ╝y#↨G»{‗♀ÄÓ┌║á¼± ↔aá\commands.py
Traceback (most recent call last):
  File "j:\play\play", line 143, in 
    cmdloader.load_play_module(module)
  File "j:\play\framework\pym\play\cmdloader.py", line 31, in load_play_module
    if os.path.exists(commands):
  File "j:\play\python\lib\genericpath.py", line 19, in exists
    st = os.stat(path)
TypeError: stat() argument 1 must be (encoded string without NULL bytes), not str

hmm... yes, I got it, it's the oval validation source in jar files I've downloaded into the modules folder when I was in intellij IDEA. That explains it. Getting rid of that jar file resolves the issue.

Wednesday, April 11, 2012

maven build error: unmappable character for encoding Cp1252

I've just encountered this strange error when I use maven to build my project:
[ERROR] c:\w\_lgl\rythm\src\main\java\com\greenlaw110\rythm\utils\S.java:[125,1279] unmappable character for encoding Cp1252
The solution is open the pom.xml file and add one line into the maven-compiler-plugin section:

 org.apache.maven.plugins
 maven-compiler-plugin
 2.0.2
 
  1.6
  1.6
  UTF-8 
 

Thursday, December 1, 2011

[PlayMorphia]RuntimeException: bad type, not parameterized...

Just got this exception stack:
@68i05o17j
Internal Server Error (500) for request GET /@tests

Oops: RuntimeException
An unexpected error occured caused by exception RuntimeException: bad type, not parameterized...

play.exceptions.UnexpectedException: Unexpected Error
        at play.Play.start(Play.java:525)
        at play.Play.detectChanges(Play.java:610)
        at play.Invoker$Invocation.init(Invoker.java:186)
        at Invocation.HTTP Request(Play!)
Caused by: java.lang.RuntimeException: bad type, not parameterized...
        at com.google.code.morphia.utils.ReflectionUtils.isPropertyType(ReflectionUtils.java:194)
        at com.google.code.morphia.mapping.MappedField.discover(MappedField.java:102)
        at com.google.code.morphia.mapping.MappedField.(MappedField.java:78)
        at com.google.code.morphia.mapping.MappedClass.discover(MappedClass.java:166)
        at com.google.code.morphia.mapping.MappedClass.(MappedClass.java:110)
        at com.google.code.morphia.mapping.Mapper.getMappedClass(Mapper.java:200)
        at com.google.code.morphia.DatastoreImpl.ensureIndexes(DatastoreImpl.java:319)
        at com.google.code.morphia.DatastoreImpl.ensureIndexes(DatastoreImpl.java:319)
        at com.google.code.morphia.DatastoreImpl.ensureIndexes(DatastoreImpl.java:319)
        at com.google.code.morphia.DatastoreImpl.ensureIndexes(DatastoreImpl.java:319)
        at com.google.code.morphia.DatastoreImpl.ensureIndexes(DatastoreImpl.java:319)
        at com.google.code.morphia.DatastoreImpl.ensureIndexes(DatastoreImpl.java:319)
        at com.google.code.morphia.DatastoreImpl.ensureIndexes(DatastoreImpl.java:319)
        at com.google.code.morphia.DatastoreImpl.ensureIndexes(DatastoreImpl.java:319)
        at com.google.code.morphia.DatastoreImpl.ensureIndexes(DatastoreImpl.java:280)
        at com.google.code.morphia.DatastoreImpl.ensureIndexes(DatastoreImpl.java:341)
        at com.google.code.morphia.DatastoreImpl.ensureIndexes(DatastoreImpl.java:334)
        at play.modules.morphia.MorphiaPlugin.configureDs_(MorphiaPlugin.java:569)
        at play.modules.morphia.MorphiaPlugin.onApplicationStart(MorphiaPlugin.java:453)
        at play.plugins.PluginCollection.onApplicationStart(PluginCollection.java:425)
        at play.Play.start(Play.java:495)
        ... 3 more
The reason is I put a Blob type field inside an @Embedded class, which will not be enhanced at all. Taking that out of embedded class solves the issue