You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have a classloading problem with mybatis-3.2.2:
Caused by: java.lang.NullPointerException: null at org.apache.ibatis.ognl.OgnlRuntime.isInstance(OgnlRuntime.java:686) ~[mybatis-3.2.2.jar:3.2.2] at org.apache.ibatis.ognl.ASTInstanceof.getValueBody(ASTInstanceof.java:56) ~[mybatis-3.2.2.jar:3.2.2] at org.apache.ibatis.ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170) ~[mybatis-3.2.2.jar:3.2.2]
The reason for that is that we have different/multiple classloaders in our application. By default Ognl (DefaultClassResolver) loads classes with 'Class.forName(className)', which does not work for us due to mupltiple/different classloaders.
Ognl already has support for using a custom ClassResolver. We need an implementation that loads clases using the current Thread's ContextClassLoader.
Unluckily it is not possible to provide a custom ClassResolver implementation via mybatis configuration. See org.apache.ibatis.scripting.xmltags.OgnlCache.
Currently we changed OgnlCache.getValue() like this:
// we create OgnlContext with a custom class-resolver
Map context = Ognl.createDefaultContext(root, new CustomOgnlClassResolver());
return Ognl.getValue(parseExpression(expression), context, root);
This works, but we don't really want to patch/modify mybatis like that :)
It would be great if we can provide a CustomClassResolver implementation via (mybatis) configuration.
The text was updated successfully, but these errors were encountered:
We have a classloading problem with mybatis-3.2.2:
Caused by: java.lang.NullPointerException: null at org.apache.ibatis.ognl.OgnlRuntime.isInstance(OgnlRuntime.java:686) ~[mybatis-3.2.2.jar:3.2.2] at org.apache.ibatis.ognl.ASTInstanceof.getValueBody(ASTInstanceof.java:56) ~[mybatis-3.2.2.jar:3.2.2] at org.apache.ibatis.ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170) ~[mybatis-3.2.2.jar:3.2.2]
The reason for that is that we have different/multiple classloaders in our application. By default Ognl (DefaultClassResolver) loads classes with 'Class.forName(className)', which does not work for us due to mupltiple/different classloaders.
Ognl already has support for using a custom ClassResolver. We need an implementation that loads clases using the current Thread's ContextClassLoader.
Unluckily it is not possible to provide a custom ClassResolver implementation via mybatis configuration. See org.apache.ibatis.scripting.xmltags.OgnlCache.
Currently we changed OgnlCache.getValue() like this:
// we create OgnlContext with a custom class-resolver
Map context = Ognl.createDefaultContext(root, new CustomOgnlClassResolver());
return Ognl.getValue(parseExpression(expression), context, root);
This works, but we don't really want to patch/modify mybatis like that :)
It would be great if we can provide a CustomClassResolver implementation via (mybatis) configuration.
The text was updated successfully, but these errors were encountered: