我正在阅读 Gilberto T. Garcia Jr 的 Lift Application Development Cookbook,遇到了一个我似乎无法解决的问题。我已经复制了源代码 Chap06-map-table,我正在尝试修改它以与我的 IBM i(iSeries、AS/400、i5)数据库一起使用。我能够使用 Squeryl Record 使其与第一种类型的连接一起工作。但是,我似乎无法弄清楚如何使用 JNDI 数据源使其工作。我花了几天时间在 Internet 上搜索设置示例,但没有找到涉及 DB/400 数据库连接的好示例。以下是我尝试启动容器时遇到的错误以及我为使其工作而修改的代码。任何帮助,将不胜感激。谢谢。鲍勃
这是错误:
> container:start
[info] jetty-8.0.4.v20111024
[warn] Config error at <New id="dsliftbook" class="org.eclipse.jetty.plus.jndi.R
esource"><Arg/><Arg>jdbc/dsliftbook</Arg><Arg>
[warn] <New class="class com.ibm.as400.access.AS400JDBCConnectionPoolDataS
ource"><Set name="Url">"jdbc:as400://www.server.com/play2test;naming=system;erro
rs=full"</Set><Set name="User">user</Set><Set name="Password">password</Set></New>
[warn] </Arg></New>java.lang.ClassNotFoundException: class com.ibm.as400.acce
ss.AS400JDBCConnectionPoolDataSource
[warn] Failed startup of context o.e.j.w.WebAppContext{/,[file:/C:/Users/user/Lif
t26Projects/scala_210/chap06-map-table/src/main/webapp/]}
[info] Started SelectChannelConnector@0.0.0.0:8080 STARTING
[success] Total time: 0 s, completed Dec 15, 2013 12:21:59 AM
>
这是修改后的 jetty-env-xml 文件:
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty
/configure.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<New id="dsliftbook" class="org.eclipse.jetty.plus.jndi.Resource">
<Arg></Arg>
<Arg>jdbc/dsliftbook</Arg>
<Arg>
<New class="class com.ibm.as400.access.AS400JDBCConnectionPoolDataSource">
<Set name="Url">"jdbc:as400://www.server.com/play2test;naming=system;errors=full"
</Set>
<Set name="User">user</Set>
<Set name="Password">password</Set>
</New>
</Arg>
</New>
</Configure>
这是修改后的 build.sbt 文件:
libraryDependencies ++= {
val liftVersion = "2.5"
Seq(
"net.liftweb" %% "lift-webkit" % liftVersion % "compile",
"net.liftmodules" %% "lift-jquery-module_2.5" % "2.3",
"org.eclipse.jetty" % "jetty-webapp" % "8.0.4.v20111024" % "container",
"org.eclipse.jetty" % "jetty-plus" % "8.0.4.v20111024" % "container",
"ch.qos.logback" % "logback-classic" % "1.0.6",
"org.specs2" %% "specs2" % "1.14" % "test",
"net.liftweb" %% "lift-squeryl-record" % liftVersion % "compile",
"net.sf.jt400" % "jt400" % "6.7",
"org.liquibase" % "liquibase-maven-plugin" % "3.0.2"
)
}