Re: [Lift] Re: Can't find the jdbc:mysql driver in Production Mode ?

2009-11-28 Thread Neil.Lv
  Thanks very much!

  It's in the production mode now.

  This snippet's result is "production"

Cheers,
  Neil


David Pollak wrote:
> Write a snippet:
>
> import net.liftweb.util.Props
> import scala.xml._
>
> class WhatMode {
>   def render = Text(Props.modeName)
> }
>
> On a page:
>
> 
>
> And the mode will be listed (or blank for development mode)
>
> On Sat, Nov 28, 2009 at 6:23 AM, Neil.Lv  wrote:
>
> >
> >  I missing the production.default.props file in the /src/main/
> > resources/props folder
> >
> >  I create a file named production.default.props(copy from
> > default.props) in this folder.
> >
> >  When i enter a invalid URL like:
> >http://192.168.1.102/fsdf
> >
> >  The browser will show this message:
> >The Requested URL/fsdfwas not found on this server
> >
> >   Is it in the production mode now?
> >
> > Cheers,
> >  Neil
> >
> >
> > David Pollak wrote:
> > > Do a println to output the value of Props.get("db.driver")
> > >
> > > On Sat, Nov 28, 2009 at 6:06 AM, Neil.Lv  wrote:
> > >
> > > >
> > > >  It generated by the archetype lift-archetype-basic.
> > > >
> > > > ##  in the Boot.scala
> > > > 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
> > > >  }
> > > > }
> > > >
> > > > ##
> > > >
> > > >   And this is my default.props (In src\main\resources\props )
> > > >   Only this file in the props folder.
> > > >
> > > > ###
> > > > db.driver=com.mysql.jdbc.Driver
> > > > db.url=jdbc:mysql://localhost:3306/project
> > > > db.user=root
> > > > db.password=root
> > > > ###
> > > >
> > > > Cheers,
> > > >  Neil
> > > >
> > > >
> > > > On Nov 28, 7:57 pm, Timothy Perrett  wrote:
> > > > > Paste your database connection object? its probably that you copied
> > the
> > > > one from lift examples and you are now missing the correct properties
> > > > file...
> > > > >
> > > > > Cheers, Tim
> > > > >
> > > > > On 28 Nov 2009, at 10:26, Neil.Lv wrote:
> > > > >
> > > > > > Hi all,
> > > > >
> > > > > >   I have a silly question about the lift app that deployed on the
> > > > > > Jetty server.
> > > > >
> > > > > >   Can't find the jdbc:mysql driver in Production Mode ? It will use
> > > > > > the derby to instead of the mysql.
> > > > >
> > > > > >  But it works fine in the Development Mode.
> > > > >
> > > > > >  I will craete the derby file in the jetty folder.
> > > > > >  /home/jetty6/derby.log
> > > > > >  /home/jetty6/lift-example
> > > > >
> > > > > >  Thanks for any suggestion!
> > > > >
> > > > > > Cheers,
> > > > > >  Neil
> > > > >
> > > > > > --
> > > > >
> > > > > > You received this message because you are subscribed to the Google
> > > > Groups "Lift" group.
> > > > > > To post to this group, send email to lift...@googlegroups.com.
> > > > > > To unsubscribe from this group, send email to
> > > > liftweb+unsubscr...@googlegroups.com
> > 
> > >
> > > > .
> > > > > > For more options, visit this group athttp://
> > > > groups.google.com/group/liftweb?hl=en.
> > > >
> > > > --
> > > >
> > > > You received this message because you are subscribed to the Google
> > Groups
> > > > "Lift" group.
> > > > To post to this group, send email to lift...@googlegroups.com.
> > > > To unsubscribe from this group, 

Re: [Lift] Re: Can't find the jdbc:mysql driver in Production Mode ?

2009-11-28 Thread David Pollak
Write a snippet:

import net.liftweb.util.Props
import scala.xml._

class WhatMode {
  def render = Text(Props.modeName)
}

On a page:



And the mode will be listed (or blank for development mode)

On Sat, Nov 28, 2009 at 6:23 AM, Neil.Lv  wrote:

