You are here: Foswiki>Service Web>JDNITomcat (15 May 2019, SebastianMueller)Edit Attach
Tomcat Maven Plugin

Works with tomcat 7,8,9

mvn tomcat7:deploy

mvn tomcat7:undeploy

<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.1</version>
<configuration>
<url>http://localhost:8080/manager/text</url>
<server>TomcatServer</server>
<path>/acosv-data-service</path> --
<username>tomcat</username>
<password>tomcat</password>
</configuration>
</plugin>

JNDI Config for embedded Tomcat (local installed Tomcat):

Context.xml

<Resource
name="jdbc/fesa" -- look down for java bean.setJndiName("java:comp/env/jdbc/fesa");
auth="Container"
type="javax.sql.DataSource"
maxTotal="2"
maxIdle="30"
driverClassName="oracle.jdbc.OracleDriver"
url="jdbc:oracle:thin:@(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST =dbla0a.acc.gsi.de)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = dbla0b.acc.gsi.de)(PORT = 1521))(LOAD_BALANCE = yes) (CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = AccDbT.acc.gsi.de) (FAILOVER_MODE =(TYPE = SELECT)(METHOD = BASIC)(RETRIES = 180)(DELAY = 5))))"
username="schema"
password="password"
/>

Java:

DataSource fesaDbDataSource() throws NamingException {
final JndiObjectFactoryBean bean = new JndiObjectFactoryBean ();
bean.setJndiName("java:comp/env/jdbc/fesa");
bean.setProxyInterface(DataSource.class);
bean.setLookupOnStartup(false);
bean.afterPropertiesSet();
return (DataSource) bean.getObject();
}

-- SebastianMueller - 15 May 2019
Topic revision: r1 - 15 May 2019, SebastianMueller
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback