-->
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.  [ 1 post ] 
Author Message
 Post subject: Launching hibernate from a jws application
PostPosted: Tue Mar 25, 2008 6:13 pm 
Newbie

Joined: Tue Mar 25, 2008 5:25 pm
Posts: 1
Hi All. I have a problem launching my application using jws. When starting from the eclipse ide or a package jar archive everything runs fine. What I believe is the problem is the static sessionFactory init, when reading the configuration xml files from the jar archive. I started the application pretty much with the tutorial boilerplate and after that I've tried configure the hibernate framework with different approaches served by the Configuration API.

Since I get a SecurityException I figure my way of configuring the framework tries to read/write something on the clients resources. The approach I'm working on right now is to use a ClassLoader to get the resources from the jar files:
Code:
ClassLoader cl = HibernateUtil.class.getClassLoader();
if (cl != null) {
Configuration cfg = new Configuration();
cfg.addURL(cl.getResource("se/myapp/application/Country.hbm.xml"));
...
cfg.configure(cl.getResource("hibernate.cfg.xml"));
sessionFactory = cfg.buildSessionFactory();
}


I guess my question really is: is there something wrong with my approach bringing up the framework and, does hibernate require any security permissions to run together with jws?

I've been fiddeling with the permissions of the files on the webserver, I've tried the programatic approach in the manual, but still no luck. I'll continue with a simpler application and trying to use hibernate with jws from the beginning, but any help on the way is appreciated.

Thanks
/Andreas

Hibernate version: Hibernate 3.2.5

Mapping documents: hibernate.cfg.xml + class mappings

Code between sessionFactory.openSession() and session.close():
Code:
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
      session.beginTransaction();
      
      List result = session.createQuery("from Country").list();
      for (int i = 0; i < result.size(); i++) {
         Country c = (Country) result.get(i);
         c.createNodes();
         if(c.getChildCount() > 0) root.add(c);
      }
      session.getTransaction().commit();



Full stack trace of any exception that occurs:
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.javaws.Launcher.executeApplication(Launcher.java:1205)
at com.sun.javaws.Launcher.executeMainClass(Launcher.java:1151)
at com.sun.javaws.Launcher.doLaunchApp(Launcher.java:998)
at com.sun.javaws.Launcher.run(Launcher.java:105)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.ExceptionInInitializerError
at se.wealthbuilder.util.HibernateUtil.<clinit>(HibernateUtil.java:45)
at se.wealthbuilder.application.LeagueFilterModel.createNodes(LeagueFilterModel.java:19)
at se.wealthbuilder.application.LeagueFilterModel.<init>(LeagueFilterModel.java:15)
at se.wealthbuilder.ui.components.JLeagueTreeView.<init>(JLeagueTreeView.java:39)
at se.wealthbuilder.application.MainApplication.initialize(MainApplication.java:31)
at se.wealthbuilder.application.MainApplication.main(MainApplication.java:21)
... 9 more
Caused by: java.security.AccessControlException: access denied (java.lang.reflect.ReflectPermission suppressAccessChecks)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:323)
at java.security.AccessController.checkPermission(AccessController.java:546)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
at java.lang.reflect.AccessibleObject.setAccessible(AccessibleObject.java:107)
at org.hibernate.property.BasicPropertyAccessor.getSetterOrNull(BasicPropertyAccessor.java:233)
at org.hibernate.property.BasicPropertyAccessor.createSetter(BasicPropertyAccessor.java:214)
at org.hibernate.property.BasicPropertyAccessor.getSetter(BasicPropertyAccessor.java:209)
at org.hibernate.mapping.Property.getSetter(Property.java:277)
at org.hibernate.tuple.entity.PojoEntityTuplizer.buildPropertySetter(PojoEntityTuplizer.java:251)
at org.hibernate.tuple.entity.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:107)
at org.hibernate.tuple.entity.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:55)
at org.hibernate.tuple.entity.EntityEntityModeToTuplizerMapping.<init>(EntityEntityModeToTuplizerMapping.java:56)
at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:295)
at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:434)
at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:109)
at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:226)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294)
at se.wealthbuilder.util.HibernateUtil.<clinit>(HibernateUtil.java:34)
... 14 more



Name and version of the database you are using:
mysql Ver 14.12 Distrib 5.0.38, for pc-linux-gnu (i486)


The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:
Hard time getting the logfiles from the java webstart client


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

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.