Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4122732
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T23:31:11+00:00 2026-05-20T23:31:11+00:00

I am really in a great problem here. I am connecting Db2 thriugh Hibernate.

  • 0

I am really in a great problem here. I am connecting Db2 thriugh Hibernate.

Below is my hibernate.cfg.xml file code for db2 connection

    <property name="dialect">org.hibernate.dialect.DB2Dialect</property>
    <property name="transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>
    <property name="hibernate.connection.datasource">jdbc/hla</property>     
<property name="hibernate.show_sql">false</property>
<property name="connection.driver_class">com.ibm.db2.jcc.DB2Driver</property>
<property name="connection.url">jdbc:db2://192.262.3.12:34333/dbname;create=true</property>
    <property name="connection.username">Db2admin</property>
    <property name="connection.password">******</property>  

When I try to create session

Session session = HibernateUtil.getSessionFactory().getCurrentSession();

It throws exception. I am attaching part of that exception. Hope it will help.

16:15:33,749 ERROR [DispatchAction] Dispatch[/list] to method 'listComponents' returned an exception
java.lang.reflect.InvocationTargetException
    at sun.reflect.GeneratedMethodAccessor66.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:615)
    at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:269)
    at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:170)
    at org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:58)
    at org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:67)
    at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
    at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
    at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
    at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
    at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
    at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
    at java.lang.Thread.run(Thread.java:797)
Caused by: 
java.lang.NoClassDefFoundError: com.sit.util.HibernateUtil (initialization failure)
    at java.lang.J9VMInternals.initialize(J9VMInternals.java:123)
    at com.core.dao.Dao.getAlls(Unknown Source)
    at com.sit.visualisation.actions.VisualListAction(VisualListAction.java:99)
    ... 34 more
Caused by: 
java.lang.Throwable: java.lang.ExceptionInInitializerError

Any Help will be highly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T23:31:12+00:00Added an answer on May 20, 2026 at 11:31 pm

    Why are you defining a “data source” and the connection properties (jdbc url, username, password)? You should either consume a data source provided by your container (preferred) or let Hibernate connect directly to the database (useful in standalone environments).

    In your case, the exception is that Hibernate cannot get connections from JNDI using the name “jdbc/hla”. So, check your application server’s configuration. If you remove the data source configuration, Hibernate will try to connect directly to the database, using the other information you provided (jdbc url, username, password).

    <!-- Hibernate will try to get "jdbc/hla" from the application server -->
    <property name="hibernate.connection.datasource">jdbc/hla</property>     
    
    <!-- Hibernate will try to connect directly to the database -->
    <property name="connection.url">jdbc:db2://192.262.3.12:34333/dbname;create=true</property>
    <property name="connection.username">Db2admin</property>
    <property name="connection.password">******</property>  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Friends its really giving me a great head ache about the problem I am
ReSharper Code cleanup feature (with reorder members and reformat code enabled) is really great.
So Hibernate Supports the latest Version of Firebird, which is really great. But... I
Can you help me out here? A really simple problem but I just can't
I was here yesterday and got some really great answers. I took what I
I have just started coding in AS3 and it would be really great to
I just started using Pantheios and it feels really like a great library for
Boost is a great set of libraries and it really boosts productivity. But debugging
I really like the IIS7 URL rewriting module and so far, it worked great
actually I thought I was trying something really simple. ControllerClassNameHandlerMapping sounded great to produce

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.