Setting URL with subfolder in Tomcat 9 - java

I have Tomcat 9. I am trying to get the URL lik this: http://default.local:8080/default_war/ but my site is still available only by http://default.local:8080.
The address I am going to set is also generated by Intellij in Run/Configuration so it shoud be possible to set it. Of course I could edit it in Intellij but I wonder how to achieve URL subderictories in Tomcat 9.
What should I change in my code? Here there are my setting files:
$ cat /home/u/opt/tomcat/conf/server.xml
<?xml version="1.0" encoding="UTF-8"?>
<Server port="8005" shutdown="SHUTDOWN">
<Listener className="org.apache.catalina.startup.VersionLoggerListener" />
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
<GlobalNamingResources>
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
pathname="conf/tomcat-users.xml" />
</GlobalNamingResources>
<Service name="Catalina">
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
<Engine name="Catalina" defaultHost="localhost">
<Realm className="org.apache.catalina.realm.LockOutRealm">
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>
</Realm>
<Host name="default.local" appBase="default"
unpackWARs="true" autoDeploy="true">
<Context path="/default_war" />
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log" suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" />
</Host>
</Engine>
</Service>
</Server>
u#i3 ~/opt/tomcat
$ cat conf/Catalina/default.local/ROOT.xml
<?xml version="1.0" encoding="UTF-8"?>
<Context docBase="${catalina.base}/deploy/default_war.war">
</Context>
u#i3 ~/opt/tomcat
$

This is happening because you are using a context file called ROOT.xml.
The ROOT application is the one which is served from the base URL - in your case, http://default.local:8080.
Depending on exactly how you deployed your WAR, you will need to take the following steps:
1 - Stop Tomcat and change the name of the ROOT.xml file to default_war.xml.
The above step means you are no longer using a ROOT-based webapp (see final note below for more on that).
2 - Because you have specified appBase="default" in your server.xml, you may also need to go to that default folder and remove any sub-folders in there, before restating Tomcat.
I would expect there to be a ROOT folder in there, because you have already used a ROOT.xml context file. You don't want that folder, because that will continue to serve your webapp from the base URL.
When you restart Tomcat, you should see a new folder called default_war in the default folder - and that is where your application will be served from - and it should be available only at http://default.local:8080/default_war/.
Background note: In Tomcat, ROOT is something of a special case. When you download and install a fresh installation of Tomcat, you will see a folder called ROOT in the webapps directory. This is where the main Tomcat welcome/congratulations page is served from - and like your ROOT.xml content, it is served from the base URL. You can see some of the possible configurations in the "naming" table shown in this Tomcat documentation page.

Related

tomcat ssl redirect loop

