Link to home
Start Free TrialLog in
Avatar of brohjoe
brohjoeFlag for United States of America

asked on

Hibernate JPA "Unknown Entity" MappingException

Environment:
Eclipse Helios
Hibernate 3.3.2


Hello Experts,

I've embedded a class inside another class to create one table from two classes.  I'm getting an org.hibernate.MappingException" unknown entity error.   The unknown entity is the Embeddable class.

Here is the @Entity class:

 
package com.hibernate.chapter3;

import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;

@Entity
public class School {

	private int schoolId;
	private String schoolName;
	private SchoolDetail schoolDetail;
	//--------------------------------------------
	
	@Embedded
	public SchoolDetail getSchoolDetail() {
		return schoolDetail;
	}
	public void setSchoolDetail(SchoolDetail schoolDetail) {
		this.schoolDetail = schoolDetail;
	}
	
	@Id
	@GeneratedValue
	public int getSchoolId() {
		return schoolId;
	}
	public void setSchoolId(int schoolId) {
		this.schoolId = schoolId;
	}

	public String getSchoolName() {
		return schoolName;
	}
	public void setSchoolName(String schoolName) {
		this.schoolName = schoolName;
	}
	
	

}

Open in new window


Here is the @Embeddable class:

 
package com.hibernate.chapter3;

import javax.persistence.Embeddable;

@Embeddable
public class SchoolDetail {
	
	private String schoolAddress;
	private boolean isPublicSchool;
	private int studentCount;
	
	
	public String getSchoolAddress() {
		return schoolAddress;
	}
	public void setSchoolAddress(String schoolAddress) {
		this.schoolAddress = schoolAddress;
	}
	public boolean isPublicSchool() {
		return isPublicSchool;
	}
	public void setPublicSchool(boolean isPublicSchool) {
		this.isPublicSchool = isPublicSchool;
	}
	public int getStudentCount() {
		return studentCount;
	}
	public void setStudentCount(int studentCount) {
		this.studentCount = studentCount;
	}
	
	
}

Open in new window


Here is the DAO Class:

 
package com.hibernate.chapter3;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;
import org.hibernate.tool.hbm2ddl.SchemaExport;


public class TestSchool {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		AnnotationConfiguration config = new AnnotationConfiguration();
		config.addAnnotatedClass(School.class);
		
		config.configure("hibernate.cfg.xml");
		
		new SchemaExport(config).create(true, true);
		
		SessionFactory factory = config.buildSessionFactory();
		Session session = factory.getCurrentSession();
		session.beginTransaction();
		
		//create the SchoolDetail objects
		SchoolDetail annsDetail = new SchoolDetail();
		annsDetail.setPublicSchool(false);
		annsDetail.setSchoolAddress("101 Washington St. DC");
		annsDetail.setStudentCount(300);
		
		//create the School objects
		School stanns = new School();
		stanns.setSchoolName("St. Anns School");
		stanns.setSchoolDetail(annsDetail);
		
		
		session.save(annsDetail);
		
		session.getTransaction().commit();

	}





}

Open in new window


I can't see where I've gone wrong so I need another set of expert eyes.
Thanks in advance.
Avatar of Am P
Am P
Flag of India image

Can you please post the mapping file and the table structure?
Avatar of brohjoe

ASKER

Ok.  Standby.
Avatar of brohjoe

ASKER

Here is the hibernate.cfg.xml 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>

