-->
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: Exception in thread "main" java.lang.SecurityException: Inva
PostPosted: Mon Jan 04, 2010 5:10 am 
Newbie

Joined: Mon Jan 04, 2010 4:44 am
Posts: 1
Hi,

I'm new to hibernate and need som advice.

I'm using NetBean 6.8, running hibernate against Oracle. I'm able to connect to Oracle instance from NB (i.e I can 'browse the tables'). FYI the Oracle instance reside on a virtual server with a different host id.

Hibernate has been configured according to the instructions in the NB hibernate tutorial and the provided sample exercise worked. However trying a similar example myself, fails.

I've tried the following class:

public class CreateTest {


public static void main(String args[]) throws Exception {
// Create a configuration based on the XML file we've put
// in the standard place.
System.out.println("h0");
Configuration config = new Configuration();
System.out.println("h1");
config.configure();
System.out.println("h2");
// Get the session factory we can use for persistence
SessionFactory sessionFactory = config.buildSessionFactory();
System.out.println("h3");
// Ask for a session using the JDBC information we've configured
Session session = sessionFactory.openSession();

Transaction tx = null;

try {
// Create some data and persist it
long id = 111;

tx = session.beginTransaction();
Items items = new Items(id,"12345","item_name","A","In Work","NEW","23456","doc name","A","NEW","2010-01-02");

System.out.println("Howdy ...");

session.save(items);
// We're done; make our changes permanent
tx.commit();
} catch (Exception e) {
if (tx != null) {
// Something went wrong; discard all partial changes
tx.rollback();
}
throw new Exception("Transaction failed", e);
} finally {
// No matter what, close the session
session.close();
}
// Clean up after ourselves
sessionFactory.close();
}

Running this class results in the following error:

h0
Jan 4, 2010 9:53:02 AM org.hibernate.cfg.Environment <clinit>
INFO: Hibernate 3.2.5
Jan 4, 2010 9:53:02 AM org.hibernate.cfg.Environment <clinit>
INFO: hibernate.properties not found
Jan 4, 2010 9:53:02 AM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: Bytecode provider name : cglib
Jan 4, 2010 9:53:02 AM org.hibernate.cfg.Environment <clinit>
INFO: using JDK 1.4 java.sql.Timestamp handling
h1
Jan 4, 2010 9:53:03 AM org.hibernate.cfg.Configuration configure
INFO: configuring from resource: /hibernate.cfg.xml
Jan 4, 2010 9:53:03 AM org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: Configuration resource: /hibernate.cfg.xml
Jan 4, 2010 9:53:03 AM org.hibernate.cfg.Configuration addResource
INFO: Reading mappings from resource : ext/ecc/erp/data/Structure.hbm.xml
Jan 4, 2010 9:53:03 AM org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
INFO: Mapping class: ext.ecc.erp.data.Structure -> STRUCTURE
Jan 4, 2010 9:53:03 AM org.hibernate.cfg.Configuration addResource
INFO: Reading mappings from resource : ext/ecc/erp/data/items.hbm.xml
h2
Jan 4, 2010 9:53:03 AM org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
INFO: Mapping class: ext.ecc.erp.data.Items -> ITEMS
Jan 4, 2010 9:53:03 AM org.hibernate.cfg.Configuration doConfigure
INFO: Configured SessionFactory: null
Jan 4, 2010 9:53:03 AM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Using Hibernate built-in connection pool (not for production use!)
Jan 4, 2010 9:53:03 AM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Hibernate connection pool size: 20
Jan 4, 2010 9:53:03 AM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: autocommit mode: false
Exception in thread "main" java.lang.SecurityException: Invalid signature file digest for Manifest main attributes
at sun.security.util.SignatureFileVerifier.processImpl(SignatureFileVerifier.java:221)
at sun.security.util.SignatureFileVerifier.process(SignatureFileVerifier.java:176)
at java.util.jar.JarVerifier.processEntry(JarVerifier.java:277)
at java.util.jar.JarVerifier.update(JarVerifier.java:188)
at java.util.jar.JarFile.initializeVerifier(JarFile.java:321)
at java.util.jar.JarFile.getInputStream(JarFile.java:386)
at sun.misc.URLClassPath$JarLoader$2.getInputStream(URLClassPath.java:689)
at sun.misc.Resource.cachedInputStream(Resource.java:61)
at sun.misc.Resource.getByteBuffer(Resource.java:144)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:249)
at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:315)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:330)
at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:398)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at org.hibernate.connection.DriverManagerConnectionProvider.configure(DriverManagerConnectionProvider.java:57)
at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:124)
at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:56)
at org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:414)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:62)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2009)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1292)
at ext.ecc.erp.CreateTest.main(CreateTest.java:31)
Java Result: 1

So, as you can see, the code never gets pass 'SessionFactory sessionFactory = config.buildSessionFactory();'

Here is the hibernate config file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.dialect">org.hibernate.dialect.OracleDialect</property>
<property name="hibernate.connection.driver_class">oracle.jdbc.OracleDriver</property>
<property name="hibernate.connection.url">jdbc:oracle:thin:@vmserver.ecc.com:1521:wind</property>
<property name="hibernate.connection.username">erp</property>
<property name="hibernate.connection.password">erp</property>
<property name="hibernate.show_sql">true</property>
<property name="hibernate.current_session_context_class">thread</property>
<mapping resource="ext/ecc/erp/data/Structure.hbm.xml"/>
<mapping resource="ext/ecc/erp/data/items.hbm.xml"/>
</session-factory>
</hibernate-configuration>

Any ideas why this happens?

Cheers ...


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.