Extra dependencies with cargo daemon and ant

10 views
Skip to first unread message

Arnaud MERGEY

unread,
Dec 14, 2018, 2:28:35 PM12/14/18
to Codehaus Cargo
Hello,

I am trying to test an app with cargo daemon through ant, and I am facing an issue with datasources
You will find my ant task definition above.

With this my deployment fails with "not suitable driver" when I try to use jdbc/REPO datasource so my guess is jdbc driver is not found by tomcat.

Tomcat is a 8.5 and I noticed jdbc driver is copied in common/lib of configuration home cargo daemon is started on the the same machine running the ant task so I am not sure this occurs through ant or through cargo daemon.
I am wondering if it is the right place for cargo to copy the jdbc driver as for tomcat 8 libraries common to tomcat and webapps, like jdbc drivers are supposed to be in lib, not common/lib (common/lib was for tomcat 7 if I am right),
but maybe I missed something in my configuration.
How can I configure jdbc driver in tomcat if I want to used it through cargo daemon ?
Thanks,
Arnaud

<target name="tomcat.start">
        <fail message="FILE NOT FOUND: ${project.basedir}/../oracle.jdbc/ojdbc8.jar">
            <condition>
                <not>
                    <resourceexists>
                        <file file="${project.basedir}/../oracle.jdbc/ojdbc8.jar" />
                    </resourceexists>
                </not>
            </condition>
        </fail>
        <echo>Basedir=${project.basedir}</echo>
        <echo>ANT: tomcat.start \n host=${dbcreate.host} \n port=${dbcreate.port} \n dbname=${dbcreate.dbname} \n dloc=${dbcreate.dloc} \n dlocuser=${dbcreate.dlocuser}</echo>
        <echo>
        </echo>
        <cargo containerId="tomcat8x" action="daemon-start" output="${project.basedir}/target/tomcat.log">
            <zipUrlInstaller installUrl="http://repo.maven.apache.org/maven2/org/apache/tomcat/tomcat/${tomcat.version}/tomcat-${tomcat.version}.zip" />

            <extraClasspath>
                <pathelement location="${project.basedir}/../oracle.jdbc/ojdbc8.jar" />
            </extraClasspath>

            <configuration>
                <property name="cargo.logging" value="low" />
                <property name="cargo.servlet.port" value="10080" />
                <property name="cargo.servlet.users" value="${users}" />


                <datasource driverClass="oracle.jdbc.OracleDriver" url="jdbc:oracle:thin:@${dbcreate.host}:${dbcreate.port}:${dbcreate.dbname}" jndiName="jdbc/REPO" username="${dbcreate.repo}" password="${dbcreate.repo}" />
                <datasource driverClass="oracle.jdbc.OracleDriver" url="jdbc:oracle:thin:@${dbcreate.host}:${dbcreate.port}:${dbcreate.dbname}" jndiName="jdbc/${dbcreate.dloc}" username="${dbcreate.dlocuser}" password="${dbcreate.dlocuser}" />

                <deployable type="war" file="${local.war}" />
            </configuration>
            <daemon>
                <property name="cargo.daemon.handleid" value="tomcat8" />
                <property name="cargo.daemon.url" value="http://localhost:18000/" />
            </daemon>
        </cargo>

    </target>

S. Ali Tokmen

unread,
Dec 15, 2018, 9:13:56 AM12/15/18
to codehau...@googlegroups.com

Hi Arnaud

I think you hit a limitation here: the Cargo Daemon doesn't actually send the extra classpath elements over :( That means, the JAR file you're referring to will not be sent to the machine running Codehaus Cargo. I would see three options:

  • Previously copy over the JAR (separately) and then reference the path on the machine running the Cargo Daemon in your ANT build it would work
  • Use ANT to create a ZIP file with Tomcat ans the OJDBC8 JAR on the fly, and then reference it in the ZipUrlInstaller

Apart from these, the functionality to also send the extra classpath to the Cargo Daemon could be interesting as well - Would you like to perhaps create it? The instructions for contributing to Codehaus Cargo are on https://codehaus-cargo.github.io/cargo/Contributing.html

Thank you

S. Ali Tokmen
http://ali.tokmen.com/
http://contact.ali.tokmen.com/
--
You received this message because you are subscribed to the Google Groups "Codehaus Cargo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codehaus-carg...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/codehaus-cargo/b3fb2a55-dee0-4c04-b3fc-af4d301e04ae%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Arnaud MERGEY

unread,
Dec 17, 2018, 4:03:39 AM12/17/18
to Codehaus Cargo

Cago Daemon and the ant build are running on the same machine, so the referenced path is valid also for cago daemon.
Create a zip on the fly with jdbc driver is a good idea, it can be a good workaround. 

I will have a look on it if I can contribute something

Thanks 
Arnaud
                <datasource driverClass="oracle.jdbc.OracleDriver" url="jdbc:ora...@${dbcreate.host}:${dbcreate.port}:${dbcreate.dbname}" jndiName="jdbc/REPO" username="${dbcreate.repo}" password="${dbcreate.repo}" />
                <datasource driverClass="oracle.jdbc.OracleDriver" url="jdbc:ora...@${dbcreate.host}:${dbcreate.port}:${dbcreate.dbname}" jndiName="jdbc/${dbcreate.dloc}" username="${dbcreate.dlocuser}" password="${dbcreate.dlocuser}" />


                <deployable type="war" file="${local.war}" />
            </configuration>
            <daemon>
                <property name="cargo.daemon.handleid" value="tomcat8" />
                <property name="cargo.daemon.url" value="http://localhost:18000/" />
            </daemon>
        </cargo>

    </target>
Reply all
Reply to author
Forward
0 new messages