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: Configuration not working in applet
PostPosted: Fri Jul 08, 2005 3:09 pm 
Newbie

Joined: Fri Jul 08, 2005 2:44 pm
Posts: 3
I've been working on a program using hibernate3 with mySQL and it is currently working as intended in Eclipse and as an application from the command line. However, I have been unable to get it to work as an applet, which is the form I actually need it in. I've looked through the documentation and forums, but I can't find anything that might account for this problem.

The error I get in the Java console for Internet Explorer is:
problem parsing configuration/hibernate.cfg.xml

hibernate.cfg.xml
Code:
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN" "http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
<hibernate-configuration>
<session-factory>
      <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
      <property name="hibernate.connection.url">jdbc:mysql://mysql.cs.orst.edu/baileyvi</property>
      <property name="hibernate.connection.username">baileyvi</property>
      <property name="hibernate.connection.password">pwd</property>
      <property name="hibernate.connection.pool_size">20</property>
      <property name="show_sql">true</property>
      <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
      <!-- "<property name="hibernate.hbm2ddl.auto">update</property>" -->
      <!-- Mapping files -->
      <mapping resource="Kit.hbm.xml"/>
</session-factory>
</hibernate-configuration>


Kit.hbm.xml
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
  <class name="Kit" table="KitInventory">
   <id name="kitName" type="string" column="KitName" >
   <generator class="assigned"/>
  </id>

  <property name="price">
  <column name="Price" />
  </property>
  <property name="quantity">
<column name="Quantity" />
  </property>
</class>
</hibernate-mapping>



One solution I tried was configuring in the program as such:
Code:
Configuration config = new Configuration().addResource("Kit.hbm.xml");
         config = config.addClass(Kit.class);
         config = config.setProperty("hibernate.dialect", "org.hibernate.dialect.MySQLDialect");
         config = config.setProperty("hibernate.connection.driver_class", " com.mysql.jdbc.Driver");
         config = config.setProperty("hibernate.connection.url", "jdbc:mysql://mysql.cs.orst.edu/baileyvi");
         config = config.setProperty("hibernate.connection.username", "baileyvi");
         config = config.setProperty("hibernate.connection.password", "pwd");
         SessionFactory sessionFactory = config.buildSessionFactory();
         session = sessionFactory.openSession();


When I do it this way, the Java console gives me the error:
Error reading resource: Kit.hbm.xml

If anyone has any insight, it would be much appreciated.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 12, 2005 11:44 am 
Newbie

Joined: Fri Jul 08, 2005 2:44 pm
Posts: 3
In working with the log4j properties file, I managed to get a more detailed stack trace of the problem to print to the java console on Internet Explorer. Here it is:

Code:
08:35:55,201  WARN Environment:493 - could not copy system properties, system properties will be ignored

08:35:56,310 ERROR Configuration:1290 - problem parsing configurationhibernate.cfg.xml

org.dom4j.DocumentException: Error on line 2 of document  : access denied (java.net.SocketPermission hibernate.sourceforge.net resolve) Nested exception: access denied (java.net.SocketPermission hibernate.sourceforge.net resolve)

   at org.dom4j.io.SAXReader.read(SAXReader.java:350)

   at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1286)

   at org.hibernate.cfg.Configuration.configure(Configuration.java:1230)

   at KitInventory.load(KitInventory.java:173)

   at KitInventory.setUp(KitInventory.java:68)

   at RunApplet.init(RunApplet.java:22)

   at sun.applet.AppletPanel.run(Unknown Source)

   at java.lang.Thread.run(Unknown Source)

Nested exception:

java.security.AccessControlException: access denied (java.net.SocketPermission hibernate.sourceforge.net resolve)

   at org.apache.crimson.parser.Parser2.parseInternal(Unknown Source)

   at org.apache.crimson.parser.Parser2.parse(Unknown Source)

   at org.apache.crimson.parser.XMLReaderImpl.parse(Unknown Source)

   at org.dom4j.io.SAXReader.read(SAXReader.java:334)

   at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1286)

   at org.hibernate.cfg.Configuration.configure(Configuration.java:1230)

   at KitInventory.load(KitInventory.java:173)

   at KitInventory.setUp(KitInventory.java:68)

   at RunApplet.init(RunApplet.java:22)

   at sun.applet.AppletPanel.run(Unknown Source)

   at java.lang.Thread.run(Unknown Source)

problem parsing configurationhibernate.cfg.xml


I'm still rather baffled, but will keep working on it, so if anyone has any idea what the problem is, suggestions would be much appreciated.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 12, 2005 12:32 pm 
Beginner
Beginner

Joined: Thu Jul 07, 2005 7:12 pm
Posts: 25
Looks like it's trying to find the DTD for the XML schema def. Unsigned applets can only connect back to the host from which they are served.

One option would be to sign the applet, another would be to move the DTD onto the server which holds the applet and update the URL where necessary.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 12, 2005 4:38 pm 
Newbie

Joined: Fri Jul 08, 2005 2:44 pm
Posts: 3
Thank you very much. It seems that signing the applet fixed this issue. I thought that they had the database on the same host, but it seems I was wrong.


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.