How is the Tomcat temp directory location defined? - eclipse

I am running Tomcat bundled with Liferay5.2.3 and use Eclipse 3.5 (Galileo) as my IDE. I set up my Tomcat server in Eclipse as per this blog entry: http://www.jroller.com/holy/entry/developing_portlets_for_liferay_in. If I start Tomcat via the Eclipse server config, Liferay/Tomcat uses my C:\Documents and Settings\user\Local Settings\Temp\ directory. However, if I start Tomcat directly using the startup.bat script, Liferay/Tomcat uses the Tomcat temp directory. I can't figure out if Eclipse, Liferay or Tomcat is deciding which temp directory to use or how to change it. I would prefer to use the Tomcat temp directory.
I have this issue with both the Lifera/Tomcat bundles 5.5 and 6.0 (liferay-portal-tomcat-6.0-5.2.3.zip and liferay-portal-tomcat-5.5-5.2.3.zip).
Anybody have any clues?

When you start Tomcat with catalina.sh (or catalina.bat), the temp directory is set with the CATALINA_TMPDIR variable:
if [ -z "$CATALINA_TMPDIR" ] ; then
# Define the java.io.tmpdir to use for Catalina
CATALINA_TMPDIR="$CATALINA_BASE"/temp
fi
Also you can pass below as VM argument while starting Tomcat in Eclipse to use it as temp directory.
-Djava.io.tmpdir="C:\Program Files\liferay-portal-5.2.3-tomcat-6.0\tomcat-6.0.18\temp"

Although I still don't know where/how Tomcat determines where the default temp directory should be, nor do I know why Eclipse sets it to something different, I have found out that you can set the temp directory via a VM argument when starting Tomcat in Eclipse:
-Djava.io.tmpdir="C:\Program Files\liferay-portal-5.2.3-tomcat-6.0\tomcat-6.0.18\temp"

You can find the following folder structure in your workspace:
.metadata.plugins\org.eclipse.wst.server.core\tmp0\
Here you will find the folder which is attached with tomcat in eclipse.

Related

web app file spec mismatch between Eclipse project and Eclipse-generated .war

I am developing a web app in Eclipse for deployment to a Tomcat server. Currenly, it works fine when I launch it from within Eclipse, using a Tomcat installation on the localhost. But when I export a .war file and install it on a remote server, it fails because of a mismatch between the file system in Eclipse and the file system in the .war file.
When Eclipse created the Java EE project for me, it created the following directory structure:
app
src
WebContent
I put all of my Java source files---servlets and classes---in the src directory, and all of the Web files---.jsp, .html, and various .xml resources---in WebContent.
So that my app could use the .xml resources, I put them all in a WebContent subdirectory named, not coincidentally, resources.
I then defined a variable pointing to these files...
path_to_resources = "WebContent" + pathMrkr + "resources" + pathMrkr;
// where pathMrkr = System.getProperty("file.separator")
...in each class that needs to access the .xml files.
This works well when I run the app from within Eclipse. But when I export and deploy the app if fails. The .war file Eclipse creates does not include a WebContent folder, so the search for resources fails, and the app crashes, shutting down Tomcat in the process.
So, I guess I'm looking for some advice on how best to structure Eclipse or my app so that a single code base works both in Eclipse on the localhost and from a .war file on a remote server, with a minimum of fuss and fidgeting with build configurations or having to manually edit the .war file.
While I don't think it's pertinent, for the record my system is:
Eclipse Luna, on a Windows 10 localhost, with Tomcat 8 and Java 8. The remote server running in the cloud is a CentOS 5.5 system running Tomcat 7 and Java 8.
Thanks.
Jerry

ATG-JBoss project in eclipse

