Hi,
i have installed BLC version 3.0 demo site following the tutorials first with jetty/HSQLDB and then I moved to jetty/Mysql. This works fine.
Now I want to replace jetty by Tomcat 7. I have changed the site/pom.xml by adding
<plugin>
<!-- for Tomcat 7, change to tomcat7-maven-plugin -->
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.1</version>
<configuration>
<path>/mycompany</path>
<warSourceDirectory>${webappDirectory}</warSourceDirectory>
<port>8080</port>
</configuration>
</plugin>
then I have changed the site/build.xml by adding
<target name="tomcat-demo" depends="start-db">
<delete dir="war/WEB-INF/lib"/>
<artifact:mvn mavenHome="${maven.home}" fork="true" jvmargs="-DbroadleafCoreDirectory=${broadleafCoreDirectory} -DbroadleafWorkspaceDirectory=${broadleafWorkspaceDirectory} -XX:MaxPermSize=256M -Xmx512M">
<arg value="compile"/>
<arg value="war:exploded"/>
<arg value="tomcat7:run-war"/>
</artifact:mvn>
</target>
Compile works well but on startup of Tomcat server I get the following error:
[artifact:mvn] INFO: Starting Servlet Engine: Apache Tomcat/7.0.37
[artifact:mvn] Nov 08, 2013 12:06:48 PM org.apache.naming.NamingContext lookup
[artifact:mvn] WARNING: Unexpected exception resolving reference
[artifact:mvn] java.sql.SQLException: ${database.driver}
[artifact:mvn] at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:254)
[artifact:mvn] at org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:182)
[artifact:mvn] at org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:699)
....
....
[artifact:mvn] Caused by: java.lang.ClassNotFoundException: ${database.driver}
[artifact:mvn] at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1713)
[artifact:mvn] at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1558)
[artifact:mvn] at java.lang.Class.forName0(Native Method)
[artifact:mvn] at java.lang.Class.forName(Class.java:270)
[artifact:mvn] at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:246)
[artifact:mvn] ... 28 more
I'am wondering how Tomcat should find the MysqlDB as the relevant information is in placed in jetty-env.xml as suggested by the tutorial.
I have tried to add a WEB-INF/context.xml file for Tomcat and i have referenced the resources in web.xml like this:
context.xml
<Context>
<Resource name="jdbc/web" auth="Container" type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000"
username="abc" password="" driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/broadleaf"/>
<Resource name="jdbc/secure" auth="Container" type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000"
username="abc" password="" driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/broadleaf"/>
<Resource name="jdbc/storage" auth="Container" type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000"
username="abc" password="" driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/broadleaf"/>
</Context>
and added to web.xml
<resource-ref>
<description>Shop DB Connection</description>
<res-ref-name>jdbc/web</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<resource-ref>
<description>Payment Connection</description>
<res-ref-name>jdbc/secure</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<resource-ref>
<description>CMS Connection</description>
<res-ref-name>jdbc/storage</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
But this had no effect at all. So I guess I' am missing some additional configuration but what ?
Thank you for help
This forum is in readonly mode and serves as an archive of old information. All posting, registration and commenting abilities have been turned off. To get help, the Broadleaf team reguarly monitors the broadleaf-commerce tag on Stack Overflow so please ask your questions there.