context.xml

Loading Bean property values from context.xml

不羁岁月 提交于 2019-12-04 10:21:16
Currently we are loading our JDBC source values from properties file as per following: <context:property-placeholder location="classpath:master.properties" ignore-unresolvable="true" /> <bean id="mainDataSource" class="com.jolbox.bonecp.BoneCPDataSource" destroy-method="close"> <property name="driverClass" value="${database.driver}" /> <property name="jdbcUrl" value="${database.url}" /> <property name="username" value="${database.user}" /> <property name="password" value="${database.password}" /> <property name="idleConnectionTestPeriod" value="60" /> <property name="idleMaxAge" value="240" />

How to store string values in context.xml

时光总嘲笑我的痴心妄想 提交于 2019-12-03 08:31:50
问题 I'd like to store connection URLs in a JNDI binding for my Tomcat application. Since Tomcat uses context.xml for JNDI resource defining, I need to figure out the propert way to store a String (or multiple strings for multiple connections) in context.xml . My reason for doing this is so that I can define different strings for different environments, and load them through JNDI. Usually, I see entries like so: <Context ...> <Resource name="someName" auth="Container" type=

Understanding context.xml in tomcat 6

社会主义新天地 提交于 2019-12-03 08:30:42
I created a mainly empty dynamic web project in eclipse. It has no servlets no jsp files The web.xml is <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> <display-name>testprojekt</display-name> <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> <welcome-file

Migration to Tomcat 8: InstanceAlreadyExistsException datasource

时光怂恿深爱的人放手 提交于 2019-12-03 04:34:20
I have a question about context config in Tomcat 8. I migrating project from Tomcat 7 to 8 and have unusual problem: if nothing change in config I caught an error: "2015-02-03 12:05:48,310 FIRST_ADMIN ERROR web.context.ContextLoader:331 -> Context initialization failed org.springframework.jmx.export.UnableToRegisterMBeanException: Unable to register MBean [org.apache.tomcat.dbcp.dbcp2.BasicDataSource@434990dd] with key 'dataSource'; nested exception is javax.management.InstanceAlreadyExistsException: Catalina:type=DataSource,host=localhost,context=/first- admin,class=javax.sql.DataSource,name=

How to store string values in context.xml

a 夏天 提交于 2019-12-02 22:21:31
I'd like to store connection URLs in a JNDI binding for my Tomcat application. Since Tomcat uses context.xml for JNDI resource defining, I need to figure out the propert way to store a String (or multiple strings for multiple connections) in context.xml . My reason for doing this is so that I can define different strings for different environments, and load them through JNDI. Usually, I see entries like so: <Context ...> <Resource name="someName" auth="Container" type="someFullyQualifiedClassName" description="Some description."/> </Context> Is it really just as simple as: <Context ...>

How to get resource from the context.xml file in tomcat webapp?

泄露秘密 提交于 2019-12-02 17:43:17
This is my context.xml file: ... <Resource auth="Container" driverClass="net.sourceforge.jtds.jdbc.Driver" type="com.jolbox.bonecp.BoneCPDataSource" idleMaxAge="240" idleConnectionTestPeriod="60" partitionCount="3" acquireIncrement="1" maxConnectionsPerPartition="10" minConnectionsPerPartition="3" statementsCacheSize="50" releaseHelperThreads="4" name="jdbc/MyDatasource" username="my_username" password="my_password" factory="org.apache.naming.factory.BeanFactory" jdbcUrl="jdbc:jtds:sqlserver://localhost:12345/my_database" /> ... I already tried using ServletContext.getResource(java.lang.String

Tomcat: Custom form authenicator in a web application, not as a stand-alone JAR module. Possible?

浪子不回头ぞ 提交于 2019-12-02 04:08:35
Our web application requires custom form authentication with specific logic inside. The current form authenticator implementation requires the authenticator module, let's call it custom.auth.jar , to be present in %CATALINA_HOME%/lib before the web application starts. The web application uses that custom authenticator module using the following context.xml directive: <Valve className="foo.bar.CustomAuth" characterEncoding="UTF-8"/> As far as I understand Tomcat requirements, this module, custom.auth.jar , must be present in Tomcat's lib directory before the web application starts, because the

Creating a custom tomcat session manager without putting the jar in the CATALINA_HOME directory?

↘锁芯ラ 提交于 2019-12-01 22:43:40
I am working on a custom session manager for Tomcat and I got it working with one caveat, I have to put the jar(and all the associated jars) in the CATALINA_HOME/lib directory or I get a noclassdef found exception, even though the classes are in the WEB-INF/lib directory. Is there any way to force tomcat to look in the web apps lib directory when it is loading a session manager? Putting it in the lib directory is error-prone(as you have to remember to copy the jar over when upgrading and/or installing on a new system) and makes development of the jar more difficult. As of Tomcat 7.0.27, the

Is it possible to use placeholder in context.xml

老子叫甜甜 提交于 2019-12-01 06:57:36
I'm using Spring and struts and have the following entry in '/META-INF/context.xml' <Context cachingAllowed="false" useHttpOnly="true"> <Resource name="jdbc/xxx" auth="Container" type="javax.sql.DataSource" factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory" maxActive="100" maxIdle="30" maxWait="10000" username="xxxxx" password="xxxxx" driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver" url="jdbc:sqlserver://xxx:1433;databaseName=xxx;"/> </Context> Is it possible to implement in the following way, <Context cachingAllowed="false" useHttpOnly="true"> <Resource name="jdbc/xxx"

Is it possible to use placeholder in context.xml

感情迁移 提交于 2019-12-01 05:33:59
问题 I'm using Spring and struts and have the following entry in '/META-INF/context.xml' <Context cachingAllowed="false" useHttpOnly="true"> <Resource name="jdbc/xxx" auth="Container" type="javax.sql.DataSource" factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory" maxActive="100" maxIdle="30" maxWait="10000" username="xxxxx" password="xxxxx" driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver" url="jdbc:sqlserver://xxx:1433;databaseName=xxx;"/> </Context> Is it possible to