My application use ssl in tomcat, and run fine when I use port 8080, when I access http://localhost:8080, it redirect to https://localhost:8443.
But when I use a non 8080 port (8081,8082, etc) and I access http://localhost:8081 (or http://localhost:8082, etc), it does a infinite redirect loop to http://localhost:8081 (or http://localhost:8082, etc)
here my server.xml with 8080
<?xml version='1.0' encoding='utf-8'?>
<Server port="8005" shutdown="SHUTDOWN">
<!--APR library loader. Documentation at /docs/apr.html -->
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
<!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
<Listener className="org.apache.catalina.core.JasperListener" />
<!-- Prevent memory leaks due to use of particular java/javax APIs-->
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
<!-- JMX Support for the Tomcat server. Documentation at /docs/non-existent.html -->
<Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
<!-- Global JNDI resources
Documentation at /docs/jndi-resources-howto.html
-->
<GlobalNamingResources>
<!-- Editable user database that can also be used by
UserDatabaseRealm to authenticate users
-->
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
pathname="conf/tomcat-users.xml" />
</GlobalNamingResources>
<Service name="Catalina">
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
<Connector SSLEnabled="true" clientAuth="false" keyAlias="key" keystoreFile="webapps/ROOT/META-INF/my.keystore" keystorePass="pass" maxThreads="150" port="8443" protocol="HTTP/1.1" scheme="https" secure="true" sslProtocol="TLS"/>
<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
<Engine name="Catalina" defaultHost="localhost">
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>
<!-- Define the default virtual host
Note: XML Schema validation will not work with Xerces 2.2.
-->
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
</Host>
</Engine>
</Service>
</Server>
and here my server.xml with 8081
<?xml version='1.0' encoding='utf-8'?>
<Server port="8005" shutdown="SHUTDOWN">
<!--APR library loader. Documentation at /docs/apr.html -->
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
<!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
<Listener className="org.apache.catalina.core.JasperListener" />
<!-- Prevent memory leaks due to use of particular java/javax APIs-->
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
<!-- JMX Support for the Tomcat server. Documentation at /docs/non-existent.html -->
<Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
<!-- Global JNDI resources
Documentation at /docs/jndi-resources-howto.html
-->
<GlobalNamingResources>
<!-- Editable user database that can also be used by
UserDatabaseRealm to authenticate users
-->
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
pathname="conf/tomcat-users.xml" />
</GlobalNamingResources>
<Service name="Catalina">
<Connector port="8081" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
<Connector SSLEnabled="true" clientAuth="false" keyAlias="key" keystoreFile="webapps/ROOT/META-INF/my.keystore" keystorePass="pass" maxThreads="150" port="8443" protocol="HTTP/1.1" scheme="https" secure="true" sslProtocol="TLS"/>
<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
<Engine name="Catalina" defaultHost="localhost">
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>
<!-- Define the default virtual host
Note: XML Schema validation will not work with Xerces 2.2.
-->
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
</Host>
</Engine>
</Service>
</Server>
Can anyone help me?
I'm using tomcat 6
Another thing to try is to forcibly enable HTTPS for all the apps, in the default web.xml (it should be in tomcat/conf folder next to server.xml),
by adding the following to it:
<security-constraint>
<web-resource-collection>
<web-resource-name>Protected Context</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
Note: The below applies to the Tomcat instances with ARP enabled (i.e. most Linux-based installations), but as OP is running a windows-based Tomcat, with the ARP connector already disabled (or not available), it does not apply to him.
Not sure on why do you get a redirect loop, but an apparent problem with your configuration is that you have the APR (native) SSL connector enabled, which does not really work with "keystoreFile", so you should be getting error messages like that in your logs:
java.lang.Exception: Connector attribute SSLCertificateFile must be defined when using SSL with APR
and SSL should not function for you at all, regardless of a port number used.
And easiest way to defeat it, is to comment out the APR listener:
<!-- <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" /> -->
to make Tomcat use JSSE connector implementation instead.

Resource URIs not working in Java RESTful web service on tomcat 8 server

I created a RESTful web service using auto generated entity classes with netbeans. I also used maven. I deployed this in tomcat 8 as localhost. I do see the index page, but I cannot access any endpoints. I initially ran this locally on Glassfish server and it worked fine.
I tried test resource uri in netbeans but it says,
Unable to open resource URL : localhost:8080//api/activity
Here is my server.xml file from apache tomcat.
<?xml version="1.0" encoding="UTF-8"?>
--><Server port="8005" shutdown="SHUTDOWN">
<Listener className="org.apache.catalina.startup.VersionLoggerListener"/>
<Listener SSLEngine="on" className="org.apache.catalina.core.AprLifecycleListener"/>
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener"/>
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener"/>
<GlobalNamingResources>
<Resource auth="Container" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" name="UserDatabase" pathname="conf/tomcat-users.xml" type="org.apache.catalina.UserDatabase"/>
</GlobalNamingResources>
<Service name="Catalina">
<Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443"/>
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443"/>
<Engine defaultHost="localhost" name="Catalina">
<Realm className="org.apache.catalina.realm.LockOutRealm">
<Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>
</Realm>
<Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true">
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" pattern="%h %l %u %t "%r" %s %b" prefix="localhost_access_log" suffix=".txt"/>
<Context antiJARLocking="true" docBase="C:\xxx\yyyy\apache-tomcat-8.0.36\apache-tomcat-8.0.36\wtpwebapps\xxDBWithMaven" path="/VoyateDBWithMaven" reloadable="true" source="org.eclipse.jst.jee.server:VoyateDBWithMaven"/></Host>
</Engine>
</Service>
</Server>
Is there anyway I can fix this so the resources can be accessed? It's confusing because the application gets deployed and the index file is displayed.
Unable to open resource URL : localhost:8080//api/activity
You have two slashes between "localhost:8080" and "api/activity". Remove one in the configuration where you specify the path: api/activity instead of /api/activity.