<!-- Database connection settings -->

     <property name="connection.driver_class">org.apache.derby.jdbc.EmbeddedDriver</property>
     <property name="connection.url">jdbc:derby://localhost:1527/HibernateDb;create=true</property> 
     <property name="username">user</property> 
     <property name="connection.password">password</property>
     <property name="hibernate.default_schema">TESTSCHEMA</property>
     
     <!-- JDBC connection pool (use the built-in -->
     <property name="connection.pool_size">2</property>
     
     <!-- SQL dialect --> 
     <property name="dialect">org.hibernate.dialect.DerbyDialect</property> 
     
     <!-- Enable Hibernate's current session context -->
     <property name="current_session_context_class">thread</property>
     
     <!-- Diable the second level cache -->
     <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
     
     <!-- Echo all executed SQL to stdout -->
     <property name="show_sql">true</property>
     
     <!-- Drop and re-create the database schema on startup -->
    <!--  <property name="htm2ddl.auto">create</property>-->
     
     <!--<mapping resource="org/hibernate/tutorial/domain/Event.hbm.xml"></mapping> -->
     
    
   
     </session-factory>
     
     </hibernate-configuration>

Open in new window

Also, the above one is cfg.xml (Configuration) file, please provide hbm.xml (Mapping) file.
Avatar of brohjoe

ASKER

There is no hbm.xml file because I'm using JPA annotations.
can you post the full stack trace
Avatar of brohjoe

ASKER

Ok, Standby Objects.
Avatar of brohjoe

ASKER

22:38:44,666  INFO Version:15 - Hibernate Annotations 3.4.0.GA
22:38:44,861  INFO Environment:500 - Hibernate 3.2.0.cr5
22:38:44,882  INFO Environment:533 - hibernate.properties not found
22:38:44,934  INFO Environment:667 - Bytecode provider name : cglib
22:38:44,981  INFO Environment:584 - using JDK 1.4 java.sql.Timestamp handling
22:38:45,268  INFO Version:14 - Hibernate Commons Annotations 3.1.0.GA
22:38:45,323  INFO Configuration:1350 - configuring from resource: hibernate.cfg.xml
22:38:45,324  INFO Configuration:1327 - Configuration resource: hibernate.cfg.xml
22:38:45,917 DEBUG DTDEntityResolver:38 - trying to resolve system-id [http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd]
22:38:45,919 DEBUG DTDEntityResolver:40 - recognized hibernate namespace; attempting to resolve on classpath under org/hibernate/
22:38:45,923 DEBUG DTDEntityResolver:50 - located [http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd] in classpath
22:38:46,020 DEBUG Configuration:1311 - connection.driver_class=org.apache.derby.jdbc.EmbeddedDriver
22:38:46,020 DEBUG Configuration:1311 - connection.url=jdbc:derby://localhost:1527/HibernateDb;create=true
22:38:46,021 DEBUG Configuration:1311 - username=user
22:38:46,021 DEBUG Configuration:1311 - connection.password=password
22:38:46,022 DEBUG Configuration:1311 - hibernate.default_schema=TESTSCHEMA
22:38:46,022 DEBUG Configuration:1311 - connection.pool_size=2
22:38:46,023 DEBUG Configuration:1311 - dialect=org.hibernate.dialect.DerbyDialect
22:38:46,023 DEBUG Configuration:1311 - current_session_context_class=thread
22:38:46,027 DEBUG Configuration:1311 - cache.provider_class=org.hibernate.cache.NoCacheProvider
22:38:46,027 DEBUG Configuration:1311 - show_sql=true
22:38:46,028  INFO Configuration:1465 - Configured SessionFactory: null
22:38:46,029 DEBUG Configuration:1466 - properties: {java.vendor=Sun Microsystems Inc., hibernate.username=user, show_sql=true, username=user, sun.java.launcher=SUN_STANDARD, hibernate.connection.url=jdbc:derby://localhost:1527/HibernateDb;create=true, sun.management.compiler=HotSpot 64-Bit Server Compiler, os.name=Windows 7, sun.boot.class.path=C:\Program Files\Java\jdk1.6.0_24\jre\lib\resources.jar;C:\Program Files\Java\jdk1.6.0_24\jre\lib\rt.jar;C:\Program Files\Java\jdk1.6.0_24\jre\lib\sunrsasign.jar;C:\Program Files\Java\jdk1.6.0_24\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.6.0_24\jre\lib\jce.jar;C:\Program Files\Java\jdk1.6.0_24\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.6.0_24\jre\lib\modules\jdk.boot.jar;C:\Program Files\Java\jdk1.6.0_24\jre\classes, hibernate.current_session_context_class=thread, sun.desktop=windows, java.vm.specification.vendor=Sun Microsystems Inc., java.runtime.version=1.6.0_24-b07, hibernate.cache.provider_class=org.hibernate.cache.NoCacheProvider, user.name=Brohjoe, connection.driver_class=org.apache.derby.jdbc.EmbeddedDriver, current_session_context_class=thread, user.language=en, sun.boot.library.path=C:\Program Files\Java\jdk1.6.0_24\jre\bin, dialect=org.hibernate.dialect.DerbyDialect, java.version=1.6.0_24, user.timezone=America/New_York, sun.arch.data.model=64, java.endorsed.dirs=C:\Program Files\Java\jdk1.6.0_24\jre\lib\endorsed, sun.cpu.isalist=amd64, sun.jnu.encoding=Cp1252, file.encoding.pkg=sun.io, file.separator=\, java.specification.name=Java Platform API Specification, java.class.version=50.0, user.country=US, connection.url=jdbc:derby://localhost:1527/HibernateDb;create=true, java.home=C:\Program Files\Java\jdk1.6.0_24\jre, java.vm.info=mixed mode, os.version=6.1, path.separator=;, connection.password=password, java.vm.version=19.1-b02, hibernate.connection.password=password, user.variant=, java.awt.printerjob=sun.awt.windows.WPrinterJob, sun.io.unicode.encoding=UnicodeLittle, awt.toolkit=sun.awt.windows.WToolkit, user.home=C:\Users\brohjoe.Dynasty, java.specification.vendor=Sun Microsystems Inc., java.library.path=C:\Program Files\Java\jdk1.6.0_24\bin;.;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java/jdk1.6.0_24/bin/../jre/bin/server;C:/Program Files/Java/jdk1.6.0_24/bin/../jre/bin;C:/Program Files/Java/jdk1.6.0_24/bin/../jre/lib/amd64;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\Java\jdk1.6.0_06\bin;C:\Program Files (x86)\Microsoft SQL Server\90\Tools\binn\;C:\Windows\SysWOW64\wbem;C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\9.0\DLLShared\;D:\Program Files\QuickTime\QTSystem\D:\wamp\bin\php\;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files\SlikSvn\bin\;C:\eclipse;, java.vendor.url=http://java.sun.com/, hibernate.connection.driver_class=org.apache.derby.jdbc.EmbeddedDriver, java.vm.vendor=Sun Microsystems Inc., hibernate.dialect=org.hibernate.dialect.DerbyDialect, java.runtime.name=Java(TM) SE Runtime Environment, java.class.path=C:\Users\brohjoe\workspace\HibernateExample\bin;C:\Java Persistence with Hibernate\jpwh-gettingstarted-070401\helloworld-native\lib\antlr-2.7.6.jar;C:\Java Persistence with Hibernate\jpwh-gettingstarted-070401\helloworld-native\lib\asm.jar;C:\Java Persistence with Hibernate\jpwh-gettingstarted-070401\helloworld-native\lib\asm-attrs.jar;C:\Java Persistence with Hibernate\jpwh-gettingstarted-070401\helloworld-native\lib\c3p0-0.9.0.jar;C:\Java Persistence with Hibernate\jpwh-gettingstarted-070401\helloworld-native\lib\cglib-2.1.3.jar;C:\Java Persistence with Hibernate\jpwh-gettingstarted-070401\helloworld-native\lib\commons-logging-1.0.4.jar;C:\Java Persistence with Hibernate\jpwh-gettingstarted-070401\helloworld-native\lib\dom4j-1.6.1.jar;C:\Java Persistence with Hibernate\jpwh-gettingstarted-070401\helloworld-native\lib\hibernate3.jar;C:\Java Persistence with Hibernate\jpwh-gettingstarted-070401\helloworld-native\lib\hibernate-tools.jar;C:\Java Persistence with Hibernate\jpwh-gettingstarted-070401\helloworld-native\lib\hsqldb.jar;C:\Java Persistence with Hibernate\jpwh-gettingstarted-070401\helloworld-native\lib\log4j-1.2.13.jar;C:\eclipse\db derby\db-derby-10.7.1.1-bin\lib\derbyclient.jar;C:\eclipse\hibernate-lib\hibernate-annotations-3.4.0.GA.jar;C:\eclipse\plugins\hibernate-distribution-3.3.2.GA\lib\required\commons-collections-3.1.jar;C:\eclipse\plugins\hibernate-distribution-3.3.2.GA\lib\required\javassist-3.9.0.GA.jar;C:\eclipse\plugins\hibernate-distribution-3.3.2.GA\lib\required\jta-1.1.jar;C:\eclipse\plugins\hibernate-distribution-3.3.2.GA\lib\bytecode\cglib\cglib-2.2.jar;C:\eclipse\plugins\ejb3-persistence-3.3.1.jar;C:\eclipse\plugins\hibernate-commons-annotations.jar;C:\eclipse\plugins\log4j\slf4j-1.6.1\slf4j-log4j12-1.6.1.jar;C:\eclipse\plugins\log4j\slf4j-1.6.1\slf4j-api-1.6.1.jar;C:\eclipse\db derby\db-derby-10.7.1.1-bin\lib\derby.jar;C:\eclipse\db derby\db-derby-10.7.1.1-bin\lib\derbynet.jar;C:\eclipse\db derby\db-derby-10.7.1.1-bin\lib\derbyrun.jar;C:\eclipse\db derby\db-derby-10.7.1.1-bin\lib\derbytools.jar, hibernate.bytecode.use_reflection_optimizer=false, java.vm.specification.name=Java Virtual Machine Specification, java.vm.specification.version=1.0, sun.cpu.endian=little, sun.os.patch.level=, connection.pool_size=2, java.io.tmpdir=C:\Users\BROHJOE~1.DYN\AppData\Local\Temp\, java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi, hibernate.default_schema=TESTSCHEMA, os.arch=amd64, java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment, java.ext.dirs=C:\Program Files\Java\jdk1.6.0_24\jre\lib\ext;C:\Windows\Sun\Java\lib\ext, user.dir=C:\Users\brohjoe\workspace\HibernateExample, line.separator=
, java.vm.name=Java HotSpot(TM) 64-Bit Server VM, cache.provider_class=org.hibernate.cache.NoCacheProvider, file.encoding=Cp1252, java.specification.version=1.6, hibernate.show_sql=true, hibernate.connection.pool_size=2}
22:38:46,126  INFO Dialect:141 - Using dialect: org.hibernate.dialect.DerbyDialect
22:38:46,235 DEBUG AnnotationConfiguration:258 - Execute first pass mapping processing
22:38:46,454 DEBUG AnnotationConfiguration:529 - Process hbm files
22:38:46,454 DEBUG AnnotationConfiguration:537 - Process annotated classes
22:38:46,462  INFO AnnotationBinder:419 - Binding entity from annotated class: com.hibernate.chapter3.School
22:38:46,550 DEBUG Ejb3Column:161 - Binding column DTYPE. Unique false. Nullable false.
22:38:46,581 DEBUG EntityBinder:295 - Import with entity name School
22:38:46,631  INFO EntityBinder:422 - Bind entity com.hibernate.chapter3.School on table School
22:38:46,641 DEBUG AnnotationBinder:1022 - Processing com.hibernate.chapter3.School property annotation
22:38:46,745 DEBUG AnnotationBinder:1133 - Processing annotations of com.hibernate.chapter3.School.schoolId
22:38:46,753 DEBUG Ejb3Column:161 - Binding column schoolId. Unique false. Nullable false.
22:38:46,753 DEBUG AnnotationBinder:1257 - schoolId is an id
22:38:46,761 DEBUG SimpleValueBinder:220 - building SimpleValue for schoolId
22:38:46,764 DEBUG PropertyBinder:131 - Building property schoolId
22:38:46,791 DEBUG AnnotationBinder:1293 - Bind @Id on schoolId
22:38:46,792 DEBUG AnnotationBinder:1133 - Processing annotations of com.hibernate.chapter3.School.schoolDetail
22:38:46,792 DEBUG Ejb3Column:161 - Binding column schoolDetail. Unique false. Nullable true.
22:38:46,798 DEBUG AnnotationBinder:1808 - Binding component with path: com.hibernate.chapter3.School.schoolDetail
22:38:46,800 DEBUG AnnotationBinder:1022 - Processing com.hibernate.chapter3.SchoolDetail property annotation
22:38:46,801 DEBUG AnnotationBinder:1133 - Processing annotations of com.hibernate.chapter3.SchoolDetail.publicSchool
22:38:46,801 DEBUG Ejb3Column:161 - Binding column publicSchool. Unique false. Nullable false.
22:38:46,803 DEBUG PropertyBinder:110 - binding property publicSchool with lazy=false
22:38:46,804 DEBUG SimpleValueBinder:220 - building SimpleValue for publicSchool
22:38:46,804 DEBUG PropertyBinder:131 - Building property publicSchool
22:38:46,805 DEBUG AnnotationBinder:1133 - Processing annotations of com.hibernate.chapter3.SchoolDetail.schoolAddress
22:38:46,806 DEBUG Ejb3Column:161 - Binding column schoolAddress. Unique false. Nullable true.
22:38:46,806 DEBUG PropertyBinder:110 - binding property schoolAddress with lazy=false
22:38:46,807 DEBUG SimpleValueBinder:220 - building SimpleValue for schoolAddress
22:38:46,808 DEBUG PropertyBinder:131 - Building property schoolAddress
22:38:46,809 DEBUG AnnotationBinder:1133 - Processing annotations of com.hibernate.chapter3.SchoolDetail.studentCount
22:38:46,810 DEBUG Ejb3Column:161 - Binding column studentCount. Unique false. Nullable false.
22:38:46,810 DEBUG PropertyBinder:110 - binding property studentCount with lazy=false
22:38:46,811 DEBUG SimpleValueBinder:220 - building SimpleValue for studentCount
22:38:46,812 DEBUG PropertyBinder:131 - Building property studentCount
22:38:46,812 DEBUG PropertyBinder:131 - Building property schoolDetail
22:38:46,813 DEBUG AnnotationBinder:1133 - Processing annotations of com.hibernate.chapter3.School.schoolName
22:38:46,814 DEBUG Ejb3Column:161 - Binding column schoolName. Unique false. Nullable true.
22:38:46,815 DEBUG PropertyBinder:110 - binding property schoolName with lazy=false
22:38:46,815 DEBUG SimpleValueBinder:220 - building SimpleValue for schoolName
22:38:46,816 DEBUG PropertyBinder:131 - Building property schoolName
22:38:46,823 DEBUG AnnotationConfiguration:401 - processing fk mappings (*ToOne and JoinedSubclass)
22:38:46,826 DEBUG Configuration:1044 - processing extends queue
22:38:46,826 DEBUG Configuration:1048 - processing collection mappings
22:38:46,827 DEBUG Configuration:1059 - processing native query and ResultSetMapping mappings
22:38:46,827 DEBUG Configuration:1067 - processing association property references
22:38:46,828 DEBUG Configuration:1089 - processing foreign key constraints
22:38:46,829  INFO AnnotationConfiguration:369 - Hibernate Validator not found: ignoring
22:38:47,647 DEBUG AnnotationConfiguration:258 - Execute first pass mapping processing
22:38:47,647 DEBUG AnnotationConfiguration:529 - Process hbm files
22:38:47,648 DEBUG AnnotationConfiguration:537 - Process annotated classes
22:38:47,648 DEBUG AnnotationConfiguration:401 - processing fk mappings (*ToOne and JoinedSubclass)
22:38:47,648 DEBUG Configuration:1044 - processing extends queue
22:38:47,648 DEBUG Configuration:1048 - processing collection mappings
22:38:47,649 DEBUG Configuration:1059 - processing native query and ResultSetMapping mappings
22:38:47,649 DEBUG Configuration:1067 - processing association property references
22:38:47,649 DEBUG Configuration:1089 - processing foreign key constraints
22:38:47,660  INFO SchemaExport:154 - Running hbm2ddl schema export
22:38:47,661 DEBUG SchemaExport:170 - import file not found: /import.sql
22:38:47,662  INFO SchemaExport:179 - exporting generated schema to database
22:38:47,679  INFO DriverManagerConnectionProvider:41 - Using Hibernate built-in connection pool (not for production use!)
22:38:47,680  INFO DriverManagerConnectionProvider:42 - Hibernate connection pool size: 2
22:38:47,680  INFO DriverManagerConnectionProvider:45 - autocommit mode: false
22:38:49,337  INFO DriverManagerConnectionProvider:80 - using driver: org.apache.derby.jdbc.EmbeddedDriver at URL: jdbc:derby://localhost:1527/HibernateDb;create=true
22:38:49,337  INFO DriverManagerConnectionProvider:83 - connection properties: {password=password}
22:38:49,338 DEBUG DriverManagerConnectionProvider:93 - total checked-out connections: 0
22:38:49,338 DEBUG DriverManagerConnectionProvider:109 - opening new JDBC connection
22:38:51,585 ERROR SchemaExport:202 - schema export unsuccessful
java.sql.SQLNonTransientConnectionException: java.net.ConnectException : Error connecting to server localhost on port 1527 with message Connection refused: connect.
	at org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown Source)
	at org.apache.derby.client.am.SqlException.getSQLException(Unknown Source)
	at org.apache.derby.jdbc.ClientDriver.connect(Unknown Source)
	at java.sql.DriverManager.getConnection(DriverManager.java:582)
	at java.sql.DriverManager.getConnection(DriverManager.java:154)
	at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110)
	at org.hibernate.tool.hbm2ddl.ManagedProviderConnectionHelper.prepare(ManagedProviderConnectionHelper.java:28)
	at org.hibernate.tool.hbm2ddl.SchemaExport.execute(SchemaExport.java:180)
	at org.hibernate.tool.hbm2ddl.SchemaExport.create(SchemaExport.java:133)
	at com.hibernate.chapter3.TestSchool.main(TestSchool.java:20)
