java - Container exception using Hibernate from an external project (server.ContainerException: ... org.hibernate.internal.CoreMessageLogger -
i'm deploying rest project on glassfish 4.1.1 bundle netbeans server. maven dependency, have included external netbeans project done , tested, uses hibernate provide functionallity. should use java library project in rest web services project.
when debug rest project, once deployed , started glassfish in debug mode, rest services called , going nice until call method uses hibernate (from external lib project) needed. crashes shown below in attached image.
at starting of glassfish sever, noticed these 2 warnigs:
warning: web application [unknown] registered jdbc driver [com.mysql.jdbc.driver] failed unregister when web application stopped. prevent memory leak, jdbc driver has been forcibly unregistered. warning: web application [unknown] registered jdbc driver [com.mysql.fabric.jdbc.fabricmysqldriver] failed unregister when web application stopped. prevent memory leak, jdbc driver has been forcibly unregistered. information: hv000001: hibernate validator 5.1.2.final
and finally, error shown browser when hibernate involucred sentence invoked is:
exception javax.servlet.servletexception: org.glassfish.jersey.server.containerexception: java.lang.nosuchmethoderror: org.hibernate.internal.coremessagelogger.debugf(ljava/lang/string;i)v root cause org.glassfish.jersey.server.containerexception: java.lang.nosuchmethoderror: org.hibernate.internal.coremessagelogger.debugf(ljava/lang/string;i)v root cause java.lang.nosuchmethoderror: org.hibernate.internal.coremessagelogger.debugf(ljava/lang/string;i)v
i add screenshot:
thank you, j.
----------- edit specific line crashes ------------
public static void opensession(){ try{ if (!init){ //first inicialization. force execute static block. class.forname(sessionfactory.class.getcanonicalname()); init = true; } currentsession = sessionfactory.sessionfactory.getcurrentsession(); currentsession.begintransaction();
it crashses @ class.forname(sessionfactory.class.getcanonicalname()). invoke method in order force class sessionfactory execute static block method configures hibernate once. suggested solution downgrade hibernate librery 4.x.x, seems work, i'm forced change newer methods adapt code version (native querys different, class metadata in configuration not present...). further, have new problems when need create new basical hibernate objets consult, query:
public static user getuserbyid(long id) { try { string query = "select u user u u.id = " + id; query sentence;
crashes as:
further, have same warning @ start:
warning: web application [unknown] registered jdbc driver [com.mysql.jdbc.driver] failed unregister when web application stopped. prevent memory leak, jdbc driver has been forcibly unregistered. warning: web application [unknown] registered jdbc driver [com.mysql.fabric.jdbc.fabricmysqldriver] failed unregister when web application stopped. prevent memory leak, jdbc driver has been forcibly unregistered. information: hv000001: hibernate validator 5.1.2.final
Comments
Post a Comment