Null createConnection in Tomcat 7 when trying to connect to a Derby Network database

I'm trying to secure Tomcat's manager access using a Derby Network Database. For this purpose I created a Derby Network Database with all the necessary.
Here is my server.xml
<?xml version="1.0" encoding="UTF-8"?>
<Server port="8005" shutdown="SHUTDOWN">
<!-- Security listener. Documentation at /docs/config/listeners.html
<Listener className="org.apache.catalina.security.SecurityListener" />
-->
<!--APR library loader. Documentation at /docs/apr.html -->
<Listener SSLEngine="on" className="org.apache.catalina.core.AprLifecycleListener"/>
<!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
<Listener className="org.apache.catalina.core.JasperListener"/>
<!-- Prevent memory leaks due to use of particular java/javax APIs-->
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener"/>
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener"/>
<GlobalNamingResources>
<Resource auth="Container" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" name="UserDatabase" pathname="conf/tomcat-users.xml" type="org.apache.catalina.UserDatabase"/>
<Resource auth="Container" driverClassName="org.apache.derby.jdbc.ClientDriver" factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory" maxActive="20" maxIdle="10" name="jdbc/***" password="***" readOnly="false" type="javax.sql.DataSource" url="jdbc:derby://localhost:1527//***" username="***" validationQuery="SELECT count(*) FROM users"/>
</GlobalNamingResources>
<Service name="Catalina">
<Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443"/>
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443"/>
<Engine defaultHost="localhost" name="Catalina">
via a brute-force attack -->
<Realm className="org.apache.catalina.realm.DataSourceRealm" dataSourceName="jdbc/***" debug="0" digest="MD5" roleNameCol="ROLENAME" userCredCol="PASSWORD" userNameCol="USERNAME" userRoleTable="***" userTable="USERS"/>
<Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true">
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" pattern="%h %l %u %t "%r" %s %b" prefix="localhost_access_log." suffix=".txt"/>
<Context docBase="***" path="***" reloadable="true" source="org.eclipse.jst.jee.server:tds"/></Host>
</Engine>
</Service>
</Server>
And my context.xml:
<?xml version="1.0" encoding="UTF-8"?>
<Context>
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<ResourceLink global="jdbc/***" name="jdbc/***" type="javax.sql.DataSource"/>
</Context>
derbyclient.jar, derbynet.jar, derby.jar are in $Tomcat directory$/libs
When I initialize tomcat everything seems to be OK but if I try to access to the manager it returns the following error:
ene 26, 2015 4:58:56 PM org.apache.catalina.realm.DataSourceRealm open
SEVERE: Exception performing authentication
java.lang.IllegalStateException: Connection factory returned null from createConnection
at org.apache.tomcat.dbcp.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:584)
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1556)
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1545)
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388)
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
at org.apache.catalina.realm.DataSourceRealm.open(DataSourceRealm.java:388)
at org.apache.catalina.realm.DataSourceRealm.authenticate(DataSourceRealm.java:284)
at org.apache.catalina.authenticator.BasicAuthenticator.authenticate(BasicAuthenticator.java:164)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:573)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
Maybe is something missing? I don't know what I'm doing wrong because I checked a similar config I have in a production server and there is no difference. Obiously the Derby network DB is initialized (I can open it with squirrel)
I'd appreciate any contribution
Edit:
The config was OK but I had an error in the resource URL jdbc:derby://localhost:1527//C:*\derbydb --> jdbc:derby://localhost:1527/C:*\derbydb
Hope my configuration can be useful to someone.

Tomcat response the same every time after initital response

I have a relatively simple spring web application running on tomcat which returns an xml document. The initial request goes in and I can debug into my code. However, subsequent requests do not drop into the debugger. I can make the initial request with either a browser or soapUI, and subsequent requests (on different browsers/programs/machines) get the same response as the initial one.
The localhost_access_log is getting populated with every request. However the log4j file is not getting populated beyond the first request.
I'm using Tomcat 7 and spring 3.1.1. This happens on both the tomcat deployed within eclipse (used to enable debugging), as well as deploying it on another tomcat server on linux.
This is similar to another question (Tomcat gives Same Response ) which never had an accepted answer.
So it doesn't appear to be browser caching (different applications making requests get the same response), but rather some sort of Tomcat caching.
Any ideas? Here is the server.xml which I believe may be the cause of the problem somehow, but I don't see any red flags. Also, I'm doing GETs to the web application, which may be caching somehow on the server side.
Example GET request: http://localhost:8130/bootstrap/xml?environment=dev
It returns a xml document as noted in this RequestMapping:
#RequestMapping(value = "/xml", method = RequestMethod.GET,produces="application/xml")
Sample Response:
<connection_details env="dev">
<servers>
<server host="localhost" name="auth" port="9876"/>
</servers>
</connection_details>
The issue manifests itself as every request returns the same as the initial request, even if the environment variable passed into the GET request changes. This is even if requested from different browsers and soapUI.
Example of how the response above is created:
private ModelAndView bootstrap(HttpServletResponse response, String environment) {
Map<String, Object> model = new HashMap<String, Object>();
try {
DOMSource domSource = new DOMSource(documentBuilder.parse(context
.getResourceAsStream(bootstrapXmlFileName)));
model.put("xml", domSource);
model.put("requestedEnvironment", environment);
}
catch (Exception e) {
response.setHeader("ERRORS", e.getMessage());
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
return null;
}
return new ModelAndView("bootstrap_connection_selector", model);
}
Then it is passed to an xslt transformation:
<bean id="viewResolver"
class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass"
value="org.springframework.web.servlet.view.xslt.XsltView" />
<property name="prefix" value="/WEB-INF/xsl/" />
<property name="suffix" value=".xslt" />
</bean>
Finally the following transformation:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- parameter for the requested location -->
<xsl:param name="requestedlocation"/>
<!-- start template matching on the connection_details element -->
<xsl:template match="/connection_details">
<!-- duplicate the enclosing <connection_details env=xxx" element -->
<xsl:element name="connection_details">
<xsl:attribute name="env">
<xsl:value-of select="#env"/>
</xsl:attribute>
...
<!-- close the <connection_details> element -->
</xsl:element>
</xsl:template>
</xsl:stylesheet>
server.xml:
<?xml version="1.0" encoding="UTF-8"?>
<Server port="8133" shutdown="SHUTDOWN">
<Listener SSLEngine="on" className="org.apache.catalina.core.AprLifecycleListener"/>
<Listener className="org.apache.catalina.core.JasperListener"/>
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener"/>
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener"/>
<GlobalNamingResources>
<Resource auth="Container" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" name="UserDatabase" pathname="conf/tomcat-users.xml" type="org.apache.catalina.UserDatabase"/>
</GlobalNamingResources>
<Service name="Catalina">
<Connector connectionTimeout="20000" port="8130" protocol="HTTP/1.1" redirectPort="8131"/>
<Connector port="8132" protocol="AJP/1.3" redirectPort="8131"/>
<Engine defaultHost="localhost" name="Catalina">
<Realm className="org.apache.catalina.realm.LockOutRealm">
<Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>
</Realm>
<Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true">
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" pattern="%h %l %u %t "%r" %s %b" prefix="localhost_access_log." suffix=".txt"/>
<Context docBase="em_bootstrap" path="/bootstrap" reloadable="true" source="org.eclipse.jst.jee.server:em_bootstrap">
</Context></Host>
</Engine>
</Service>
</Server>
This turned out to be a bad case of not checking the Filters. There was a caching filter applied in the web.xml, probably the only place I didn't check. It was incorrectly using the request.getRequestURI as the key for the cache, when in reality it needed the entire request string to properly place it in the cache.
Thanks

Setting property 'source' to 'org.eclipse.jst.jee.server:GestorContenidoWS' did not find a matching property. Try all the solutions

This is my first post here (but not the first time that I visit the page, I found a lot of solutions here), first of all, sorry for my english I will try to explain myself as best I can.
This question appears another time in this page, but I tried all the solutions that the people post and I still with this problem, well here we go.
I made a project on Eclipse(indigo) for launch like a WebService (I did it before with succes, is not my first time) and when I Run on Server(Tomcat7) all seems fine and the appears this Warning.
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:GestorContenidoWS' did not find a matching property.
Then appear in the Web perspective of Eclipse the page "HTTP 404". I'm telling this because I read in other post that this Warning is not a problem, but seems that it is for me (The project is also vinculated with a JPA Persistence).
.I found two solutions for make dissappear this Warning. First, go to Server Overview and select the option 'Publish module contexts to separate XML files' and then try to Run on server again, but didn't work.
The other option was, remove the project from the server from the Server View. Then run the project under the same server for recreated server.xml, but didn't work also.
Anybody can help me? Maybe the problem of this "HTTP 404 requested resource (/GestorContenidoWS/) is not available." is in another part or its because this Warning?"
The code of my server.xml (without comments) is this:
<?xml version="1.0" encoding="UTF-8"?>
--><Server port="8005" shutdown="SHUTDOWN">
<Listener SSLEngine="on" className="org.apache.catalina.core.AprLifecycleListener"/>
<Listener className="org.apache.catalina.core.JasperListener"/>
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener"/>
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener"/>
<GlobalNamingResources>
<Resource auth="Container" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory"name="UserDatabase" pathname="conf/tomcat-users.xml" type="org.apache.catalina.UserDatabase"/>
</GlobalNamingResources>
<Service name="Catalina">
<Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1"redirectPort="8443"/>
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443"/>
<Engine defaultHost="localhost" name="Catalina">
<Realm className="org.apache.catalina.realm.LockOutRealm">
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"resourceName="UserDatabase"/>
</Realm>
<Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true">
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" pattern="%h %l %u %t "%r" %s %b" prefix="localhost_access_log." suffix=".txt"/>
<Context docBase="GestorContenidoWS" path="/GestorContenidoWS" reloadable="true" source="org.eclipse.jst.jee.server:GestorContenidoWS"/></Host>
</Engine>
</Service>
Thank you
First of all this is a warning and not an error. So there is no need to worry too much about it. Basically it means, that Tomcat does not know what to do with the source attribute from context.
This source attribute is set by Eclipse (or to be more specific the Eclipse Web Tools Platform) to the server.xml file of Tomcat to match the running application to a project in workspace.
Tomcat generates a warning for every unknown markup in the server.xml (i.e. the source attribute) and this is the source of the warning. You can safely ignore it.
This is a warning and can be safely ignored. Tomcat or the Web container does not understand what to do with the property set by Eclipse
set contex-root
<property name="context-root" value="path" />
and http://localhost:8080/path
show your index file
Find server.xml. For example "C:\Dev\apache-tomcat-8.5.23\conf\server.xml"
Find your application in server.xml
<Context docBase="C:\Dev\apache-tomcat-8.5.23\wtpwebapps\SpringRestExample" path="/spring" reloadable="true" source="org.eclipse.jst.jee.server:SpringRestExample"/></Host>
Expected url http://localhost:8080/SpringRestExample/rest/emp/9999
But (path="/spring") instead (path="/SpringRestExample")
Therefore current url http://localhost:8080/spring/rest/emp/9999

Categories