尝试运行代码并打开glassfish服务器时出现此错误:
CREATE FUNCTION insert_user_test (
p_username text)
RETURNS text
LANGUAGE plpgsql
AS $$
BEGIN
RETURN QUERY INSERT INTO users(username) values(p_username));
END $$;
这是我的代码:
java.lang.NoSuchMethodError: org.hibernate.integrator.internal.IntegratorServiceImpl.<init>(Ljava/util/LinkedHashSet;Lorg/hibernate/boot/registry/classloading/spi/ClassLoaderService;)V
和我的servlet:
public class SessionFact {
static SessionFactory sf;
private static ServiceRegistry serviceRegistry;
public static SessionFactory getSessionFact() {
Configuration cfg = new Configuration();
cfg.configure("Resources/hibernate.cfg.xml");
serviceRegistry = new StandardServiceRegistryBuilder().applySettings(
cfg.getProperties()).build();
sf = cfg.buildSessionFactory(serviceRegistry);
System.out.println("build session factory ---------");
return sf;
}
}
和xml:
public class Testing extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
SessionFactory sf = HelpingClasses.SessionFact.getSessionFact();
PrintWriter pr = resp.getWriter();
pr.print("looks like is done");
}
}