>
>  I missing the production.default.props file in the /src/main/
> resources/props folder
>
>  I create a file named production.default.props(copy from
> default.props) in this folder.
>
>  When i enter a invalid URL like:
>http://192.168.1.102/fsdf
>
>  The browser will show this message:
>The Requested URL/fsdfwas not found on this server
>
>   Is it in the production mode now?
>
> Cheers,
>  Neil
>
>
> David Pollak wrote:
> > Do a println to output the value of Props.get("db.driver")
> >
> > On Sat, Nov 28, 2009 at 6:06 AM, Neil.Lv  wrote:
> >
> > >
> > >  It generated by the archetype lift-archetype-basic.
> > >
> > > ##  in the Boot.scala
> > > 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
> > >  }
> > > }
> > >
> > > ##
> > >
> > >   And this is my default.props (In src\main\resources\props )
> > >   Only this file in the props folder.
> > >
> > > ###
> > > db.driver=com.mysql.jdbc.Driver
> > > db.url=jdbc:mysql://localhost:3306/project
> > > db.user=root
> > > db.password=root
> > > ###
> > >
> > > Cheers,
> > >  Neil
> > >
> > >
> > > On Nov 28, 7:57 pm, Timothy Perrett  wrote:
> > > > Paste your database connection object? its probably that you copied
> the
> > > one from lift examples and you are now missing the correct properties
> > > file...
> > > >
> > > > Cheers, Tim
> > > >
> > > > On 28 Nov 2009, at 10:26, Neil.Lv wrote:
> > > >
> > > > > Hi all,
> > > >
> > > > >   I have a silly question about the lift app that deployed on the
> > > > > Jetty server.
> > > >
> > > > >   Can't find the jdbc:mysql driver in Production Mode ? It will use
> > > > > the derby to instead of the mysql.
> > > >
> > > > >  But it works fine in the Development Mode.
> > > >
> > > > >  I will craete the derby file in the jetty folder.
> > > > >  /home/jetty6/derby.log
> > > > >  /home/jetty6/lift-example
> > > >
> > > > >  Thanks for any suggestion!
> > > >
> > > > > Cheers,
> > > > >  Neil
> > > >
> > > > > --
> > > >
> > > > > You received this message because you are subscribed to the Google
> > > Groups "Lift" group.
> > > > > To post to this group, send email to lift...@googlegroups.com.
> > > > > To unsubscribe from this group, send email to
> > > liftweb+unsubscr...@googlegroups.com
> 
> >
> > > .
> > > > > For more options, visit this group athttp://
> > > groups.google.com/group/liftweb?hl=en.
> > >
> > > --
> > >
> > > You received this message because you are subscribed to the Google
> Groups
> > > "Lift" group.
> > > To post to this group, send email to lift...@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.
> > >
> > >
> > >
> >
> >
> > --
> > Lift, the simply functional web framework http://liftweb.net
> > Beginning Scala http://www.apress.com/book/view/1430219890
> > Follow me: http://twitter.com/dpp
> > Surf the harmonics
>
> --
>
> You received this message because you are subscribed to the Goo

Re: [Lift] Re: Can't find the jdbc:mysql driver in Production Mode ?

2009-11-28 Thread Neil.Lv

  I missing the production.default.props file in the /src/main/
resources/props folder

  I create a file named production.default.props(copy from
default.props) in this folder.

  When i enter a invalid URL like:
http://192.168.1.102/fsdf

  The browser will show this message:
The Requested URL/fsdfwas not found on this server

   Is it in the production mode now?

Cheers,
  Neil


David Pollak wrote:
> Do a println to output the value of Props.get("db.driver")
>
> On Sat, Nov 28, 2009 at 6:06 AM, Neil.Lv  wrote:
>
> >
> >  It generated by the archetype lift-archetype-basic.
> >
> > ##  in the Boot.scala
> > 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
> >  }
> > }
> >
> > ##
> >
> >   And this is my default.props (In src\main\resources\props )
> >   Only this file in the props folder.
> >
> > ###
> > db.driver=com.mysql.jdbc.Driver
> > db.url=jdbc:mysql://localhost:3306/project
> > db.user=root
> > db.password=root
> > ###
> >
> > Cheers,
> >  Neil
> >
> >
> > On Nov 28, 7:57 pm, Timothy Perrett  wrote:
> > > Paste your database connection object? its probably that you copied the
> > one from lift examples and you are now missing the correct properties
> > file...
> > >
> > > Cheers, Tim
> > >
> > > On 28 Nov 2009, at 10:26, Neil.Lv wrote:
> > >
> > > > Hi all,
> > >
> > > >   I have a silly question about the lift app that deployed on the
> > > > Jetty server.
> > >
> > > >   Can't find the jdbc:mysql driver in Production Mode ? It will use
> > > > the derby to instead of the mysql.
> > >
> > > >  But it works fine in the Development Mode.
> > >
> > > >  I will craete the derby file in the jetty folder.
> > > >  /home/jetty6/derby.log
> > > >  /home/jetty6/lift-example
> > >
> > > >  Thanks for any suggestion!
> > >
> > > > Cheers,
> > > >  Neil
> > >
> > > > --
> > >
> > > > You received this message because you are subscribed to the Google
> > Groups "Lift" group.
> > > > To post to this group, send email to lift...@googlegroups.com.
> > > > To unsubscribe from this group, send email to
> > liftweb+unsubscr...@googlegroups.com
> > .
> > > > For more options, visit this group athttp://
> > groups.google.com/group/liftweb?hl=en.
> >
> > --
> >
> > You received this message because you are subscribed to the Google Groups
> > "Lift" group.
> > To post to this group, send email to lift...@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.
> >
> >
> >
>
>
> --
> Lift, the simply functional web framework http://liftweb.net
> Beginning Scala http://www.apress.com/book/view/1430219890
> Follow me: http://twitter.com/dpp
> Surf the harmonics

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