Caused by: org.apache.derby.client.am.DisconnectException: java.net.ConnectException : Error connecting to server localhost on port 1527 with message Connection refused: connect.
	at org.apache.derby.client.net.NetAgent.<init>(Unknown Source)
	at org.apache.derby.client.net.NetConnection.newAgent_(Unknown Source)
	at org.apache.derby.client.am.Connection.<init>(Unknown Source)
	at org.apache.derby.client.net.NetConnection.<init>(Unknown Source)
	at org.apache.derby.client.net.NetConnection40.<init>(Unknown Source)
	at org.apache.derby.client.net.ClientJDBCObjectFactoryImpl40.newNetConnection(Unknown Source)
	... 8 more
Caused by: java.net.ConnectException: Connection refused: connect
	at java.net.PlainSocketImpl.socketConnect(Native Method)
	at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
	at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
	at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
	at java.net.Socket.connect(Socket.java:529)
	at java.net.Socket.connect(Socket.java:478)
	at java.net.Socket.<init>(Socket.java:375)
	at java.net.Socket.<init>(Socket.java:189)
	at javax.net.DefaultSocketFactory.createSocket(SocketFactory.java:206)
	at org.apache.derby.client.net.OpenSocketAction.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	... 14 more
22:38:51,588 DEBUG AnnotationConfiguration:806 - Validator not present in classpath, ignoring event listener registration
22:38:51,592 DEBUG HibernateSearchEventListenerRegister:209 - Search not present in classpath, ignoring event listener registration.
22:38:51,592  INFO HibernateSearchEventListenerRegister:53 - Unable to find org.hibernate.search.event.FullTextIndexEventListener on the classpath. Hibernate Search is not enabled.
22:38:51,592 DEBUG Configuration:1209 - Preparing to build session factory with filters : {}
22:38:51,593 DEBUG AnnotationConfiguration:258 - Execute first pass mapping processing
22:38:51,593 DEBUG AnnotationConfiguration:529 - Process hbm files
22:38:51,593 DEBUG AnnotationConfiguration:537 - Process annotated classes
22:38:51,593 DEBUG AnnotationConfiguration:401 - processing fk mappings (*ToOne and JoinedSubclass)
22:38:51,594 DEBUG Configuration:1044 - processing extends queue
22:38:51,594 DEBUG Configuration:1048 - processing collection mappings
22:38:51,594 DEBUG Configuration:1059 - processing native query and ResultSetMapping mappings
22:38:51,594 DEBUG Configuration:1067 - processing association property references
22:38:51,595 DEBUG Configuration:1089 - processing foreign key constraints
22:38:51,717  INFO DriverManagerConnectionProvider:41 - Using Hibernate built-in connection pool (not for production use!)
22:38:51,718  INFO DriverManagerConnectionProvider:42 - Hibernate connection pool size: 2
22:38:51,718  INFO DriverManagerConnectionProvider:45 - autocommit mode: false
22:38:51,719  INFO DriverManagerConnectionProvider:80 - using driver: org.apache.derby.jdbc.EmbeddedDriver at URL: jdbc:derby://localhost:1527/HibernateDb;create=true
22:38:51,720  INFO DriverManagerConnectionProvider:83 - connection properties: {password=password}
22:38:51,720 DEBUG DriverManagerConnectionProvider:93 - total checked-out connections: 0
22:38:51,720 DEBUG DriverManagerConnectionProvider:109 - opening new JDBC connection
22:38:52,730  WARN SettingsFactory:109 - Could not obtain connection metadata
java.sql.SQLNonTransientConnectionException: java.net.ConnectException : Error connecting to server localhost on port 1527 with message Connection refused: connect.
	at org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown Source)
	at org.apache.derby.client.am.SqlException.getSQLException(Unknown Source)
	at org.apache.derby.jdbc.ClientDriver.connect(Unknown Source)
	at java.sql.DriverManager.getConnection(DriverManager.java:582)
	at java.sql.DriverManager.getConnection(DriverManager.java:154)
	at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110)
	at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:76)
	at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1933)
	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1216)
	at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
	at com.hibernate.chapter3.TestSchool.main(TestSchool.java:22)
