-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Initial SessionFactory.java.lang.ExceptionInInitializerError
PostPosted: Fri Jun 10, 2005 1:18 pm 
Newbie

Joined: Sun May 29, 2005 5:27 pm
Posts: 4
When I run this demoapp
//fragment
public class TDManager {

/** Creates a new instance of TDManager */
public TDManager() {
Session s = HibernateUtil.currentSession();
Transaction tx = s.beginTransaction();
Klant a = new Klant();
a.setVoornaam("Barry");
a.setAchternaam("Janssen");
a.setWoonplaats("Deventer");
a.setAdres("Gibsonstraat 12");
s.save( a);
tx.commit();
HibernateUtil.closeSession();

}

public static void main(String str[]) {
TDManager mgr = new TDManager();
System.out.println("Finished running TDManager");

}
}

It works just as expected. However when I do the exact same thing in my servlet it raised the above mentioned exception.. (jars, and source, Java 1.4 compiled) The logs for the servlet and for the commandline version are the same, until the point of exception. What am I overseeing here?
Thanks,
Henk

Fragment of my servlet ->
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();

out.println("<html>");
out.println("<head>");
out.println("<title>Servlet klantServlet</title>");
out.println("</head>");
out.println("<body>");
out.println("<h1>Servlet klantServlet at " + request.getContextPath () + "</h1>");
TDManager tdmgr = new TDManager(); // BOEM! EXception raised

out.println("</body>");
out.println("</html>");

out.close();
}



Hibernate version: 3.05


Debug level Hibernate log excerpt:

[#|2005-06-10T18:52:35.327+0200|INFO|sun-appserver-pe8.1_02|javax.enterprise.system.stream.out|_ThreadID=30;|INFO - using JDK 1.4 java.sql.Timestamp handling
|#]

[#|2005-06-10T18:52:35.700+0200|INFO|sun-appserver-pe8.1_02|javax.enterprise.system.stream.out|_ThreadID=30;|INFO - configuring from resource: /hibernate.cfg.xml
|#]

[#|2005-06-10T18:52:35.701+0200|INFO|sun-appserver-pe8.1_02|javax.enterprise.system.stream.out|_ThreadID=30;|INFO - Configuration resource: /hibernate.cfg.xml
|#]

[#|2005-06-10T18:52:36.038+0200|INFO|sun-appserver-pe8.1_02|javax.enterprise.system.stream.out|_ThreadID=30;|INFO - Mapping resource: tafeltjedekje_pkg/bmodel/Klant.hbm.xml
|#]

[#|2005-06-10T18:52:36.266+0200|INFO|sun-appserver-pe8.1_02|javax.enterprise.system.stream.out|_ThreadID=30;|INFO - Mapping class: tafeltjedekje_pkg.bmodel.Klant -> KLANT
|#]

[#|2005-06-10T18:52:36.396+0200|INFO|sun-appserver-pe8.1_02|javax.enterprise.system.stream.out|_ThreadID=30;|INFO - Configured SessionFactory: null
|#]

[#|2005-06-10T18:52:36.397+0200|INFO|sun-appserver-pe8.1_02|javax.enterprise.system.stream.out|_ThreadID=30;|INFO - processing extends queue
|#]

[#|2005-06-10T18:52:36.399+0200|INFO|sun-appserver-pe8.1_02|javax.enterprise.system.stream.out|_ThreadID=30;|INFO - processing collection mappings
|#]

[#|2005-06-10T18:52:36.399+0200|INFO|sun-appserver-pe8.1_02|javax.enterprise.system.stream.out|_ThreadID=30;|INFO - processing association property references
|#]

[#|2005-06-10T18:52:36.400+0200|INFO|sun-appserver-pe8.1_02|javax.enterprise.system.stream.out|_ThreadID=30;|INFO - processing foreign key constraints
|#]

[#|2005-06-10T18:52:36.688+0200|INFO|sun-appserver-pe8.1_02|javax.enterprise.system.stream.out|_ThreadID=30;|INFO - C3P0 using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost/hibernate
|#]

[#|2005-06-10T18:52:36.689+0200|INFO|sun-appserver-pe8.1_02|javax.enterprise.system.stream.out|_ThreadID=30;|INFO - Connection properties: {aggressive_release=true;, user=developer, password=****}
|#]

[#|2005-06-10T18:52:36.690+0200|INFO|sun-appserver-pe8.1_02|javax.enterprise.system.stream.out|_ThreadID=30;|INFO - autocommit mode: false
|#]


[#|2005-06-10T18:52:36.746+0200|WARNING|sun-appserver-pe8.1_02|javax.enterprise.system.stream.err|_ThreadID=30;|
Initial SessionFactory creation failed.java.lang.ExceptionInInitializerError|#]


[#|2005-06-10T18:52:36.754+0200|SEVERE|sun-appserver-pe8.1_02|javax.enterprise.system.container.web|_ThreadID=30;|StandardWrapperValve[klantServlet]: Servlet.service() for servlet klantServlet threw exception
java.lang.ExceptionInInitializerError
at tafeltjedekje_pkg.bmodel.HibernateUtil.<clinit>(HibernateUtil.java:18)
at tafeltjedekje_pkg.bmodel.TDManager.<init>(TDManager.java:30)
at tafeltjedekje_pkg.servlets.klantServlet.processRequest(klantServlet.java:38)
at tafeltjedekje_pkg.servlets.klantServlet.doGet(klantServlet.java:53)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:747)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
at sun.reflect.GeneratedMethodAccessor95.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
[i]
at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAsPrivileged(Subject.java:500)
at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:257)
at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:55)
at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:161)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:263)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:225)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:173)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:132)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:933)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:185)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:653)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:534)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.doTask(ProcessorTask.java:403)
at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:55)
Caused by: java.lang.ExceptionInInitializerError
at org.hibernate.connection.C3P0ConnectionProvider.configure(C3P0ConnectionProvider.java:84)
at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:80)
at org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:362)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:60)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1463)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1004)
at tafeltjedekje_pkg.bmodel.HibernateUtil.<clinit>(HibernateUtil.java:14)
... 33 more
Caused by: java.security.AccessControlException: access denied (java.util.PropertyPermission * read,write)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:269)
at java.security.AccessController.checkPermission(AccessController.java:401)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:524)
at java.lang.SecurityManager.checkPropertiesAccess(SecurityManager.java:1243)
at java.lang.System.getProperties(System.java:501)
at com.mchange.v2.c3p0.PoolConfig.<clinit>(PoolConfig.java:89)
... 40 more
|#]


Top
 Profile  
 
 Post subject: Found it myself
PostPosted: Sun Jun 12, 2005 5:05 pm 
Newbie

Joined: Sun May 29, 2005 5:27 pm
Posts: 4
The answer was in the last lines "access denied".
It was a matter of changing the server-policy file of the Sun App-server.

grant {
permission java.security.AllPermission;
};


For more info see :
http://swforum.sun.com/jive/thread.jspa ... eID=145207


Top
 Profile  
 
 Post subject: Re: Initial SessionFactory.java.lang.ExceptionInInitializerError
PostPosted: Tue May 14, 2013 8:51 am 
Newbie

Joined: Wed May 06, 2009 11:39 am
Posts: 2
Worth checking if rest of the things are correct in your set up using deepakgaikwad.net/index.php/2009/03/14/complete-hibernate-tutorial-with-example.html


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.