context.xml

context.xml vs web.xml in web application

纵饮孤独 提交于 2019-12-18 13:27:17
问题 I am developing a small web application application. The objective is to create one welcome index.html page with Ajax + one servlet to handle ajax requests. Although I thought I would be fine with a web.xml only, I don't want to deploy to / , but to /MyApp . NetBeans's project properties offers options to set a context path, which helps me deploying to /MyApp . However, it automatically adds a /META-INF/context.xml file, which is a bit confusing. My questions are: 1) Do I really need a

Migration to Tomcat 8: InstanceAlreadyExistsException datasource

∥☆過路亽.° 提交于 2019-12-18 12:51:26
问题 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

Moving contents of META-INF/context.xml to tomcat/conf

好久不见. 提交于 2019-12-11 07:35:10
问题 We are trying to take the environment specific configuration settings out of our war files, so we can deploy the same war file to dev/test/prod tomcat servers and not have to change the contents of the war config file. When I move the META-INF/context.xml for the database connection to the conf/server.xml the database connection no longer works, with the following error, anyone know why this would be? server.xml: <GlobalNamingResources> .... <Resource url="jdbc:oracle:thin:@hostname:1521

What are steps followed in the look-up? what is looked first web.xml or context.xml?

寵の児 提交于 2019-12-10 12:35:22
问题 How does a look-up like : Context envContext = (Context)initContext.lookup("java:comp/env"); DataSource ds = (DataSource)envContext.lookup("jdbc/MyDatasource"); proceed ? I mean to say how is the name MyDataSource searched and in the end what is returned ? There are two entries added to connect to the database. One in the WEB-INF/web.xml which is : <resource-ref> <description>my connection</description> <res-ref-name>jdbc/MyDatasource</res-ref-name> <res-type>javax.sql.DataSource</res-type>

How do I add aliases to a Servlet Context in java?

做~自己de王妃 提交于 2019-12-08 01:50:49
问题 I have a servlet running under Tomcat. I need to serve some files, I guess we can call them semi-static (which change occasionally ... they are updated by another part of the app) from an external (to the WEB-APP) directory. I have managed to do this by adding the following to my context.xml in the META-INF directory <Context aliases="/working_dir=c:/apache_tomcat_working_dir" ></Context> This works fine, in my HTML I refer to the file as <img src="/myWebbApp/working_dir/fixpermin_zoom.png">

Set Tomcat Default Context Path

六月ゝ 毕业季﹏ 提交于 2019-12-07 07:13:12
问题 In my context.xml file I set the following to: <Context antiJARLocking="true" path="/" /> When I run my project from NetBeans then it works correctly and goes to http://localhost:8080/login . Then when I clean & build and go into Tomcat Manager and deploy the war file, for some reason it goes to http://localhost:8080/appName/login . I'm not sure why it's adding the context path or where it even gets it from but when ever I deploy it manually it does that. When ever I run the project directly

Deploying a servlet programmatically with Jetty

天涯浪子 提交于 2019-12-06 19:36:51
问题 I've got a servlet that I wish to deploy programmatically using Jetty. The servlet uses Spring and it's web.xml points to the Spring context XML file as you'd expect. At the moment, I'm just trying the example code from the Jetty docs but with my own servlet: Server server = new Server(8080); ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS); context.setContextPath("/"); server.setHandler(context); context.addServlet(new ServletHolder(new BatchReceiver(

How do I add aliases to a Servlet Context in java?

大憨熊 提交于 2019-12-06 13:42:32
I have a servlet running under Tomcat. I need to serve some files, I guess we can call them semi-static (which change occasionally ... they are updated by another part of the app) from an external (to the WEB-APP) directory. I have managed to do this by adding the following to my context.xml in the META-INF directory <Context aliases="/working_dir=c:/apache_tomcat_working_dir" ></Context> This works fine, in my HTML I refer to the file as <img src="/myWebbApp/working_dir/fixpermin_zoom.png"> and in my web.xml inside WEB-INF I let the default server handle png files as follows <!-- use default

where can I find application specific context.xml file?

送分小仙女□ 提交于 2019-12-06 07:28:00
问题 I read that context.xml file (in Tomcat) is application specific. I have created two web projects from my netbeans IDE with Tomcat as the server.But I unable to find the application specific context.xml files. I have only found the context.xml inside the conf directory of Tomcat. Where can I find the application specific context.xml files ? 回答1: I noticed the link in the other answer is for the wrong version of Tomcat. Here is the correct documentation: http://tomcat.apache.org/tomcat-7.0-doc

Loading Bean property values from context.xml

十年热恋 提交于 2019-12-06 05:12:08
问题 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}