[Java] Membangun Aplikasi desktop dengan Spring dan Hibernate

Saya akan memberikan contoh kecil dalam membangun aplikasi dengan framework Spring dan Hibernate, dimana penggunaan atau integrasi kedua framework ini secara bersamaan benar-benar akan mengurangi effort dalam development, aplikasi yang telah saya buat ini adalah Sistem Informasi Penjualan PT. SUNSSU MEUBEL yang tentu saja nama perusahaan tersebut adalah fiktif. Aplikasi ini saya buat dengan netbeans 6.8, saya tidak menyertakan library yang dibutuhkan karena itu akan membuat ukuran file yang diupload menjadi besar, karena koneksi internet saya terengah-engah, jadi harap maklum. So, untuk library Spring dan Hibernate bisa ditambahkan lewat netbeans, anda juga harus menambahkan library untuk JasperReport, Mysql dan JCalendar, downloadnya dimana?? bisa dicari disini.

Aplikasi ini sebenarnya adalah aplikasi yang di buat untuk kelompok saya di kampus untuk suatu mata kuliah, tidak banyak waktu yang diberikan karena cenderung mendadak, sekitar 6 hari saja. Jadi mungkin masih banyak bugs dalam aplikasi ini, tapi setidaknya secara garis besar anda bisa sedikit mempelajari atau mengambil contoh dalam membuat aplikasi menggunakan Spring dan Hibernate.

Seperti yang kita ketahui kita dibiasakan membuat dao, implement dao, service lalu implement service, setelah itu kita menambahkan anotasi-anotasi standar Spring jika kita ingin meng-integrasi nya dengan Hibernate seperti @Repository, @Autowired, @Qualifier, @Transactional yang tentu saja kita sudah menambahkan <context:component-scan> pada spring context agar Spring bisa membaca anotasi-anotasi tersebut.

Kita tidak perlu lagi membuat session, membuka session, menutup session, karena semua itu sudah di urus oleh spring dengan anotasi @Transactional, kita tidak perlu lagi membuat bean yang bloated di spring context karena sudah diwakili oleh @Repository, kita tidak perlu lagi mereference secara manual lewat spring context karena sudah menggunakan @Autowired. Tentunya semuanya itu adalah tergantung situasi, karena pada suatu keadaan kita masih harus membuat beans, reference, dll.

Bagi yang sudah tidak sabar karena terlalu lama melihat saya mengoceh tidak jelas, silahkan download aplikasi tersebut lewat link dibawah ini :

Download Contoh Aplikasi dengan Spring+Hibernate

Jangan lupa sediakan cemilan, teh hangat (jangan kopi, masih muda tidak baik untuk kesehatan,hahaha…), dan posisi duduk yang pas, karena mungkin anda akan terbawa suasana merasakan alunan-alunan indah code java di setiap aliran darah dan hembusan nafas anda, lebay ya….hahaha,

Regards,

