ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jason Hall" <JH...@cihi.ca>
Subject Problem with xml config files
Date Thu, 10 Feb 2005 20:04:06 GMT
Hi,

I'm testing ibatis for the first time using ibatis 2.0. I created the sqlMapConfig.xml, network.xml
(custom), Network.java (bean), and a servlet to invoke a the bean.
I get as far as the sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader); AT THIS POINT
IS WHERE I GET THE ERROR BELOW. 

Is there something wrong with my sqlMapConfig.xml and network.xml file.  I know there are
some differences in the previous versions with the latest.  I also notice in your latest documentation
you refer to old syntax which should mention the new syntax (ex. SqlMapClientBuilder.xmlBuildexxxxxxx(reader);
SHOULD BE -> SqlMapClientBuilder.buildSqlMapClient(reader) ).

Below are all the files i mentioned above

Note: I've added all the required jar files 

Using jdk 1.3.1 but also having the same problem with jdk 1.4.2



I'm receiving this error .....

javax.servlet.ServletException: Cannot allocate servlet instance for path /nms/servlet/ControllerServlet
	void org.apache.catalina.servlets.InvokerServlet.serveRequest(javax.servlet.http.HttpServletRequest,
javax.servlet.http.HttpServletResponse)
		InvokerServlet.java:388
	void org.apache.catalina.servlets.InvokerServlet.doGet(javax.servlet.http.HttpServletRequest,
javax.servlet.http.HttpServletResponse)
		InvokerServlet.java:133
	void javax.servlet.http.HttpServlet.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
		HttpServlet.java:696
	void javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
		HttpServlet.java:809
	void org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(javax.servlet.ServletRequest,
javax.servlet.ServletResponse)
		ApplicationFilterChain.java:200
	void org.apache.catalina.core.ApplicationFilterChain.doFilter(javax.servlet.ServletRequest,
javax.servlet.ServletResponse)
		ApplicationFilterChain.java:146
	void org.apache.catalina.core.StandardWrapperValve.invoke(org.apache.catalina.Request, org.apache.catalina.Response,
org.apache.catalina.ValveContext)
		StandardWrapperValve.java:209
	void org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(org.apache.catalina.Request,
org.apache.catalina.Response)
		StandardPipeline.java:596
	void org.apache.catalina.core.StandardPipeline.invoke(org.apache.catalina.Request, org.apache.catalina.Response)
		StandardPipeline.java:433
	void org.apache.catalina.core.ContainerBase.invoke(org.apache.catalina.Request, org.apache.catalina.Response)
		ContainerBase.java:948
	void org.apache.catalina.core.StandardContextValve.invoke(org.apache.catalina.Request, org.apache.catalina.Response,
org.apache.catalina.ValveContext)
		StandardContextValve.java:144
	void org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(org.apache.catalina.Request,
org.apache.catalina.Response)
		StandardPipeline.java:596
	void org.apache.catalina.core.StandardPipeline.invoke(org.apache.catalina.Request, org.apache.catalina.Response)
		StandardPipeline.java:433
	void org.apache.catalina.core.ContainerBase.invoke(org.apache.catalina.Request, org.apache.catalina.Response)
		ContainerBase.java:948
	void org.apache.catalina.core.StandardContext.invoke(org.apache.catalina.Request, org.apache.catalina.Response)
		StandardContext.java:2358
	void org.apache.catalina.core.StandardHostValve.invoke(org.apache.catalina.Request, org.apache.catalina.Response,
org.apache.catalina.ValveContext)
		StandardHostValve.java:133
	void org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(org.apache.catalina.Request,
org.apache.catalina.Response)
		StandardPipeline.java:596
	void org.apache.catalina.valves.ErrorDispatcherValve.invoke(org.apache.catalina.Request,
org.apache.catalina.Response, org.apache.catalina.ValveContext)
		ErrorDispatcherValve.java:118
	void org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(org.apache.catalina.Request,
org.apache.catalina.Response)
		StandardPipeline.java:594
	void org.apache.catalina.valves.ErrorReportValve.invoke(org.apache.catalina.Request, org.apache.catalina.Response,
org.apache.catalina.ValveContext)
		ErrorReportValve.java:116
	void org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(org.apache.catalina.Request,
org.apache.catalina.Response)
		StandardPipeline.java:594
	void org.apache.catalina.core.StandardPipeline.invoke(org.apache.catalina.Request, org.apache.catalina.Response)
		StandardPipeline.java:433
	void org.apache.catalina.core.ContainerBase.invoke(org.apache.catalina.Request, org.apache.catalina.Response)
		ContainerBase.java:948
	void org.apache.catalina.core.StandardEngineValve.invoke(org.apache.catalina.Request, org.apache.catalina.Response,
org.apache.catalina.ValveContext)
		StandardEngineValve.java:127
	void org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(org.apache.catalina.Request,
org.apache.catalina.Response)
		StandardPipeline.java:596
	void org.apache.catalina.core.StandardPipeline.invoke(org.apache.catalina.Request, org.apache.catalina.Response)
		StandardPipeline.java:433
	void org.apache.catalina.core.ContainerBase.invoke(org.apache.catalina.Request, org.apache.catalina.Response)
		ContainerBase.java:948
	void org.apache.coyote.tomcat4.CoyoteAdapter.service(org.apache.coyote.Request, org.apache.coyote.Response)
		CoyoteAdapter.java:152
	void org.apache.coyote.http11.Http11Processor.process(java.io.InputStream, java.io.OutputStream)
		Http11Processor.java:799
	void org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(org.apache.tomcat.util.net.TcpConnection,
java.lang.Object[])
		Http11Protocol.java:705
	void org.apache.tomcat.util.net.TcpWorkerThread.runIt(java.lang.Object[])
		PoolTcpEndpoint.java:577
	void org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run()
		ThreadPool.java:683
	void java.lang.Thread.run()
		Thread.java:484
