求助:SimpleJdonFrameworkTest+tomcat5.5配置完运行出错

07-04-05 mjp0625
按照"readme_cn.txt"完成配置
访问http://localhost:8080/testWeb/,报错

2007-04-05 22:32:50,197[INFO]com.jdon.container.builder.ContainerDirector - <======== Jdon Framework started successfully! =========>
2007-04-05 22:32:50,267[ERROR]com.jdon.framework.test.dao.JdbcDAO - javax.naming.NameNotFoundException: Name com is not bound in this Context
2007-04-05 22:32:50,277[ERROR]com.jdon.framework.test.service.TestServicePOJOImp - java.lang.NullPointerException
2007-04-05 22:32:50,287[WARN]org.apache.struts.action.RequestProcessor - Unhandled Exception thrown: class java.lang.Exception
2007-04-05 22:32:50,287[ERROR]org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/testWeb].[action] - Servlet.service() for servlet action threw exception
java.lang.Exception: getPageIterator's result is null, check your ModelListAction subclass
at com.jdon.strutsutil.ModelListAction.execute(ModelListAction.java:67)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397)
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:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at com.jdon.util.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:92)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
at java.lang.Thread.run(Unknown Source)

大家帮忙看看什么原因,谢谢了!

mjp0625
2007-04-06 14:22
新的发现,问题就出现在“com.jdon.framework.test.dao.jdbcDao.java”->public JdbcDAO(...)中dataSource = (DataSource) sl.getDataSource(constants.getJndiname());抛出异常,如果将这个异常捕获,让后面语句继续执行页面就可以显示,但是数据显示不出来,而且也无法插入。
日志报错变为:

[ERROR]com.jdon.model.query.block.BlockQueryJDBCTemp - java.lang.NullPointerException

那么还是数据源配置有问题了,我的server.xml中的连接池是这样写的

<Context path="/testWeb" docBase="testWeb" debug="0" reloadable="true" crossContext="true">
<Resource name="jdbc/TestDS" auth="Container" type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000"
username="sa" password=""
driverClassName="net.sourceforge.jtds.jdbc.Driver"
url="jdbc:jtds:sqlserver://127.0.0.1:1433/testDb;charset=gb2312;autoReconnect=true"/>
</Context>

“jdonframework.xml”内容:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE app PUBLIC "-//JDON//DTD Framework 2005 1.0 //EN" "http://www.jdon.com/jdonframework.dtd">
<app>
<models>
<model key="userId" class ="com.jdon.framework.test.model.UserTest">
<actionForm name="userActionForm"/>
<handler>
<service ref="testService">
<getMethod name="getUser" />
<createMethod name="createUser" />
<updateMethod name="updateUser" />
<deleteMethod name="deleteUser" />
</service>
</handler>
</model>
</models>
<services>

<pojoService name="testService" class="com.jdon.framework.test.service.TestServicePOJOImp"/>

<pojoService name="constants" class="com.jdon.framework.test.Constants">
<constructor value="java:com/env/jdbc/TestDS"/>
</pojoService>

<pojoService class="com.jdon.framework.test.dao.JdbcDAO" name="jdbcDAO">
<constructor value="java:com/env/jdbc/TestDS"/>
</pojoService>

</services>
</app>

在testWeb下新建一个test.jsp对这个连接池进行测试是没有问题的。
大家看看是哪儿出问题了,谢谢各位了。

[该贴被mjp0625于2007年04月06日 14:36修改过]

[该贴被mjp0625于2007年04月06日 14:38修改过]

mjp0625
2007-04-06 17:38
tomcat中出现的问题无法解决,于是又装了一套jboss,按照说明文件进行配置,测试连接池都没有问题。但最后的结果还是和tomcat的情况一样,无法显示和插入数据。
大家都没有碰到这样的情况吗?

banq
2007-04-07 11:02
>javax.naming.NameNotFoundException: Name com is not bound
你的JNDI名称写错误,应该是java:comp/env 不是java:com
少个p

mjp0625
2007-04-09 10:43
谢谢banq,终于可以正常运行了。

jdonfans
2007-04-11 16:51
Ooops! 以后注意了

xkhwj
2007-05-24 09:21
banq老师,我也被这个问题困惑了很久。原来如此。
不过,你给的例子中原文如下:
java:/TestDS是jboss的JNDI数据库写法,tomcat是java:com/env/这里是server.xml中的datatsource JNDI名

可能是你的笔误,导致我们这些初学者不知所以!