Caused by: org.apache.derby.client.am.DisconnectException: java.net.ConnectException : Error connecting to server localhost on port 1527 with message Connection refused: connect.
	at org.apache.derby.client.net.NetAgent.<init>(Unknown Source)
	at org.apache.derby.client.net.NetConnection.newAgent_(Unknown Source)
	at org.apache.derby.client.am.Connection.<init>(Unknown Source)
	at org.apache.derby.client.net.NetConnection.<init>(Unknown Source)
	at org.apache.derby.client.net.NetConnection40.<init>(Unknown Source)
	at org.apache.derby.client.net.ClientJDBCObjectFactoryImpl40.newNetConnection(Unknown Source)
	... 9 more
Caused by: java.net.ConnectException: Connection refused: connect
	at java.net.PlainSocketImpl.socketConnect(Native Method)
	at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
	at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
	at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
	at java.net.Socket.connect(Socket.java:529)
	at java.net.Socket.connect(Socket.java:478)
	at java.net.Socket.<init>(Socket.java:375)
	at java.net.Socket.<init>(Socket.java:189)
	at javax.net.DefaultSocketFactory.createSocket(SocketFactory.java:206)
	at org.apache.derby.client.net.OpenSocketAction.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	... 15 more
22:38:52,739  INFO Dialect:141 - Using dialect: org.hibernate.dialect.DerbyDialect
22:38:52,748  INFO TransactionFactoryFactory:31 - Using default transaction strategy (direct JDBC transactions)
22:38:52,753  INFO TransactionManagerLookupFactory:33 - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
22:38:52,753  INFO SettingsFactory:134 - Automatic flush during beforeCompletion(): disabled
22:38:52,754  INFO SettingsFactory:138 - Automatic session close at end of transaction: disabled
22:38:52,755  INFO SettingsFactory:153 - Scrollable result sets: disabled
22:38:52,755 DEBUG SettingsFactory:157 - Wrap result sets: disabled
22:38:52,755  INFO SettingsFactory:161 - JDBC3 getGeneratedKeys(): disabled
22:38:52,755  INFO SettingsFactory:169 - Connection release mode: auto
22:38:52,756  INFO SettingsFactory:187 - Default schema: TESTSCHEMA
22:38:52,761  INFO SettingsFactory:196 - Default batch fetch size: 1
22:38:52,761  INFO SettingsFactory:200 - Generate SQL with comments: disabled
22:38:52,761  INFO SettingsFactory:204 - Order SQL updates by primary key: disabled
22:38:52,762  INFO SettingsFactory:369 - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
22:38:52,785  INFO ASTQueryTranslatorFactory:24 - Using ASTQueryTranslatorFactory
22:38:52,786  INFO SettingsFactory:212 - Query language substitutions: {}
22:38:52,786  INFO SettingsFactory:217 - JPA-QL strict compliance: disabled
22:38:52,786  INFO SettingsFactory:222 - Second-level cache: enabled
22:38:52,786  INFO SettingsFactory:226 - Query cache: disabled
22:38:52,787  INFO SettingsFactory:356 - Cache provider: org.hibernate.cache.NoCacheProvider
22:38:52,787  INFO SettingsFactory:241 - Optimize cache for minimal puts: disabled
22:38:52,787  INFO SettingsFactory:250 - Structured second-level cache entries: disabled
22:38:52,789 DEBUG SQLExceptionConverterFactory:52 - Using dialect defined converter
22:38:52,795  INFO SettingsFactory:270 - Echoing all SQL to stdout
22:38:52,795  INFO SettingsFactory:277 - Statistics: disabled
22:38:52,796  INFO SettingsFactory:281 - Deleted entity synthetic identifier rollback: disabled
22:38:52,796  INFO SettingsFactory:296 - Default entity-mode: pojo
22:38:52,927  INFO SessionFactoryImpl:161 - building session factory
22:38:52,928 DEBUG SessionFactoryImpl:173 - Session factory constructed with filter configurations : {}
22:38:52,929 DEBUG SessionFactoryImpl:177 - instantiating session factory with properties: {java.vendor=Sun Microsystems Inc., hibernate.username=user, show_sql=true, username=user, sun.java.launcher=SUN_STANDARD, hibernate.connection.url=jdbc:derby://localhost:1527/HibernateDb;create=true, sun.management.compiler=HotSpot 64-Bit Server Compiler, os.name=Windows 7, sun.boot.class.path=C:\Program Files\Java\jdk1.6.0_24\jre\lib\resources.jar;C:\Program Files\Java\jdk1.6.0_24\jre\lib\rt.jar;C:\Program Files\Java\jdk1.6.0_24\jre\lib\sunrsasign.jar;C:\Program Files\Java\jdk1.6.0_24\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.6.0_24\jre\lib\jce.jar;C:\Program Files\Java\jdk1.6.0_24\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.6.0_24\jre\lib\modules\jdk.boot.jar;C:\Program Files\Java\jdk1.6.0_24\jre\classes, hibernate.current_session_context_class=thread, sun.desktop=windows, java.vm.specification.vendor=Sun Microsystems Inc., java.runtime.version=1.6.0_24-b07, hibernate.cache.provider_class=org.hibernate.cache.NoCacheProvider, user.name=brohjoe, connection.driver_class=org.apache.derby.jdbc.EmbeddedDriver, current_session_context_class=thread, user.language=en, sun.boot.library.path=C:\Program Files\Java\jdk1.6.0_24\jre\bin, dialect=org.hibernate.dialect.DerbyDialect, java.version=1.6.0_24, user.timezone=America/New_York, sun.arch.data.model=64, java.endorsed.dirs=C:\Program Files\Java\jdk1.6.0_24\jre\lib\endorsed, sun.cpu.isalist=amd64, sun.jnu.encoding=Cp1252, file.encoding.pkg=sun.io, file.separator=\, java.specification.name=Java Platform API Specification, java.class.version=50.0, user.country=US, connection.url=jdbc:derby://localhost:1527/HibernateDb;create=true, java.home=C:\Program Files\Java\jdk1.6.0_24\jre, java.vm.info=mixed mode, os.version=6.1, path.separator=;, connection.password=password, java.vm.version=19.1-b02, hibernate.connection.password=password, user.variant=, java.awt.printerjob=sun.awt.windows.WPrinterJob, sun.io.unicode.encoding=UnicodeLittle, awt.toolkit=sun.awt.windows.WToolkit, user.home=C:\Users\brohjoe.Dynasty, java.specification.vendor=Sun Microsystems Inc., java.library.path=C:\Program Files\Java\jdk1.6.0_24\bin;.;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java/jdk1.6.0_24/bin/../jre/bin/server;C:/Program Files/Java/jdk1.6.0_24/bin/../jre/bin;C:/Program Files/Java/jdk1.6.0_24/bin/../jre/lib/amd64;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\Java\jdk1.6.0_06\bin;C:\Program Files (x86)\Microsoft SQL Server\90\Tools\binn\;C:\Windows\SysWOW64\wbem;C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\9.0\DLLShared\;D:\Program Files\QuickTime\QTSystem\D:\wamp\bin\php\;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files\SlikSvn\bin\;C:\eclipse;, java.vendor.url=http://java.sun.com/, hibernate.connection.driver_class=org.apache.derby.jdbc.EmbeddedDriver, java.vm.vendor=Sun Microsystems Inc., hibernate.dialect=org.hibernate.dialect.DerbyDialect, java.runtime.name=Java(TM) SE Runtime Environment, java.class.path=C:\Users\brohjoe\workspace\HibernateExample\bin;C:\Java Persistence with Hibernate\jpwh-gettingstarted-070401\helloworld-native\lib\antlr-2.7.6.jar;C:\Java Persistence with Hibernate\jpwh-gettingstarted-070401\helloworld-native\lib\asm.jar;C:\Java Persistence with Hibernate\jpwh-gettingstarted-070401\helloworld-native\lib\asm-attrs.jar;C:\Java Persistence with Hibernate\jpwh-gettingstarted-070401\helloworld-native\lib\c3p0-0.9.0.jar;C:\Java Persistence with Hibernate\jpwh-gettingstarted-070401\helloworld-native\lib\cglib-2.1.3.jar;C:\Java Persistence with Hibernate\jpwh-gettingstarted-070401\helloworld-native\lib\commons-logging-1.0.4.jar;C:\Java Persistence with Hibernate\jpwh-gettingstarted-070401\helloworld-native\lib\dom4j-1.6.1.jar;C:\Java Persistence with Hibernate\jpwh-gettingstarted-070401\helloworld-native\lib\hibernate3.jar;C:\Java Persistence with Hibernate\jpwh-gettingstarted-070401\helloworld-native\lib\hibernate-tools.jar;C:\Java Persistence with Hibernate\jpwh-gettingstarted-070401\helloworld-native\lib\hsqldb.jar;C:\Java Persistence with Hibernate\jpwh-gettingstarted-070401\helloworld-native\lib\log4j-1.2.13.jar;C:\eclipse\db derby\db-derby-10.7.1.1-bin\lib\derbyclient.jar;C:\eclipse\hibernate-lib\hibernate-annotations-3.4.0.GA.jar;C:\eclipse\plugins\hibernate-distribution-3.3.2.GA\lib\required\commons-collections-3.1.jar;C:\eclipse\plugins\hibernate-distribution-3.3.2.GA\lib\required\javassist-3.9.0.GA.jar;C:\eclipse\plugins\hibernate-distribution-3.3.2.GA\lib\required\jta-1.1.jar;C:\eclipse\plugins\hibernate-distribution-3.3.2.GA\lib\bytecode\cglib\cglib-2.2.jar;C:\eclipse\plugins\ejb3-persistence-3.3.1.jar;C:\eclipse\plugins\hibernate-commons-annotations.jar;C:\eclipse\plugins\log4j\slf4j-1.6.1\slf4j-log4j12-1.6.1.jar;C:\eclipse\plugins\log4j\slf4j-1.6.1\slf4j-api-1.6.1.jar;C:\eclipse\db derby\db-derby-10.7.1.1-bin\lib\derby.jar;C:\eclipse\db derby\db-derby-10.7.1.1-bin\lib\derbynet.jar;C:\eclipse\db derby\db-derby-10.7.1.1-bin\lib\derbyrun.jar;C:\eclipse\db derby\db-derby-10.7.1.1-bin\lib\derbytools.jar, hibernate.bytecode.use_reflection_optimizer=false, java.vm.specification.name=Java Virtual Machine Specification, java.vm.specification.version=1.0, sun.cpu.endian=little, sun.os.patch.level=, connection.pool_size=2, java.io.tmpdir=C:\Users\JOSEPH~1.DYN\AppData\Local\Temp\, java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi, hibernate.default_schema=TESTSCHEMA, os.arch=amd64, java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment, java.ext.dirs=C:\Program Files\Java\jdk1.6.0_24\jre\lib\ext;C:\Windows\Sun\Java\lib\ext, user.dir=C:\Users\Brohjoe\workspace\HibernateExample, line.separator=
, java.vm.name=Java HotSpot(TM) 64-Bit Server VM, cache.provider_class=org.hibernate.cache.NoCacheProvider, file.encoding=Cp1252, java.specification.version=1.6, hibernate.connection.pool_size=2, hibernate.show_sql=true}
22:38:53,160  INFO DriverManagerConnectionProvider:147 - cleaning up connection pool: jdbc:derby://localhost:1527/HibernateDb;create=true
22:38:53,205 DEBUG AbstractEntityPersister:2673 - Static SQL for entity: com.hibernate.chapter3.School
22:38:53,206 DEBUG AbstractEntityPersister:2678 -  Version select: select schoolId from TESTSCHEMA.School where schoolId =?
22:38:53,206 DEBUG AbstractEntityPersister:2681 -  Snapshot select: select school_.schoolId, school_.publicSchool as publicSc2_0_, school_.schoolAddress as schoolAd3_0_, school_.studentCount as studentC4_0_, school_.schoolName as schoolName0_ from TESTSCHEMA.School school_ where school_.schoolId=?
22:38:53,206 DEBUG AbstractEntityPersister:2684 -  Insert 0: insert into TESTSCHEMA.School (publicSchool, schoolAddress, studentCount, schoolName, schoolId) values (?, ?, ?, ?, ?)
22:38:53,207 DEBUG AbstractEntityPersister:2685 -  Update 0: update TESTSCHEMA.School set publicSchool=?, schoolAddress=?, studentCount=?, schoolName=? where schoolId=?
22:38:53,207 DEBUG AbstractEntityPersister:2686 -  Delete 0: delete from TESTSCHEMA.School where schoolId=?
22:38:53,238 DEBUG EntityLoader:79 - Static select for entity com.hibernate.chapter3.School: select school0_.schoolId as schoolId0_0_, school0_.publicSchool as publicSc2_0_0_, school0_.schoolAddress as schoolAd3_0_0_, school0_.studentCount as studentC4_0_0_, school0_.schoolName as schoolName0_0_ from TESTSCHEMA.School school0_ where school0_.schoolId=?
22:38:53,239 DEBUG EntityLoader:79 - Static select for entity com.hibernate.chapter3.School: select school0_.schoolId as schoolId0_0_, school0_.publicSchool as publicSc2_0_0_, school0_.schoolAddress as schoolAd3_0_0_, school0_.studentCount as studentC4_0_0_, school0_.schoolName as schoolName0_0_ from TESTSCHEMA.School school0_ where school0_.schoolId=?
22:38:53,239 DEBUG EntityLoader:79 - Static select for entity com.hibernate.chapter3.School: select school0_.schoolId as schoolId0_0_, school0_.publicSchool as publicSc2_0_0_, school0_.schoolAddress as schoolAd3_0_0_, school0_.studentCount as studentC4_0_0_, school0_.schoolName as schoolName0_0_ from TESTSCHEMA.School school0_ where school0_.schoolId=? for read only with rs
22:38:53,239 DEBUG EntityLoader:79 - Static select for entity com.hibernate.chapter3.School: select school0_.schoolId as schoolId0_0_, school0_.publicSchool as publicSc2_0_0_, school0_.schoolAddress as schoolAd3_0_0_, school0_.studentCount as studentC4_0_0_, school0_.schoolName as schoolName0_0_ from TESTSCHEMA.School school0_ where school0_.schoolId=? for read only with rs
22:38:53,240 DEBUG EntityLoader:79 - Static select for entity com.hibernate.chapter3.School: select school0_.schoolId as schoolId0_0_, school0_.publicSchool as publicSc2_0_0_, school0_.schoolAddress as schoolAd3_0_0_, school0_.studentCount as studentC4_0_0_, school0_.schoolName as schoolName0_0_ from TESTSCHEMA.School school0_ where school0_.schoolId=? for read only with rs
22:38:53,253 DEBUG EntityLoader:34 - Static select for action ACTION_MERGE on entity com.hibernate.chapter3.School: select school0_.schoolId as schoolId0_0_, school0_.publicSchool as publicSc2_0_0_, school0_.schoolAddress as schoolAd3_0_0_, school0_.studentCount as studentC4_0_0_, school0_.schoolName as schoolName0_0_ from TESTSCHEMA.School school0_ where school0_.schoolId=?
22:38:53,253 DEBUG EntityLoader:34 - Static select for action ACTION_REFRESH on entity com.hibernate.chapter3.School: select school0_.schoolId as schoolId0_0_, school0_.publicSchool as publicSc2_0_0_, school0_.schoolAddress as schoolAd3_0_0_, school0_.studentCount as studentC4_0_0_, school0_.schoolName as schoolName0_0_ from TESTSCHEMA.School school0_ where school0_.schoolId=?
22:38:53,272 DEBUG SessionFactoryObjectFactory:39 - initializing class SessionFactoryObjectFactory
22:38:53,276 DEBUG SessionFactoryObjectFactory:76 - registered: 402881cc2f8fac59012f8fac6f460000 (unnamed)
22:38:53,277  INFO SessionFactoryObjectFactory:82 - Not binding factory to JNDI, no JNDI name configured
22:38:53,277 DEBUG SessionFactoryImpl:308 - instantiated session factory
22:38:53,285 DEBUG SessionFactoryImpl:390 - Checking 0 named HQL queries
22:38:53,286 DEBUG SessionFactoryImpl:410 - Checking 0 named SQL queries
22:38:53,349 DEBUG SessionImpl:220 - opened session at timestamp: 13037855333
22:38:53,421 DEBUG ThreadLocalSessionContext:290 - allowing method [beginTransaction] in non-transacted context
22:38:53,421 DEBUG ThreadLocalSessionContext:300 - allowing proxied method [beginTransaction] to proceed to real session
22:38:53,421 DEBUG JDBCTransaction:54 - begin
22:38:53,421 DEBUG ConnectionManager:415 - opening JDBC connection
22:38:53,422 DEBUG DriverManagerConnectionProvider:93 - total checked-out connections: 0
22:38:53,422 DEBUG DriverManagerConnectionProvider:109 - opening new JDBC connection
22:38:54,440 DEBUG JDBCExceptionReporter:63 - Cannot open connection [???]
java.sql.SQLNonTransientConnectionException: java.net.ConnectException : Error connecting to server localhost on port 1527 with message Connection refused: connect.
	at org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown Source)
	at org.apache.derby.client.am.SqlException.getSQLException(Unknown Source)
	at org.apache.derby.jdbc.ClientDriver.connect(Unknown Source)
	at java.sql.DriverManager.getConnection(DriverManager.java:582)
	at java.sql.DriverManager.getConnection(DriverManager.java:154)
	at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110)
	at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:417)
	at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)
	at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:119)
	at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:57)
	at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326)
	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 org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:301)
	at $Proxy8.beginTransaction(Unknown Source)
	at com.hibernate.chapter3.TestSchool.main(TestSchool.java:24)
