You can specify this in maven, but make sure you set the scope:
<scope>provided</scope> Cheers, Tim On 17/08/2009 15:04, "marius d." <marius.dan...@gmail.com> wrote: > > The JDBC driver should not be in the applications class-path (WEB-INF/ > lib) but in container's classpath. Say jetty's lib folder. > > Br's, > Marius > > On Aug 17, 2:24 pm, Goldfish <gregt...@mindspring.com> wrote: >> I am trying to point my app at an Oracle database, but am getting >> ClassNotFound exceptions: >> >> [INFO] Scanning for projects... >> [INFO] >> ------------------------------------------------------------------------ >> [INFO] Building cims2 >> [INFO] task-segment: [jetty:run] >> [INFO] >> ------------------------------------------------------------------------ >> [INFO] Preparing jetty:run >> [INFO] [resources:resources {execution: default-resources}] >> [WARNING] Using platform encoding (Cp1252 actually) to copy filtered >> resources, >> i.e. build is platform dependent! >> [INFO] Copying 1 resource >> [INFO] [yuicompressor:compress {execution: default}] >> [INFO] nb warnings: 0, nb errors: 0 >> [INFO] [compiler:compile {execution: default-compile}] >> [INFO] Nothing to compile - all classes are up to date >> [INFO] [scala:compile {execution: default}] >> [INFO] Checking for multiple versions of scala >> [INFO] Nothing to compile - all classes are up to date >> [INFO] [resources:testResources {execution: default-testResources}] >> [WARNING] Using platform encoding (Cp1252 actually) to copy filtered >> resources, >> i.e. build is platform dependent! >> [INFO] Copying 0 resource >> [INFO] [compiler:testCompile {execution: default-testCompile}] >> [INFO] Nothing to compile - all classes are up to date >> [INFO] [scala:testCompile {execution: default}] >> [INFO] Checking for multiple versions of scala >> [INFO] Nothing to compile - all classes are up to date >> [INFO] [jetty:run {execution: default-cli}] >> [INFO] Configuring Jetty for project: cims2 >> [INFO] Webapp source directory = H:\lift\cims2\src\main\webapp >> [INFO] Reload Mechanic: automatic >> [INFO] Classes = H:\lift\cims2\target\classes >> 2009-08-17 07:20:58.078::INFO: Logging to STDERR via >> org.mortbay.log.StdErrLog >> [INFO] Context path = / >> [INFO] Tmp directory = determined at runtime >> [INFO] Web defaults = org/mortbay/jetty/webapp/webdefault.xml >> [INFO] Web overrides = none >> [INFO] web.xml file = H:\lift\cims2\src\main\webapp\WEB-INF\web.xml >> [INFO] Webapp directory = H:\lift\cims2\src\main\webapp >> [INFO] Starting jetty 6.1.19 ... >> 2009-08-17 07:20:58.296::INFO: jetty-6.1.19 >> 2009-08-17 07:20:59.000::INFO: No Transaction manager found - if your >> webapp re >> quires one, please configure one. >> java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver >> at java.net.URLClassLoader$1.run(URLClassLoader.java:200) >> at java.security.AccessController.doPrivileged(Native Method) >> at java.net.URLClassLoader.findClass(URLClassLoader.java:188) >> at java.lang.ClassLoader.loadClass(ClassLoader.java:307) >> >> I put ojdbc.jar in both src/webapp and src/webapp/WEB-INF and it makes >> no difference. I dug into the code so that I could figure out how to >> use props files instead of editing Boot.scala too much, and managed to >> define src/main/resources/default.props, which I can tell is read, >> because it is obviously trying to load in >> oracle.jdbc.driver.OracleDriver, which came from my props file. My >> Boot.scala file looks like: >> >> package bootstrap.liftweb >> >> import _root_.net.liftweb.util._ >> import _root_.net.liftweb.http._ >> import _root_.net.liftweb.sitemap._ >> import _root_.net.liftweb.sitemap.Loc._ >> import Helpers._ >> import _root_.net.liftweb.mapper.{DB, ConnectionManager, Schemifier, >> DefaultConnectionIdentifier, ConnectionIdentifier} >> import _root_.java.sql.{Connection, DriverManager} >> import _root_.com.harris.cims.model._ >> import _root_.javax.servlet.http.{HttpServletRequest} >> >> /** >> * A class that's instantiated early and run. It allows the >> application >> * to modify lift's environment >> */ >> class Boot { >> def boot { >> if (!DB.jndiJdbcConnAvailable_?) >> DB.defineConnectionManager(DefaultConnectionIdentifier, >> DBVendor) >> >> // where to search snippet >> LiftRules.addToPackages("com.harris.cims") >> Schemifier.schemify(false, Log.infoF _, User, CarrierAccount) >> >> // Build SiteMap >> val entries = Menu(Loc("Home", List("index"), "Home")) :: >> User.sitemap >> LiftRules.setSiteMap(SiteMap(entries:_*)) >> >> /* >> * Show the spinny image when an Ajax call starts >> */ >> LiftRules.ajaxStart = >> Full(() => LiftRules.jsArtifacts.show("ajax-loader").cmd) >> >> /* >> * Make the spinny image go away when it ends >> */ >> LiftRules.ajaxEnd = >> Full(() => LiftRules.jsArtifacts.hide("ajax-loader").cmd) >> >> LiftRules.early.append(makeUtf8) >> >> S.addAround(DB.buildLoanWrapper) >> } >> >> /** >> * Force the request to be UTF-8 >> */ >> private def makeUtf8(req: HttpServletRequest) { >> req.setCharacterEncoding("UTF-8") >> } >> >> } >> >> /** >> * Database connection calculation >> */ >> object DBVendor extends ConnectionManager { >> private var pool: List[Connection] = Nil >> private var poolSize = 0 >> private val maxPoolSize = 4 >> >> private def createOne: Box[Connection] = try { >> val driverName: String = Props.get("db.driver") openOr >> "org.apache.derby.jdbc.EmbeddedDriver" >> >> val dbUrl: String = Props.get("db.url") openOr >> "jdbc:derby:lift_example;create=true" >> >> Class.forName(driverName) >> >> val dm = (Props.get("db.user"), Props.get("db.password")) match { >> case (Full(user), Full(pwd)) => >> DriverManager.getConnection(dbUrl, user, pwd) >> >> case _ => DriverManager.getConnection(dbUrl) >> } >> >> Full(dm) >> } catch { >> case e: Exception => e.printStackTrace; Empty >> } >> >> def newConnection(name: ConnectionIdentifier): Box[Connection] = >> synchronized { >> pool match { >> case Nil if poolSize < maxPoolSize => >> val ret = createOne >> poolSize = poolSize + 1 >> ret.foreach(c => pool = c :: pool) >> ret >> >> case Nil => wait(1000L); newConnection(name) >> case x :: xs => try { >> x.setAutoCommit(false) >> Full(x) >> } catch { >> case e => try { >> pool = xs >> poolSize = poolSize - 1 >> x.close >> newConnection(name) >> } catch { >> case e => newConnection(name) >> } >> } >> } >> } >> >> def releaseConnection(conn: Connection): Unit = synchronized { >> pool = conn :: pool >> notify >> } >> >> } >> >> Any ideas? > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~----------~----~----~----~------~----~------~--~---