I have created a sample ATG project in eclipse. This is the way I followed.
File->New->Project-> ...atg wizards->New ATG Module
Next->put project name as MyFirstATGApp and select ed root diretory as C:\ATG\ATG10.1.2
Next->Default atg adaptive senario engine is selected.
Next->Next-> changed "Default output folder" value as " MyFirstATGApp /classes"
Next->set J2EE application Name= MyFirstATGApp-j2ee, Web application name= MyFirstATGApp-web, Context-root= MyFirstATGApp and selected Target Applicaton Server=Jboss
Then Finish.
From command prompt from C:\ATG\ATG10.1.2 \home\bin I tried executing startDynamoOnJBOSS -f MyFirstATGApp
I am getting following error.Also I didn’t find a startDynamoOnJBOSS inside the bin. Why is this happening??
I am new to ATG.Can I have any link with step-by-step ATG-Jboss-Eclipse project available?
startDynamoOnJBOSS is no longer available in the ATG 10.2 bin.
To start your server, just create your EAR using runAssembler inside the deploy folder for your JBOSS server and call
run.bat -c <ServerName>
If you didn't find the startDynamoOnJBOSS then there is some problem with your installation of jboss or atg.
but still you can run your project you just need to create ear of your project and paste it in your server deploy folder and start jboss.
For Detail You can read ATG Platform Programming Guide
startDynamoOnJBOSS is no longer exists in ATG version 10. Before running your project you need to deploy your project in deploy folder of default or your created server instance using runAssembler
cd C:\ATG\ATG10.1.2\home\bin
runAssembler C:\jboss-eap-5.1.2\jboss-as\server\default\deploy\MyFirstATGApp.ear -m MyFirstATGApp
Then run that server instance where ear file of your project is deployed
cd C:\jboss-eap-5.1.2\jboss-as\bin
run -c default

Tomcat webapps directory in windows

I am right now using eclipse to develop a simple web application and I am using Tomcat as web server. I have configured Tomcat in Eclipse and my application runs fine.
My question is: where does Tomcat store the web app and in which folder does it store the classes? I wanted to check the JSP to servlet conversion and wanted to verify how that converted file looks like and I am trying to find where exactly Tomcat stores the web app. I went into the webapps folder where Tomcat was extracted but my webapp is not in that folder.
Can someone tell where I can find the converted JSPs?
right-click on the web project and select Run As then Run Configurations...
From the Arguments tab, the tomcat deploy path is provided as a VM argument with the name -Dwtp.deploy
Found out the location.
Double clicked on tomcat server inside eclipse and got the server path. something like this ..
C:\EclipseWorkspace.metadata.plugins\org.eclipse.wst.server.core\tmp0
The location of the web app will be in the .metadata folder inside eclipse workspace (chk server path) and the converted jsp files can be found in location as given below.
serverpath\work\Catalina\localhost\loginApp\org\apache\jsp
#Admins ... This question can be closed or what ever action needs to be taken.
Thanks.

tomcat do not unpack war file

i stopped tomcat
paste myapp.war into webapps folder.
start tomcat
call in browser
http://localhost:8080/myapp/index.jsf
see 404
also tomcat does not generate log files under logs directory.
I am using eclipse to start and stop tomcat, and my tomcat 7 is an unzipped version.
to be sure that my war file runs on server, i remove same project from tomcat in eclipse servers view.
repeating question, but i think my situation is a little different, tomcat does not generate logs.
a note: i generate war file by right click in eclipse-> export war file.
thanks for any idea.
If you are launching tomcat from within Eclipse (using the webtools tomcat server adapter) you will have to make sure you have changed the settings to use the installation directory to launch instead of the default which uses a separate location for loading and deploying webapps. So if you add a war directly into the webapps folder, the server launched from Eclipse server adapter wont have that directly setup in the server.xml configuration.
So you should use the startup.bat/startup.sh in the tomcat/bin folder. If you do, you need to make sure that you don't just copy the .war file into the webapps, but rather unzip the war file into a directory folder called "myapp"

Can someone explain what GlassFish does with deployed directories

I have an exploded directory that I am editing in eclipse (created via setting location to directory location when creating New Project, deployed directory already existed). When I deploy this directory from the command line, it does not seem to save it locally (anywhere within glassfish\domain_
If I create a Java EE application in eclipse from scratch and deploy it from Eclipse Run -> on server, it copies it to glassfish\domains\domain1\eclipseapps
Is there a way to have GlassFish save deployed directories locally without using the GlassFish plugin magic?
Short Answer: No.
The whole point of directory deployment is speed and development convenience.
You tell GlassFish to not copy any files at all but to, instead, use the files already laid out on disk.
If you want to run from a copy of your app then just deploy the archive (war/rar/ear/jar) file.