Re: [Jetty-support] Configure Server Classpath in combination with "deploy-war" and "useTestClasspath=true"

Jesse McConnell <[email protected]> Mon, 9 May 2011 09:16:58 -0500
Newsgroups gmane.comp.java.jetty.support
Message-ID <[email protected]>
Think you ought to be able to just add that oracle dependency to the
dependencies of the jetty maven plugin itself in the declaration of
the plugin.

been a while so not sure, I would start there though, if I get a
chance later I'll try and look closer if that doesn't take care of it
for you.

jesse

--
jesse mcconnell
[email protected]



On Mon, May 9, 2011 at 08:37, Chantal Ackermann
<[email protected]> wrote:
> Hello all,
>
> this is my first post to your list! I've been searching for a while,
> now, to find a solution but it seems I'm either looking for the wrong
> keywords or I have a problem that noone else has - so hopefully I'm just
> on the wrong track. If someone could point me to the right direction -
> that would be great!
>
>
> My use case is:
> ---------------
> 1.) Maven Project containing a Client Application to a WebServer
> Application. (No WebServer required for unit testing)
> 2.) Integration testing: configured in that same project (it is a small
> project), the WebServer application should be started, then the Client
> should do some integration tests.
> (Previously, integration tests would expect the server up and running
> but I would like to make this portable.)
>
> I have set this up, and it works except for this last requirement:
>
> My problem:
> -----------
> 3.) Requirement for the Server Application: JNDI DataSource and the
> corresponding libraries on the classpath.
>
>
> The JNDI Resource is set up successfully, but the driver jar is not
> found. Running "mvn integration-test" gets me as far as:
>
> [INFO] [jetty:deploy-war {execution: start-jetty}]
> [INFO] Configuring Jetty for project: Client
> [INFO] Configuring Jetty from xml configuration file
> = /.../XXX_CLIENT/src/test/resources/jetty.xml
> 2011-05-09 14:22:42.645:WARN::Config error at <New id="ConfigDB"
> class="org.eclipse.jetty.plus.jndi.Resource">|??<Arg>jdbc/ConfigDB</Arg>|??<Arg>|???<New class="oracle.jdbc.pool.OracleDataSource">|????<Set name="DriverType">thin</Set>|????<Set name="URL">jdbc:oracle:thin:@XXX:1521:xe</Set>|????<Set name="User">XXX</Set>|????<Set name="Password">XXX</Set>|????<Set name="connectionCachingEnabled">true</Set>|????<Set name="connectionCacheProperties">|?????<New class="java.util.Properties">|??????<Call name="setProperty">|???????<Arg>MinLimit</Arg>|???????<Arg>5</Arg>|??????</Call>|??????|?????</New>|????</Set>|???</New>|??</Arg>|?</New> java.lang.ClassNotFoundException: oracle.jdbc.pool.OracleDataSource
> [INFO]
> ------------------------------------------------------------------------
> [ERROR] BUILD ERROR
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Failure
>
> Embedded error: oracle.jdbc.pool.OracleDataSource
>
>
> I am using jetty-maven-plugin version 7.4.0.v20110414.
> I've tried two ways to configure the classpath:
>
> (A) Add maven dependencies for the drivers (Oracle 10 and 11, both
> installed on an internal repo and working for other maven projects on my
> computer), and set <useTestClasspath>true</useTestClasspath>.
> The dependencies have scope "test" and I would like to keep it at that.
>
>                <dependency>
>                        <groupId>com.oracle</groupId>
>                        <artifactId>ojdbc14</artifactId>
>                        <version>10.2.0.5.0</version>
>                        <type>jar</type>
>                        <scope>test</scope>
>                </dependency>
>
> (B) As this doesn't seem to work for the goal "deploy-war" (it did work
> for me in other circumstances), I tried using the dependency plugin to
> copy the driver artifacts to a subdirectory in the build tree and use
> <testClassesDirectory> or <extraClasspath>.
>
> I've appended the plugin configuration at the end of this e-mail. The
> dependency plugin uses the same properties to copy the driver libraries,
> and I've checked that the jars are indeed present in the expected
> directory.
>
> BTW: Is there a way to output Jetty's classpath?
>
>
> Thanks for your time and help!
> Chantal
>
>
>
> <plugin>
>        <groupId>org.mortbay.jetty</groupId>
>        <artifactId>jetty-maven-plugin</artifactId>
>        <version>7.4.0.v20110414</version>
>        <configuration>
>                <useTestClasspath>true</useTestClasspath>
>
> <!--testClassesDirectory>${integration-test.dependencies.dir}/ojdbc6-11.2.0.2.0.jar:${integration-test.dependencies.dir}/ojdbc14-10.2.0.5.0.jar</testClassesDirectory-->
>                <jettyConfig>${basedir}/src/test/resources/jetty.xml</jettyConfig>
>                <webApp>${integration-test.dependencies.dir}/${server.war}</webApp>
>                <webAppConfig>
>                        <contextPath>${server.context}</contextPath>
>
> <extraClasspath>${integration-test.dependencies.dir}/ojdbc6-11.2.0.2.0.jar:${integration-test.dependencies.dir}/ojdbc14-10.2.0.5.0.jar</extraClasspath>
>                </webAppConfig>
>                <connectors>
>                        <connector
> implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
>                                <port>9090</port>
>                                <maxIdleTime>60000</maxIdleTime>
>                        </connector>
>                </connectors>
>                <stopKey>foo</stopKey>
>                <stopPort>9999</stopPort>
>        </configuration>
>        <executions>
>                <execution>
>                        <id>start-jetty</id>
>                        <phase>pre-integration-test</phase>
>                        <goals>
>                                <goal>deploy-war</goal>
>                        </goals>
>                        <configuration>
>                                <scanintervalseconds>0</scanintervalseconds>
>                                <daemon>true</daemon>
>                        </configuration>
>                </execution>
>                <execution>
>                        <id>stop-jetty</id>
>                        <phase>post-integration-test</phase>
>                        <goals>
>                                <goal>stop</goal>
>                        </goals>
>                </execution>
>        </executions>
> </plugin>
>
>
>
> ------------------------------------------------------------------------------
> WhatsUp Gold - Download Free Network Management Software
> The most intuitive, comprehensive, and cost-effective network
> management toolset available today.  Delivers lowest initial
> acquisition cost and overall TCO of any competing solution.
> http://p.sf.net/sfu/whatsupgold-sd
> _______________________________________________
> Jetty-support mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jetty-support
>

------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
Jetty-support mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jetty-support