Context path in Tomcat vs Context path in Glassfish - linux

I generated a war file for my app in windows - glassfish, and I'm trying to deploy this war in Tomcat on linux server. The deploy goes fine and it works too but when I bring in Apache as a proxy for Tomcat, somehow the 'context' is not getting set properly. Is it because in Glassfish context is stored in sun-web.xml but in Tomcat its diff ?
How can I fix this ?

Related

service <tomcat8> start fails to start service without any error in servlet.log

I upgraded Apache tomcat from 7.x to 8.5.29 recently. tomcat is deployed inside my application. I have /etc/init.d script which starts tomcat (off course along with some of my project specific other services as well).
Command: service start was working fine till I was on tomcat 7 and then after upgrade to tomcat 8.5.29 this command stopped working. There are no changes in /etc/init.d script at all. Just matter of tomcat upgrade only. Servlet.log is not showing any error but if I compare servlet.log of tomcat 7 and tomcat 8.5.29 then I can figure out that my application is not loading. As such there are no errors in servlet.log of tomcat 8.
Whereas all things works prefectly fine if I use /etc/init.d/<myapp -tomcat8> start.
I'll really appreciate if I can get any help from you all guys.
So after 2-3 days of struggle, I found solution to my own question. Someone may find useful.
I switched on debug mode of apache tomcat 7 (I am using log4j2 and already it was configured) and apache tomcat 8 on two different system and compared working log of apache tomcat 7 with non-working log of apache tomcat 8. I found that tomcat8 is scanning many extra and irrelevant things.
I updated context.xml, located in Tomcat's /conf directory as follow and that worked for me.
<JarScanner scanClassPath="false"/>
Please note following :
Placing above in app specific context.xml didn't worked for me.
Updating catalina.properties file with tomcat.util.scan.StandardJarScanFilter.jarsToSkip=\*.jar was also not working for me.
After doing changes I was facing error : java.lang.IllegalStateException: No output folder but that was due to wrong permission/ownership of tomcat folder.

Not able to start broad leaf app with tomcat 8.5

I am trying to deploy broad leaf app into tomcat 8.5.
I have created admin.war and deployed into tomcat 8.5 and started tomcat. In catalina.out, i have seen that admin.war deployed.
Logs are in catalina.out
13-Feb-2017 19:39:16.978 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive /opt/smusic-aio/apache-tomcat-8.5.8/webapps/admin.war has finished in 304 ms
serviceInfos:[TServiceInfo(serviceName:Catalina/localhost/admin and tomcat server started.
I tried to open admin page with http://localhost:8080/admin/, i got 404 error.
I am able to access http://localhost:8080.
Did i miss anything here? or do i need to change any configuration.
I'd guess that you have both wars deployed to the same application context (/), were as we always deploy to / for the site war and /admin for the admin war.
Checkout this screenshot for an example of how I setup the Admin war in IntelliJ.

Tomcat not recognizing WAR file with specific name

I have tomcat 7.0.12 installed under RHEL 6.3, but it was removed by mistake using remove command form terminal (Tomcat was up and running), after few days I had to deploy another WAR with the same name, what I did is stopped tomcat cleared cache and installed the new WAR, but when Tomcat manager was opened there is no trace to the new WAR (note if I changed the name form MyWAR to myWAR for example I can start it but the name MyWAR is not recognized), please advise.

Webapp Logback Logging Does Not Work Using Tomee Plus 1.6.0 on Linux

I am able to get logback logging to work correctly on my development environment (Windows) using Tomee 1.6.0.1; however, whenever I try to deploy the webapp on my Tomee server on Linux, it never creates the "test.app.log" file specified in the logback.xml configuration file inside of the WEB-INF/classes directory of the webapp.
Using maven, I have included logback-classic-1.1.2 and logback-core-1.1.2 in the WEB-INF/lib directory of the webapp.
I double check permissions for the directory to which I wish to write (CATALINA_BASE/logs), but it is set to rw for all users so I doubt that is the problem.
No matter what I try, all of my logs keep getting pushed to catalina.out. Can anybody solve the mystery as to why logging with logback works correctly on Windows (development environment) but not Linux?
It turns out that we were separating our EJB's into another directory and adding that directory as a "Deployment dir" in tomee.xml. This unhooks the webapp independent logging.
Romain, from Tomee fame, suggested I use either VirtualWebappLoader or jars.txt implementations.

Can't deploy Tomcat webapp in Netbeans 6.8

When trying to deploy an Tomcat application in Netbeans I get the following message:
FAIL - Deployed application at context path /Webapp but context failed to start
/some/dir/Webapp/nbproject/build-impl.xml:593: The module has not been deployed.
Looking at catalina.out I found this:
SEVERE: Error starting static Resources
java.lang.IllegalArgumentException: Document base /some/dir/Webapp/build/web does not exist or is not a readable directory
at org.apache.naming.resources.FileDirContext.setDocBase(FileDirContext.java:142)
at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4086)
(...)
But I can do cd /some/dir/Webapp/build/web without a problem!
So far:
The deployed(?) application appears
listed on Tomcat's manager, but I
can't start it.
Tried to remove Webapp.xml in /usr/share/tomcat6/conf/Catalina/localhost, but the problem persists.
/usr/share/tomcat6/work/Catalina/localhost/Webapp is empty.
I'm using Tomcat 6, Netbeans 6.8, Ubuntu 10.04.
Edit:
I have no trouble deploying the application using Tomcat's manager.
Tomcat was running under tomcat6 user. Doing su tomcat6 I can't cd /some/dir/Webapp/build/web (permission denied).
So finally I had to change permissions, allowing tomcat user to access the directory.
I'm guessing that you're looking at some permission issues. Tomcat is probably trying to deploy that app directly from it's location on your disk. See what user id tomcat is running under with: ps -aux | grep -i tomcat then su <user id> to that user and see if you can get to the application's directory.
Also you can see if the app will deploy via Tomcat's manager app, which is usually found here: http://localhost:8080/manager/html

Resources