Caused by: org.apache.derby.client.am.DisconnectException: java.net.ConnectException : Error connecting to server localhost on port 1527 with message Connection refused: connect.
	at org.apache.derby.client.net.NetAgent.<init>(Unknown Source)
	at org.apache.derby.client.net.NetConnection.newAgent_(Unknown Source)
	at org.apache.derby.client.am.Connection.<init>(Unknown Source)
	at org.apache.derby.client.net.NetConnection.<init>(Unknown Source)
	at org.apache.derby.client.net.NetConnection40.<init>(Unknown Source)
	at org.apache.derby.client.net.ClientJDBCObjectFactoryImpl40.newNetConnection(Unknown Source)
	... 16 more
Caused by: java.net.ConnectException: Connection refused: connect
	at java.net.PlainSocketImpl.socketConnect(Native Method)
	at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
	at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
	at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
	at java.net.Socket.connect(Socket.java:529)
	at java.net.Socket.connect(Socket.java:478)
	at java.net.Socket.<init>(Socket.java:375)
	at java.net.Socket.<init>(Socket.java:189)
	at javax.net.DefaultSocketFactory.createSocket(SocketFactory.java:206)
	at org.apache.derby.client.net.OpenSocketAction.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	... 22 more
22:38:54,442  WARN JDBCExceptionReporter:71 - SQL Error: 40000, SQLState: 08001
22:38:54,443 ERROR JDBCExceptionReporter:72 - java.net.ConnectException : Error connecting to server localhost on port 1527 with message Connection refused: connect.
Exception in thread "main" org.hibernate.exception.JDBCConnectionException: Cannot open connection
	at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:74)
	at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
	at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
	at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:420)
	at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)
	at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:119)
	at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:57)
	at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326)
	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 org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:301)
	at $Proxy8.beginTransaction(Unknown Source)
	at com.hibernate.chapter3.TestSchool.main(TestSchool.java:24)
