AWS Linux configuring mysql with tomcat7 -
i've installed tomcat 7 , mysql 5.5 on aws linux micro instance. i'm trying figure out how configure tomcat 7 communicate mysql, have had no luck. i've been glassfish user, pretty simple through gui, tomcat, i'm not sure how configure this.
i've looked @ apache documentation on tomcat 7, found myself more confused. not know files need edit , not know edit them with. need install mysql driver? use jdbc or jndi? app tapestry5 app uses hibernate, i'm not sure if matters.
does know of nice guide or provide me example code on how this? record, have couple hours behind wheel of linux, i'm green when comes linux related.
update
i found following default configuration
<!-- <resource name="userdatabase" auth="container" type="org.apache.catalina.userdatabase" description="user database can updated , saved" factory="org.apache.catalina.users.memoryuserdatabasefactory" pathname="conf/tomcat-users.xml" /> -->
i'm using hibernate , in hibernate.cfg.xml i'm using following
<hibernate-configuration> <session-factory> <property name="hibernate.connection.datasource">jdbc/mydatabase</property>
i commented out above resource , added following, doesn't seem work. noticed no longer have access tomcat manager either.
<resource type="javax.sql.datasource" name="jdbc/mydatabase" factory="org.apache.tomcat.jdbc.pool.datasourcefactory" driverclassname="com.mysql.jdbc.driver" url="jdbc:mysql://localhost:3306/mysql" username="root" password="password" />
i added following context.xml file
<resourcelink type="javax.sql.datasource" name="jdbc/mydatabase" global="jdbc/mydatabase"
does know i'm doing wrong configuration?
i'm getting following exception
root cause
http status 500 - java.lang.runtimeexception: exception constructing service 'valueencodersource': error invoking service
contribution method org.apache.tapestry5.hibernate.hibernatemodule.contributevalueencodersource(mappedconfiguration, boolean, hibernatesessionsource, session, typecoercer, propertyaccess, loggersource): exception constructing service 'hibernatesessionsource': error invoking constructor public org.apache.tapestry5.internal.hibernate.hibernatesessionsourceimpl(org.slf4j.logger,java.util.list): not find datasource
javax.naming.namenotfoundexception: name [jdbc/mydatabase] not bound in context. unable find [jdbc].
i have configured tomcat 6 using jndi, dont remember exact configuration settings, 1 thing sure need use jndi.
Comments
Post a Comment