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

Sunday, November 27, 2011

Fatal error connect to github

I suddenly found I cannot push/pull from github anymore, always get the error:
FATAL ERROR: Network error: Connection timed out
fatal: The remote end hung up unexpectedly
This happens after I've installed TortoiseGit on my laptop. However it doesn't help to remove that program from my computer. In the end I found there is an environment variable named "GIT_SSH" point to "C:\tools\PLINK.exe". After I changed it to "C:\apps\Git\bin\ssh.exe" the github connection come back.

Monday, October 31, 2011

[PlayMorphia] IllegalAccessError occured : tried to access method models.User.(Ljava/lang/String;)V from class models.User$Factory

Symptom: IllegalAccessError occured : tried to access method models.User.(Ljava/lang/String;)V from class models.User$Factory Cause: * PlayMorphia code enhancement changed the access level of the constructor some how. Background: I have a parent model class:
@Entity public class FBUser extends Model {
   ...
   public static connect() {
      ...
      return fact.create(); 
   }
   public static interface UserFactory {
      FBUser create(String userId);
   }
   @Inject
   public static UserFactory fact;
}
And then I created a sub class
@Entity public class User extends FBUser {
    protected User(String id) {...}
    public static class Factory implements IUserFactory {
        @Override
        public FBUser create(String id) {
            return new User(id);
        }
    }
}
The problem happens at line 6: return new User(id), it's a bit strange that although Factory is an another class, it's embedded inside User class and should have the access to the protected User(String) constructor. There is also not complaints from the compiler. Actually if I suppress the @Entity annotation from the User class (which actually suppress the code enhancement from PlayMorphia module) the error will not occur. So it looks to me that the code enhancement somehow break the embedded class accessible state. The solution is simple: make the protected constructor public. Reference: * http://www.playframework.org * http://www.playframework.org/modules/morphia

Monday, September 19, 2011

[GreenScript]Template not found : tags/greenscript/gs_.html or tags/greenscript/gs_.tag


Error Message:
Template not found (In /app/views/main.html around line 11)
The template tags/greenscript/gs_.html or tags/greenscript/gs_.tag does not exist.

Root Cause:
- GreenScript link in the modules folder point to a GreenScript module that does not exist

Fix:
1. Update conf/dependencies.yml
2. run play deps --sync