Re: [Lift] Re: Can't find the jdbc:mysql driver in Production Mode ?

2009-11-28 Thread David Pollak
Do a println to output the value of Props.get("db.driver")

On Sat, Nov 28, 2009 at 6:06 AM, Neil.Lv  wrote:

>
>  It generated by the archetype lift-archetype-basic.
>
> ##  in the Boot.scala
> 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
>  }
> }
>
> ##
>
>   And this is my default.props (In src\main\resources\props )
>   Only this file in the props folder.
>
> ###
> db.driver=com.mysql.jdbc.Driver
> db.url=jdbc:mysql://localhost:3306/project
> db.user=root
> db.password=root
> ###
>
> Cheers,
>  Neil
>
>
> On Nov 28, 7:57 pm, Timothy Perrett  wrote:
> > Paste your database connection object? its probably that you copied the
> one from lift examples and you are now missing the correct properties
> file...
> >
> > Cheers, Tim
> >
> > On 28 Nov 2009, at 10:26, Neil.Lv wrote:
> >
> > > Hi all,
> >
> > >   I have a silly question about the lift app that deployed on the
> > > Jetty server.
> >
> > >   Can't find the jdbc:mysql driver in Production Mode ? It will use
> > > the derby to instead of the mysql.
> >
> > >  But it works fine in the Development Mode.
> >
> > >  I will craete the derby file in the jetty folder.
> > >  /home/jetty6/derby.log
> > >  /home/jetty6/lift-example
> >
> > >  Thanks for any suggestion!
> >
> > > Cheers,
> > >  Neil
> >
> > > --
> >
> > > You received this message because you are subscribed to the Google
> Groups "Lift" group.
> > > To post to this group, send email to lift...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> liftweb+unsubscr...@googlegroups.com
> .
> > > For more options, visit this group athttp://
> groups.google.com/group/liftweb?hl=en.
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to lift...@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.
>
>
>


-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Surf the harmonics

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




[Lift] Re: Can't find the jdbc:mysql driver in Production Mode ?

2009-11-28 Thread Neil.Lv

  It generated by the archetype lift-archetype-basic.

##  in the Boot.scala
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
  }
}

##

   And this is my default.props (In src\main\resources\props )
   Only this file in the props folder.

###
db.driver=com.mysql.jdbc.Driver
db.url=jdbc:mysql://localhost:3306/project
db.user=root
db.password=root
###

Cheers,
  Neil


On Nov 28, 7:57 pm, Timothy Perrett  wrote:
> Paste your database connection object? its probably that you copied the one 
> from lift examples and you are now missing the correct properties file...
>
> Cheers, Tim
>
> On 28 Nov 2009, at 10:26, Neil.Lv wrote:
>
> > Hi all,
>
> >   I have a silly question about the lift app that deployed on the
> > Jetty server.
>
> >   Can't find the jdbc:mysql driver in Production Mode ? It will use
> > the derby to instead of the mysql.
>
> >  But it works fine in the Development Mode.
>
> >  I will craete the derby file in the jetty folder.
> >  /home/jetty6/derby.log
> >  /home/jetty6/lift-example
>
> >  Thanks for any suggestion!
>
> > Cheers,
> >  Neil
>
> > --
>
> > You received this message because you are subscribed to the Google Groups 
> > "Lift" group.
> > To post to this group, send email to lift...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > liftweb+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/liftweb?hl=en.

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.