Sunday, July 28, 2013

Wrong configuration in hibernate.chg.xml

This is very bad, do you know what will happened when you miss configure the hibernate configuration as the code shown below?
    username

    password


Here is the error I get when trying to establish a connection:
org.hibernate.exception.GenericJDBCException: Cannot open connection
 at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:140)
 at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:128)
 at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
 at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:52)
 at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:449)
 at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167)
 at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:160)
 at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:81)
 at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1473)
 at org.huahsin.dao.LoginDao.getUserByUserId(LoginDao.java:36)
 at org.huahsin.web.LoginAction.(LoginAction.java:69)
 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
 at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
 at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
 at java.lang.Class.newInstance0(Class.java:355)
 at java.lang.Class.newInstance(Class.java:308)
 at com.ibm.ws.jsf.config.annotation.WebSphereAnnotationLifecycleProvider.newInstance(WebSphereAnnotationLifecycleProvider.java:47)
 at org.apache.myfaces.config.ManagedBeanBuilder.buildManagedBean(ManagedBeanBuilder.java:162)
 at org.apache.myfaces.el.unified.resolver.ManagedBeanResolver.createManagedBean(ManagedBeanResolver.java:303)
 at org.apache.myfaces.el.unified.resolver.ManagedBeanResolver.getValue(ManagedBeanResolver.java:266)
 at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:55)
 at org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:142)
 at org.apache.myfaces.el.VariableResolverImpl.resolveVariable(VariableResolverImpl.java:65)
 at org.apache.myfaces.el.convert.VariableResolverToELResolver.getValue(VariableResolverToELResolver.java:116)
 at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:55)
 at org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:142)
 at org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:71)
 at org.apache.el.parser.AstValue.getTarget(AstValue.java:96)
 at org.apache.el.parser.AstValue.setValue(AstValue.java:200)
 at org.apache.el.ValueExpressionImpl.setValue(ValueExpressionImpl.java:425)
 at org.apache.myfaces.el.convert.ValueExpressionToValueBinding.setValue(ValueExpressionToValueBinding.java:125)
 at org.apache.myfaces.custom.updateactionlistener.UpdateActionListener.processAction(UpdateActionListener.java:154)
 at javax.faces.event.ActionEvent.processListener(ActionEvent.java:51)
 at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:344)
 at javax.faces.component.UICommand.broadcast(UICommand.java:103)
 at javax.faces.component.UIData.broadcast(UIData.java:757)
 at javax.faces.component.UIViewRoot._broadcastAll(UIViewRoot.java:937)
 at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:271)
 at javax.faces.component.UIViewRoot._process(UIViewRoot.java:1249)
 at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:675)
 at org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(InvokeApplicationExecutor.java:34)
 at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:171)
 at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:189)
 at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1221)
 at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:757)
 at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:440)
 at com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:125)
 at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:92)
 at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:97)
 at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:192)
 at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:89)
 at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:144)
 at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:192)
 at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:89)
 at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:939)
 at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1036)
 at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:81)
 at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:930)
 at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$1.run(DynamicVirtualHost.java:253)
 at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink$TaskWrapper.run(HttpDispatcherLink.java:457)
 at com.ibm.ws.threading.internal.Worker.executeWork(Worker.java:398)
 at com.ibm.ws.threading.internal.Worker.run(Worker.java:380)
 at java.lang.Thread.run(Thread.java:662)
Caused by: java.sql.SQLException: Incorrect password or user com.informix.asf.IfxASFRemoteException: Kok.Hoe.Loh@128.230.11.83 is not known on the database server.
 at com.informix.jdbc.IfxSqliConnect.(IfxSqliConnect.java:1195)
 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
 at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
 at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
 at com.informix.jdbc.IfxDriver.connect(IfxDriver.java:254)
 at java.sql.DriverManager.getConnection(DriverManager.java:582)
 at java.sql.DriverManager.getConnection(DriverManager.java:154)
 at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:133)
 at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446)
 ... 60 more
Caused by: com.informix.asf.IfxASFRemoteException: Kok.Hoe.Loh@128.230.11.83
 at com.informix.asf.Connection.recvConnectionResponse(Connection.java:688)
 at com.informix.asf.Connection.establishConnection(Connection.java:1613)
 at com.informix.asf.Connection.(Connection.java:347)
 at com.informix.jdbc.IfxSqliConnect.(IfxSqliConnect.java:1055)
 ... 69


Guess what is wrong with the code shown above? I was so surprise that I have miss type the hibernate.connection.username to hibernate.username and also hibernate.connection.password to hibernate.password.


No comments: