wisdom-framework / wisdom-orientdb

Wisdom OrientDB integration
Apache License 2.0
2 stars 3 forks source link

Error when hot-reloading a model bundle #9

Open nicolas-rempulski opened 10 years ago

nicolas-rempulski commented 10 years ago

When Wisdom hot-reload a bundle containing models, an error arise :

java.lang.ClassCastException: io.gruul.server.mainframe.model.Message_$$_jvstc0c_3 cannot be cast to javassist.util.proxy.Proxy

I've to cut wisdom:run and relaunch it.

On hot-reload, the OrientDBCrudProvider detect new models :

[INFO]   o.w.o.r.OrientDbCrudProvider {monitor-application} - OrientDB Database configuration found for /io/gruul/server/mainframe/model : {user=admin, url=remote:localhost/gruul, package=io.gruul.server.mainframe.model, name=dev} 

Imo it leads to a double declaration of the model class in the proxy, thus the class cast exception.

cescoffier commented 10 years ago

Which bundle is providing javassist ? Be sure your entity bundle does not include it.

Sent from my iPhone

On 8 sept. 2014, at 15:25, Nicolas Rempulski notifications@github.com wrote:

When Wisdom hot-reload a bundle containing models, an error arise :

java.lang.ClassCastException: io.gruul.server.mainframe.model.Message_$$_jvstc0c_3 cannot be cast to javassist.util.proxy.Proxy

I've to cut wisdom:run and relaunch it.

On hot-reload, the OrientDBCrudProvider detect new models :

[INFO] o.w.o.r.OrientDbCrudProvider {monitor-application} - OrientDB Database configuration found for /io/gruul/server/mainframe/model : {user=admin, url=remote:localhost/gruul, package=io.gruul.server.mainframe.model, name=dev}

Imo it leads to a double declaration of the model class in the proxy, thus the class cast exception.

— Reply to this email directly or view it on GitHub https://github.com/wisdom-framework/wisdom-orientdb/issues/9.

nicolas-rempulski commented 10 years ago

My osgi.bnd is exporting javassist.* indeed.

But if I don't do this :

java.lang.RuntimeException: by java.lang.NoClassDefFoundError: javassist/util/proxy/ProxyObject
[...]
java.lang.NoClassDefFoundError: javassist/util/proxy/ProxyObject
[...]
java.lang.ClassNotFoundException: javassist.util.proxy.ProxyObject not found 
cescoffier commented 10 years ago

It needs to be imported, but neither exported, nor included

On 8 septembre 2014 at 16:07:19, Nicolas Rempulski (notifications@github.com) wrote:

My osgi.bnd is exporting javassist.* indeed.

But if I don't do this :

java.lang.RuntimeException: by java.lang.NoClassDefFoundError: javassist/util/proxy/ProxyObject [...] java.lang.NoClassDefFoundError: javassist/util/proxy/ProxyObject [...] java.lang.ClassNotFoundException: javassist.util.proxy.ProxyObject not found
— Reply to this email directly or view it on GitHub.

nicolas-rempulski commented 10 years ago

Ok I removed my osgi.bnd, and forced a use of javassist in my code

Proxy.class.toString();

and it works OK (launch & hot-reload)

cescoffier commented 10 years ago

Yes, this is a hack. We should probably provide a way to ‘add this import’ automatically.

On 8 septembre 2014 at 16:30:56, Nicolas Rempulski (notifications@github.com) wrote:

Ok I removed my osgi.bnd, and forced a use of javassist in my code

Proxy.class.toString(); and it works OK (launch & hot-reload)

— Reply to this email directly or view it on GitHub.

barjo commented 10 years ago

Yes, it's a bit dirty. It's what I use in the sample too. It's a bit tricky to add it automatically to the project that use the orientdbCrud.

cescoffier commented 10 years ago

It could be added using a plugin made for orientdb.

Sent from my iPhone

On 8 sept. 2014, at 17:19, Jonathan Bardin notifications@github.com wrote:

Yes, it's a bit dirty. It's what I use in the sample too. It's a bit tricky to add it automatically to the project that use the orientdbCrud.

— Reply to this email directly or view it on GitHub https://github.com/wisdom-framework/wisdom-orientdb/issues/9#issuecomment-54836019 .

barjo commented 10 years ago

It would definitively be the best way, but it does sound a bit overkill :-? The good part is that we could have more use for a plugin down the road. (such has evolution management :wink: )