39 thoughts on “[Java] Membangun Aplikasi desktop dengan Spring dan Hibernate

  1. hmm.. klo boleh tau itu tugas untuk mata kuliah apa kak? buatnya cepet amat cuma 6 hari.. hehehe
    thx before :)

    [Reply]

    Kus Andriadi Reply:

    apa yah….mmmm, lupa namanya =))

    [Reply]

  2. saya sudah coba menjalankan program nya, tapi muncul error:

    Exception in thread “AWT-EventQueue-0″ java.lang.NullPointerException
    at com.sunssu.meubel.HibernateTemplate.HBTemplate.getMasterService(HBTemplate.java:31)

    kira2 letak kesalahan nya dimana ya?

    [Reply]

    Kus Andriadi Reply:

    database nya udah bener? :)

    [Reply]

  3. oh iya, ketika saya tangkap eksepsi pada syntax:
    applicationContext = new FileSystemXmlApplicationContext(“/conf/spring-ctx.xml”);

    muncul error:
    Unexpected exception parsing XML document from file [C:\Users\rudy\Documents\NetBeansProjects\SistemPenjualan\conf\spring-ctx.xml]; nested exception is java.lang.NoClassDefFoundError: org/aopalliance/intercept/MethodInterceptor

    [Reply]

    Kus Andriadi Reply:

    coba ke findjar.com…terus masukin org/aopalliance/intercept/MethodInterceptor….itu karena ada jar yang belom dimasukin….

    [Reply]

    rudy Reply:

    iya… ada library aopalliance.jar yg harus ditambahkan.

    apakah setiap membuat aplikasi spring-hibernate harus menyertakan library ini? saya menggunakan netbeans, library standar yg saya tambahkan sebelumnya hanya spring, hibernate, persistance, mysql jdbc.

    sebenarnya library apa saja sih yg dibutuhkan?

    [Reply]

    Kus Andriadi Reply:

    selama ini sih saya harus menyertakan library itu :D

    [Reply]

  4. saya mau tanya saya sudah donlod.sistem penjualan.rarnya, pas dibuka di netbeans masih ada tanda merah,,
    import net.sf.jasperreports.engine.JRException;
    import net.sf.jasperreports.engine.JasperCompileManager;
    import net.sf.jasperreports.engine.JasperFillManager;
    import net.sf.jasperreports.engine.JasperPrint;
    import net.sf.jasperreports.engine.JasperReport;
    import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
    import net.sf.jasperreports.view.JasperViewer;
    sy masih new bie, bisa minta bantuannya,,,berhubung menggunakan hibernate jadi saya belum tau cra menjalankan program teersebut,,,bisa dikasih tau cara menjalankan program tersebut,,,ada apa ada lagi librari yang harus diimport,,,sebelumnya sy ucapkan terima kasih

    [Reply]

    Kus Andriadi Reply:

    library jasperreport nya belum dimasukin :)

    [Reply]

  5. boleh tanya lagi klo begini,,,bagian mana ya yang harus diperbaiki?
    java.lang.NoClassDefFoundError: com/sunssu/meubel/main/SunssuMeubelMain
    Caused by: java.lang.ClassNotFoundException: com.sunssu.meubel.main.SunssuMeubelMain
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    Could not find the main class: com.sunssu.meubel.main.SunssuMeubelMain. Program will exit.
    Exception in thread “main” Java Result: 1

    [Reply]

    Kus Andriadi Reply:

    itu karena dia gak nemu class SunssuMeubelMain, itu lw apain kok bisa gak nemu? :)

    [Reply]

  6. mas kusandriadi, mau tanya ko aplikasinya ga bisa jalan….
    gmana cara jalanin aplikasinnya….

    [Reply]

    Kus Andriadi Reply:

    gak bisa jalannya disebelah mana? dan error nya kenapa mas? :)

    [Reply]

  7. tanggalSuratJalanDari.setCalendar(Calendar.getInstance());
    tanggalSuratJalanDari.setDateFormatString(“dd-MM-yyyy”);
    tanggalSuratJalanSampai.setCalendar(Calendar.getInstance());
    tanggalSuratJalanSampai.setDateFormatString(“dd-MM-yyyy”);
    }
    gan ko masih slah disini ya padahal library calendernya udah saya add truss sama satu lagi
    tanggalPesanan.setCalendar(Calendar.getInstance());
    tanggalPesanan.setDateFormatString(“dd-MM-yyyy”);
    kenapa ya gan .

    [Reply]

    Kus Andriadi Reply:

    pesan eror nya apa?

    [Reply]

  8. mas, supaya HBTemplatenya di load ketika startup gimana? soalnya kalo langsung manggil HBTemplate trus manggil service pasti null pointer karena gak dapet bean nya. Makasih..

    [Reply]

    Kus Andriadi Reply:

    bikin class baru mas buat ngeload itu,

    download aja app yang udah saya buat, disitu ada contohnya…

    maaf ya bales lama, saya sedang jarang ngurus blog :)

    [Reply]

  9. Mas..
    Guna Service Pattern itu untuk apa ya mas?
    saya baca ebook na ifnu bima Service digunakan untuk menyederhanakan kelas2 dao yang ada.
    dan apa beda konsep dao yang memakai interface sebagai dao dengan yang memakai kelas sebagai dao ?
    begitu pula dengan service na mas, ada yang pake interface dan ada yang pakai kelas,,?
    kalo saya liat service itu mirip controller ya mas dalam MVC?
    mohon pencerahan na mas..

    [Reply]

    Kus Andriadi Reply:

    ya memang untuk menyederhanakan class-class dao, dan biasanya service terdiri dari beberapa dao,

    apa bedanya yang menggunakan interface dengan yang memakai class??

    seperti yang kita ketahui, jika kita ingin mengimplementasi sebuah dao, kita bisa langsung mengimplement dao tersebut ke dalam sebuah class,

    jika menggunakan interface, tiap class yang mengimplementasi dao tersebut bisa mengisi method dengan tujuan dan maksud yang berbeda2…

    tapi jika class, jika ada class lain yang membutuhkan, dia tidak bisa melakukan perubahan yang diinginkan pada method dao tersebut.

    [Reply]

  10. Numpang tanya>>>>
    ini salahnya kenapa???
    Thanks…
    Error: Could not find or load main class rental_film.splash2

    [Reply]

    Kus Andriadi Reply:

    gak ketemu class mainnya :)

    [Reply]

  11. Kalau saya udah semua, tapi di run gak tampil, erornya dibawah ini, mohon bantannya.

    run:
    log4j:WARN No appenders could be found for logger (org.springframework.context.support.FileSystemXmlApplicationContext).
    log4j:WARN Please initialize the log4j system properly.
    Exception in thread “AWT-EventQueue-0″ org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘barangDaoHibernate’: Autowiring of fields failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory com.sunssu.meubel.dao.master.hibernate.BarangDaoHibernate.sessionFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sessionFactory’ defined in file [D:\ABDUL\Hibernate\SistemPenjualan\conf\spring-ctx.xml]: Cannot resolve reference to bean ‘dataSource’ while setting bean property ‘dataSource’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘dataSource’ defined in file [D:\ABDUL\Hibernate\SistemPenjualan\conf\spring-ctx.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
    PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property ‘driverClassName’ threw exception; nested exception is java.lang.IllegalStateException: Could not load JDBC driver class [com.mysql.jdbc.Driver]
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessAfterInstantiation(AutowiredAnnotationBeanPostProcessor.java:243)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:959)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
    at org.springframework.context.support.FileSystemXmlApplicationContext.(FileSystemXmlApplicationContext.java:140)
    at org.springframework.context.support.FileSystemXmlApplicationContext.(FileSystemXmlApplicationContext.java:84)
    at com.sunssu.meubel.HibernateTemplate.HBTemplate.getApplicationContext(HBTemplate.java:23)
    at com.sunssu.meubel.main.SunssuMeubelMain$16.run(SunssuMeubelMain.java:422)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:727)
    at java.awt.EventQueue.access$200(EventQueue.java:103)
    at java.awt.EventQueue$3.run(EventQueue.java:688)
    at java.awt.EventQueue$3.run(EventQueue.java:686)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:697)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
    Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory com.sunssu.meubel.dao.master.hibernate.BarangDaoHibernate.sessionFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sessionFactory’ defined in file [D:\ABDUL\Hibernate\SistemPenjualan\conf\spring-ctx.xml]: Cannot resolve reference to bean ‘dataSource’ while setting bean property ‘dataSource’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘dataSource’ defined in file [D:\ABDUL\Hibernate\SistemPenjualan\conf\spring-ctx.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
    PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property ‘driverClassName’ threw exception; nested exception is java.lang.IllegalStateException: Could not load JDBC driver class [com.mysql.jdbc.Driver]
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:435)
    at org.springframework.beans.factory.annotation.InjectionMetadata.injectFields(InjectionMetadata.java:105)
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessAfterInstantiation(AutowiredAnnotationBeanPostProcessor.java:240)
    … 31 more
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sessionFactory’ defined in file [D:\ABDUL\Hibernate\SistemPenjualan\conf\spring-ctx.xml]: Cannot resolve reference to bean ‘dataSource’ while setting bean property ‘dataSource’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘dataSource’ defined in file [D:\ABDUL\Hibernate\SistemPenjualan\conf\spring-ctx.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
    PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property ‘driverClassName’ threw exception; nested exception is java.lang.IllegalStateException: Could not load JDBC driver class [com.mysql.jdbc.Driver]
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:275)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:104)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1245)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:671)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:610)
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:412)
    … 33 more
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘dataSource’ defined in file [D:\ABDUL\Hibernate\SistemPenjualan\conf\spring-ctx.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
    PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property ‘driverClassName’ threw exception; nested exception is java.lang.IllegalStateException: Could not load JDBC driver class [com.mysql.jdbc.Driver]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1279)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:269)
    … 48 more
    Caused by: org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
    PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property ‘driverClassName’ threw exception; nested exception is java.lang.IllegalStateException: Could not load JDBC driver class [com.mysql.jdbc.Driver]
    at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:104)
    at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:59)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1276)
    … 59 more
    BUILD SUCCESSFUL (total time: 3 seconds)

    [Reply]

    abdul Reply:

    tolong ya mas, hehe,….

    [Reply]

    Kus Andriadi Reply:

    kurang library mysql connector

    [Reply]

  12. gan,, saya mau tanya??
    saya sudah includkan aopalliance, spring, hibernate, persistance, mysql jdbc, jasperreports, tp masih ada yang error seperti d bawah ini

    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:409)
    at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1118)
    at com.mysql.jdbc.MysqlIO.(MysqlIO.java:343)
    at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2308)
    at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2122)
    at com.mysql.jdbc.ConnectionImpl.(ConnectionImpl.java:774)
    at com.mysql.jdbc.JDBC4Connection.(JDBC4Connection.java:49)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:409)
    at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:375)
    at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:289)
    at java.sql.DriverManager.getConnection(DriverManager.java:579)
    at java.sql.DriverManager.getConnection(DriverManager.java:190)
    at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriverManager(DriverManagerDataSource.java:173)
    at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriver(DriverManagerDataSource.java:164)
    at org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.getConnectionFromDriver(AbstractDriverBasedDataSource.java:149)
    at org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.getConnection(AbstractDriverBasedDataSource.java:119)
    at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:81)
    at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:84)
    at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2009)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1292)
    at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:859)
    at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:860)
    at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:779)
    at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:848)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:790)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:707)
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:480)
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:84)
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:285)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1074)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
    at org.springframework.context.support.FileSystemXmlApplicationContext.(FileSystemXmlApplicationContext.java:140)
    at org.springframework.context.support.FileSystemXmlApplicationContext.(FileSystemXmlApplicationContext.java:84)
    at com.sunssu.meubel.HibernateTemplate.HBTemplate.getApplicationContext(HBTemplate.java:23)
    at com.sunssu.meubel.main.SunssuMeubelMain$16.run(SunssuMeubelMain.java:422)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:727)
    at java.awt.EventQueue.access$200(EventQueue.java:103)
    at java.awt.EventQueue$3.run(EventQueue.java:688)
    at java.awt.EventQueue$3.run(EventQueue.java:686)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:697)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
    Caused by: java.net.ConnectException: Connection refused: connect
    at java.net.DualStackPlainSocketImpl.connect0(Native Method)
    at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:69)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:157)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:391)
    at java.net.Socket.connect(Socket.java:579)
    at java.net.Socket.connect(Socket.java:528)
    at java.net.Socket.(Socket.java:425)
    at java.net.Socket.(Socket.java:241)
    at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:256)
    at com.mysql.jdbc.MysqlIO.(MysqlIO.java:292)

    mohon pencerahannya gan.
    Hatur nuhun.

    [Reply]

Leave a Reply