-->
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.  [ 4 posts ] 
Author Message
 Post subject: Using Hibernate 2.1.2 in standalone app
PostPosted: Mon Jul 12, 2004 5:09 pm 
Beginner
Beginner

Joined: Tue Dec 30, 2003 1:51 pm
Posts: 49
Location: Michigan, USA
Hello,
I am trying to use Hibernate 2.1.4 in a standalone app. I am creating the session from loading in a class.

Code:
private HibernateUtil() {
      System.out.println("HibernateUtil Constructor");
      try {
         cfg = new Configuration();

         cfg.setProperty(Environment.DIALECT, dbType);
         cfg.setProperty(Environment.DRIVER, jdbc_driver);
         cfg.setProperty(Environment.URL, url);
         cfg.setProperty(Environment.USER, userName);
         cfg.setProperty(Environment.PASS, password);
         //cfg.setProperty(Environment.TRANSACTION_STRATEGY, transType);
         cfg.setProperty(Environment.USE_REFLECTION_OPTIMIZER, "true");
         //cfg.setProperty(Environment.CACHE_PROVIDER, "net.sf.ehcache.hibernate.Provider");         
         //cfg.setProperty(Environment.USE_GET_GENERATED_KEYS, "false");
         
         cfg.addDirectory(new File("/sh/hibernate/"));
         
         sf = cfg.buildSessionFactory();

         System.out.println("sf = " + sf.toString());

      }
      catch(MappingException me){
         System.out.println("mapping exception caught: " + me);
      }
      catch (Exception ex) {
         System.out.println("HibernateUtil caught: " + ex);
      }
   }


and i receive the following error when i try to run the app

Code:
15:57:45,152  INFO Binder:229 - Mapping class: sh.hibernate.ShKey -> SH_KEY
15:57:45,261  INFO Configuration:613 - processing one-to-many association mappings
15:57:45,261  INFO Configuration:622 - processing one-to-one association property references
15:57:45,261  INFO Configuration:647 - processing foreign key constraints
15:57:45,277  INFO Dialect:82 - Using dialect: net.sf.hibernate.dialect.Oracle9Dialect
15:57:45,293  INFO SettingsFactory:62 - Use outer join fetching: true
15:57:45,293  INFO DriverManagerConnectionProvider:42 - Using Hibernate built-in connection pool (not for production use!)
15:57:45,293  INFO DriverManagerConnectionProvider:43 - Hibernate connection pool size: 20
15:57:45,308  INFO DriverManagerConnectionProvider:77 - using driver: oracle.jdbc.driver.OracleDriver at URL: jdbc:oracle:thin:@localhost:1521:D036
15:57:45,308  INFO DriverManagerConnectionProvider:78 - connection properties: {user=foo, password=bar}
15:57:45,324  INFO TransactionManagerLookupFactory:33 - No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)
15:57:46,168  INFO SettingsFactory:102 - Use scrollable result sets: true
15:57:46,183  INFO SettingsFactory:105 - Use JDBC3 getGeneratedKeys(): false
15:57:46,183  INFO SettingsFactory:108 - Optimize cache for minimal puts: false
15:57:46,183  INFO SettingsFactory:117 - Query language substitutions: {}
15:57:46,183  INFO SettingsFactory:128 - cache provider: net.sf.ehcache.hibernate.Provider
15:57:46,199  INFO Configuration:1093 - instantiating and configuring caches
java.lang.IllegalAccessError
   at net.sf.cglib.core.ClassEmitter.setTarget(ClassEmitter.java:85)
   at net.sf.cglib.core.ClassEmitter.<init>(ClassEmitter.java:77)
   at net.sf.cglib.core.KeyFactory$Generator.generateClass(KeyFactory.java:197)
   at net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:63)
   at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:192)
   at net.sf.cglib.core.KeyFactory$Generator.create(KeyFactory.java:177)
   at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:149)
   at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:142)
   at net.sf.hibernate.impl.SessionFactoryImpl.<clinit>(SessionFactoryImpl.java:235)
   at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:768)
   at sh.util.HibernateUtil.<init>(HibernateUtil.java:72)
   at sh.util.HibernateUtil.<clinit>(HibernateUtil.java:31)


I haven't tried using Hibernate in a stand-alone app before. Why isn't this loading? What is trying to Illegally access something?

---Jason


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 12, 2004 5:33 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
It is probably due to a security restriction at the Java level. I think the appropriate level has been discussed on the forum some day

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 12, 2004 5:36 pm 
Beginner
Beginner

Joined: Tue Dec 30, 2003 1:51 pm
Posts: 49
Location: Michigan, USA
so does that mean i need to check the security manager? or what?

---jason


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 12, 2004 5:37 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
yes

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.