Sorry, It's a stupid mistake. I change jetty version from 6.0.0beta17 to 6.1.14, and every thing goes smoothly. But as Szemere said, add [scope] parameter into jetty-env.xml is not working.
Allex J. Allex Juang 提到: > Hi, Tapestry Infodea, > > Thanks for your detail description. > But as I tried on my setup: > > jetty-env.xml > <?xml version="1.0" encoding="UTF-8" ?> > <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" > "http://jetty.mortbay.org/configure.dtd"> > <Configure class="org.mortbay.jetty.webapp.WebAppContext"> > <Set name="contextPath">/aaa</Set> > <New id="XXX" class="org.mortbay.jetty.plus.naming.Resource"> > <Arg></Arg> > <Arg>jdbc/XXX</Arg> > <Arg> > <New class="org.postgresql.ds.PGSimpleDataSource"> > <Set name="DatabaseName">XXX</Set> > <Set name="ServerName">localhost</Set> > <Set name="PortNumber">5432</Set> > <Set name="User">xxx</Set> > <Set name="Password">zzz</Set> > </New> > </Arg> > </New> > </Configure> > > and using jetty:run, I only got following messages: > INFO] [jetty6:run] > [INFO] Configuring Jetty for project: aaa > [INFO] Webapp source directory = ... > [INFO] web.xml file = ... > [INFO] Using JSP2.1 for jdk1.5 runtime > :INFO: Logging to STDERR via org.mortbay.log.StdErrLog > [INFO] Context path = /aaa > [INFO] Tmp directory = D:\work:INFO: jetty 6.0.0beta17 > > [INFO] Web defaults = jetty default > [INFO] Webapp directory = ... > [INFO] Starting jetty 6.0.0beta17 ... > [INFO] Classpath =... :WARN: Config error at <New id="XXX" > class="org.mortbay.jetty.plus.naming.Resource"><Arg/><Arg>jdbc/XXX</Arg><Arg> > <New class="org.postgresql.ds.PGSimpleDataSource"><Set > name="DatabaseName">xxx</Set><Set name="ServerName">localhost</Set><Set > name="PortNumber">5432</Set><Set name="User">xxx</Set><Set > name="Password">zzz</Set></New> > </Arg></New> > :WARN: failed contexthand...@1dccedd{/aaa} > :WARN: failed contexthandlercollect...@738d08 > :WARN: failed handlercollect...@302e67 > :INFO: Started SelectChannelConnector @ 0.0.0.0:8080 > :WARN: failed ser...@2f729e > [INFO] Jetty server exiting. > > It seems there is something wrong in my jetty-env.xml. > But I don't know why, does anyone know what's wrong with that??? > > Allex J. > > Tapestry Infodea 提到: > >> Sorry, maybe I mistakenly assumed that you had configured correctly the >> datasource for jetty: >> >> this is my configuration: >> >> WEB.INF/jetty-env.xml >> >> >> <?xml version="1.0"?> >> <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" >> "http://jetty.mortbay.org/configure.dtd"> >> <Configure class="org.mortbay.jetty.webapp.WebAppContext"> >> <New id="medis" class="org.mortbay.jetty.plus.naming.Resource"> >> <Arg>jdbc/mydb</Arg> >> <Arg> >> <New class="org.apache.commons.dbcp.BasicDataSource"> >> <Set >> name="driverClassName">com.mysql.jdbc.Driver</Set> >> <Set >> name="url">jdbc:mysql://localhost:3306/mydb</Set> >> <Set name="username">test</Set> >> <Set name="password">test</Set> >> </New> >> </Arg> >> </New> >> </Configure> >> >> >> hibernate.cfg.xml >> >> <hibernate-configuration> >> <session-factory> >> <property >> name="hibernate.connection.datasource">java:comp/env/jdbc/medis</property> >> <property >> name="hibernate.transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property> >> <property >> name="hibernate.current_session_context_class">thread</property> >> <property name="hibernate.generate_statistics">false</property> >> <property >> name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property> >> >> <!-- Disable second-level cache. --> >> <property >> name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property> >> <property name="cache.use_query_cache">false</property> >> <property name="cache.use_minimal_puts">false</property> >> <property name="max_fetch_depth">3</property> >> >> <!-- Print SQL to stdout. --> >> <property name="show_sql">false</property> >> <property name="format_sql">false</property> >> >> <!-- Update schema on SessionFactory build--> >> <property name="hbm2ddl.auto">update</property> >> </session-factory> >> </hibernate-configuration> >> >> Tapestry Infodea ha scritto: >> >> >>> In Run --> Run configurations...I've created a new Maven Build >>> configuration adding the following goals: >>> org.mortbay.jetty:maven-jetty-plugin:6.1.14:run >>> >>> Allex Juang ha scritto: >>> >>> >>>> maven eclipse plugin?? >>>> You mean m2eclipse, or anything else? >>>> Since I didn't find any option about using DataSource in m2eclipse >>>> >>>> Allex J. >>>> >>>> Tapestry Infodea 提到: >>>> >>>> >>>>> I had the same problem and I solved using the maven eclipse plugin to >>>>> run Jetty >>>>> >>>>> Allex Juang ha scritto: >>>>> >>>>> >>>>> >>>>>> Hi, >>>>>> >>>>>> Sorry for offtopic. >>>>>> But I am writing my own website using T5+hibernate. >>>>>> And when I using eclipse 3.4 with m2eclipse, jetty can be launched very >>>>>> well. >>>>>> But here I got a problem using DataSource in jetty. >>>>>> >>>>>> In my webapp, I always using JNDI: jdbc/DS to access my datasource. >>>>>> With tomcat, I know how to add DataSource to it, but not in jetty. >>>>>> >>>>>> Can anyone give me a hint about it?? >>>>>> Thanks in advance >>>>>> >>>>>> Allex J. >>>>>> >>>>>> >>>>>> --------------------------------------------------------------------- >>>>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >>>>>> For additional commands, e-mail: users-h...@tapestry.apache.org >>>>>> >>>>>> >>>>>> >>>>>> >>>>> --------------------------------------------------------------------- >>>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >>>>> For additional commands, e-mail: users-h...@tapestry.apache.org >>>>> >>>>> >>>>> >>>>> >>>>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >>> For additional commands, e-mail: users-h...@tapestry.apache.org >>> >>> >>> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >> For additional commands, e-mail: users-h...@tapestry.apache.org >> >> >> >> > > >