root cause 
java.lang.NoSuchMethodError: void java.lang.RuntimeException.<init>(java.lang.String,
java.lang.Throwable)
	void com.ibatis.common.xml.NodeletParser.processNodelet(org.w3c.dom.Node, java.lang.String)
		NodeletParser.java:112
	void com.ibatis.common.xml.NodeletParser.process(org.w3c.dom.Node, com.ibatis.common.xml.NodeletParser$Path)
		NodeletParser.java:73
	void com.ibatis.common.xml.NodeletParser.process(org.w3c.dom.Node, com.ibatis.common.xml.NodeletParser$Path)
		NodeletParser.java:91
	void com.ibatis.common.xml.NodeletParser.parse(org.w3c.dom.Node)
		NodeletParser.java:61
	void com.ibatis.common.xml.NodeletParser.parse(java.io.Reader)
		NodeletParser.java:49
	com.ibatis.sqlmap.client.SqlMapClient com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(java.io.Reader)
		SqlMapConfigParser.java:77
	com.ibatis.sqlmap.client.SqlMapClient com.ibatis.sqlmap.client.SqlMapClientBuilder.buildSqlMapClient(java.io.Reader)
		SqlMapClientBuilder.java:62
	void ControllerServlet.<clinit>()
		ControllerServlet.java:28
	java.lang.Object java.lang.Class.newInstance0()
		native code
	java.lang.Object java.lang.Class.newInstance()
		Class.java:237
	javax.servlet.Servlet org.apache.catalina.core.StandardWrapper.loadServlet()
		StandardWrapper.java:856
	javax.servlet.Servlet org.apache.catalina.core.StandardWrapper.allocate()
		StandardWrapper.java:621
	void org.apache.catalina.servlets.InvokerServlet.serveRequest(javax.servlet.http.HttpServletRequest,
javax.servlet.http.HttpServletResponse)
		InvokerServlet.java:369
	void org.apache.catalina.servlets.InvokerServlet.doGet(javax.servlet.http.HttpServletRequest,
javax.servlet.http.HttpServletResponse)
		InvokerServlet.java:133
	void javax.servlet.http.HttpServlet.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
		HttpServlet.java:696
	void javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
		HttpServlet.java:809
	void org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(javax.servlet.ServletRequest,
javax.servlet.ServletResponse)
		ApplicationFilterChain.java:200
	void org.apache.catalina.core.ApplicationFilterChain.doFilter(javax.servlet.ServletRequest,
javax.servlet.ServletResponse)
		ApplicationFilterChain.java:146
	void org.apache.catalina.core.StandardWrapperValve.invoke(org.apache.catalina.Request, org.apache.catalina.Response,
org.apache.catalina.ValveContext)
		StandardWrapperValve.java:209
	void org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(org.apache.catalina.Request,
org.apache.catalina.Response)
		StandardPipeline.java:596
	void org.apache.catalina.core.StandardPipeline.invoke(org.apache.catalina.Request, org.apache.catalina.Response)
		StandardPipeline.java:433
	void org.apache.catalina.core.ContainerBase.invoke(org.apache.catalina.Request, org.apache.catalina.Response)
		ContainerBase.java:948
	void org.apache.catalina.core.StandardContextValve.invoke(org.apache.catalina.Request, org.apache.catalina.Response,
org.apache.catalina.ValveContext)
		StandardContextValve.java:144
	void org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(org.apache.catalina.Request,
org.apache.catalina.Response)
		StandardPipeline.java:596
	void org.apache.catalina.core.StandardPipeline.invoke(org.apache.catalina.Request, org.apache.catalina.Response)
		StandardPipeline.java:433
	void org.apache.catalina.core.ContainerBase.invoke(org.apache.catalina.Request, org.apache.catalina.Response)
		ContainerBase.java:948
	void org.apache.catalina.core.StandardContext.invoke(org.apache.catalina.Request, org.apache.catalina.Response)
		StandardContext.java:2358
	void org.apache.catalina.core.StandardHostValve.invoke(org.apache.catalina.Request, org.apache.catalina.Response,
org.apache.catalina.ValveContext)
		StandardHostValve.java:133
	void org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(org.apache.catalina.Request,
org.apache.catalina.Response)
		StandardPipeline.java:596
	void org.apache.catalina.valves.ErrorDispatcherValve.invoke(org.apache.catalina.Request,
org.apache.catalina.Response, org.apache.catalina.ValveContext)
		ErrorDispatcherValve.java:118
	void org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(org.apache.catalina.Request,
org.apache.catalina.Response)
		StandardPipeline.java:594
	void org.apache.catalina.valves.ErrorReportValve.invoke(org.apache.catalina.Request, org.apache.catalina.Response,
org.apache.catalina.ValveContext)
		ErrorReportValve.java:116
	void org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(org.apache.catalina.Request,
org.apache.catalina.Response)
		StandardPipeline.java:594
	void org.apache.catalina.core.StandardPipeline.invoke(org.apache.catalina.Request, org.apache.catalina.Response)
		StandardPipeline.java:433
	void org.apache.catalina.core.ContainerBase.invoke(org.apache.catalina.Request, org.apache.catalina.Response)
		ContainerBase.java:948
	void org.apache.catalina.core.StandardEngineValve.invoke(org.apache.catalina.Request, org.apache.catalina.Response,
org.apache.catalina.ValveContext)
		StandardEngineValve.java:127
	void org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(org.apache.catalina.Request,
org.apache.catalina.Response)
		StandardPipeline.java:596
	void org.apache.catalina.core.StandardPipeline.invoke(org.apache.catalina.Request, org.apache.catalina.Response)
		StandardPipeline.java:433
	void org.apache.catalina.core.ContainerBase.invoke(org.apache.catalina.Request, org.apache.catalina.Response)
		ContainerBase.java:948
	void org.apache.coyote.tomcat4.CoyoteAdapter.service(org.apache.coyote.Request, org.apache.coyote.Response)
		CoyoteAdapter.java:152
	void org.apache.coyote.http11.Http11Processor.process(java.io.InputStream, java.io.OutputStream)
		Http11Processor.java:799
	void org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(org.apache.tomcat.util.net.TcpConnection,
java.lang.Object[])
		Http11Protocol.java:705
	void org.apache.tomcat.util.net.TcpWorkerThread.runIt(java.lang.Object[])
		PoolTcpEndpoint.java:577
	void org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run()
		ThreadPool.java:683
	void java.lang.Thread.run()
		Thread.java:484