Caused by: java.sql.SQLNonTransientConnectionException: java.net.ConnectException : Error connecting to server localhost on port 1527 with message Connection refused: connect.
	at org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown Source)
	at org.apache.derby.client.am.SqlException.getSQLException(Unknown Source)
	at org.apache.derby.jdbc.ClientDriver.connect(Unknown Source)
	at java.sql.DriverManager.getConnection(DriverManager.java:582)
	at java.sql.DriverManager.getConnection(DriverManager.java:154)
	at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110)
	at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:417)
	... 11 more
Caused by: org.apache.derby.client.am.DisconnectException: java.net.ConnectException : Error connecting to server localhost on port 1527 with message Connection refused: connect.
	at org.apache.derby.client.net.NetAgent.<init>(Unknown Source)
	at org.apache.derby.client.net.NetConnection.newAgent_(Unknown Source)
	at org.apache.derby.client.am.Connection.<init>(Unknown Source)
	at org.apache.derby.client.net.NetConnection.<init>(Unknown Source)
	at org.apache.derby.client.net.NetConnection40.<init>(Unknown Source)
	at org.apache.derby.client.net.ClientJDBCObjectFactoryImpl40.newNetConnection(Unknown Source)
	... 16 more
Caused by: java.net.ConnectException: Connection refused: connect
	at java.net.PlainSocketImpl.socketConnect(Native Method)
	at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
	at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
	at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
	at java.net.Socket.connect(Socket.java:529)
	at java.net.Socket.connect(Socket.java:478)
	at java.net.Socket.<init>(Socket.java:375)
	at java.net.Socket.<init>(Socket.java:189)
	at javax.net.DefaultSocketFactory.createSocket(SocketFactory.java:206)
	at org.apache.derby.client.net.OpenSocketAction.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	... 22 more

Open in new window

Avatar of brohjoe

ASKER

Wait a minute, let me run it again.  I forgot to open the Derby connection.
Avatar of brohjoe

ASKER

Stacktrace in attached Notepad file.
stacktrace.txt
ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of brohjoe

ASKER

Thanks Objects.