import javax.naming.Context; import javax.naming.InitialContext; import javax.sql.DataSource; datasourceJndi="jdbc/informixDB"; Context jndiCntx = new InitialContext(); DataSource ds = (javax.sql.DataSource)jndiCntx.lookup(datasourceJndi); //set the connection. super.con = ds.getConnection();
The code was not working and following stack trace is being thrown.
java.sql.SQLNonTransientException: J2CA8030E: Unable to find jdbcDriverRef com.ibm.ws.jdbc.jdbcDriver_gen_d3507f1a-ecba-4697-9861-d2fe2c14d742 for dataSource jdbc/informixDB. at org.huahsin.util.DaoManager.getDaoConnection(DaoManager.java:56) at org.huahsin.util.DaoManager.setSql(DaoManager.java:65) at org.huahsin.dao.MenuItemDao.findMenuByUserId(MenuItemDao.java:43) at org.huahsin.web.MenuBean.getMenuList(MenuBean.java:32) at org.huahsin.LoginBean.doLogin(LoginBean.java:243) 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.apache.el.parser.AstValue.invoke(AstValue.java:266) at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:278) at org.apache.jasper.el.JspMethodExpression.invoke(JspMethodExpression.java:70) at javax.faces.component._MethodExpressionToMethodBinding.invoke(_MethodExpressionToMethodBinding.java:88) at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:100) at javax.faces.component.UICommand.broadcast(UICommand.java:120) 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)
It was very hard for me to analyze this problem because there are not much people know there is a lightweight WebSphere Application Server ever exists in this world. And since this is new, the support usually is very limited. I have run out of clues on this issue. The temporary solution for this is to switch back to JDBC connection just for my local development
Class.forName("com.informix.jdbc.IfxDriver"); super.con = DriverManager.getConnection("jdbc:informix-sqli://xxx.xxx.xx.xx:2020/dbname:INFORMIXSERVER=online", "username", "password");
No comments:
Post a Comment