FILES FILES FILES FILES  BELOW   -------------------------------------------------------------------------



<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE sqlMapConfig PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN" "http://www.ibatis.com/dtd/sql-map-config-2.dtd">

<sqlMapConfig>

  

  <settings
    cacheModelsEnabled="true"
    enhancementEnabled="true"
    maxSessions="64"
    maxTransactions="8"
    maxRequests="128"/>

  <transactionManager type="JDBC">
    <dataSource type="SIMPLE">
      <property value="sun.jdbc.odbc.JdbcOdbcDriver" name="JDBC.Driver"/>
      <property value="jdbc:odbc:networkdb" name="JDBC.ConnectionURL"/>
      <property value="" name="JDBC.Username"/>
      <property value="" name="JDBC.Password"/>
      <property value="15" name="Pool.MaximumActiveConnections"/>
      <property value="15" name="Pool.MaximumIdleConnections"/>
      <property value="1000" name="Pool.MaximumWait"/>
    </dataSource>
  </transactionManager>

<sqlMap resource="map/network.xml"/>

</sqlMapConfig>


------------------------------------------------------------------------------------------------------------------------

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">


<sqlMap namespace="Network">

  <typeAlias alias="network" type="map.Network"/>

  <resultMap id="networkResult" class="network">
    <result property="netPrefixID2" column="NETPREFIXID"/>
 
  </resultMap>

  <select id="getNetwork" resultMap="networkResult" parameterClass="string">
    select
          NETWORK_PREFIX.NETPREFIXID,
    from NETWORK_PREFIX
  </select>


</sqlMap>






------------------------------------------------------------------------------------------------------------------------

package map;

public class Network {
	private String netPrefixID2 = null;


	public void setNetPrefixID(String netPrefixID2)
	{
		this.netPrefixID2 = netPrefixID2;
	}

	public String getNetPrefixID()
	{
		return netPrefixID2;
	}

}



------------------------------------------------------------------------------------------------------------------------
import java.io.*;
import java.util.*;
import java.sql.*;
import javax.servlet.*;



import com.ibatis.common.resources.*;
import com.ibatis.sqlmap.client.*;

import map.*;

public class ControllerServlet extends GenericServlet
{

	private static  SqlMapClient sqlMap=null;  //final should be defined!!!!!
    static String  m = null;
	static
	{
		try
		{
			String resource ="map/sqlMapConfig.xml";
			m ="1";
			Reader reader = Resources.getResourceAsReader (resource);
			m ="2";
			sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader); //ERROR HAPPENS AT THIS LINE !!!!!!!!!!!!!!!!!!!!!!!!!!!
			m ="3";
		}
		catch (Exception e)
		{
			e.printStackTrace();
			throw new RuntimeException ("jason"+m+" --- "+e);
		}
	}

......... and more

Mime
View raw message