Solved

tomcat issues while doing hot/real time deployment vs manual deployment

Posted on 2013-11-12
7
1,671 Views
Last Modified: 2013-11-20
Hi,

When I do below steps command prompt
1.  env
2.  mvn eclipse:eclipse
3.  mvn clean install
4. go to the target folder of the imported maven project within eclipse workspace and copy the generated project folder
5. paste in the C:\sftwr\apache-tomcat-6.0.37-windows-x64\apache-tomcat-6.0.37\webapps
6. go to bin by entering 'cd C:\sftwr\apache-tomcat-6.0.37-windows-x64\apache-tomcat-6.0.37' and click startup.bat
7. then go to the URL everything works perfect. UI comes and all good stuff.

But problem with above manual deployment is i cannot debug the code real time.


Now switching to other hot/real time approach steps

 in the eclipse
1. click on the project and "Run As---Maven Clean"
2. and then click on the project and "Run As---Maven Build(goal as compile)"
3. and then click on the project and "Run As---Maven install"
4. and then click on the project and "Run As---run on server(tomcat 6 server)

I do not know where it is putting the latest war file. how do i know whether latest war is picking latest code or not.

I am getting all kinds of errors with spring, maven, hibernate, not found web.xml etc.

I want to make sure my latest code is properly getting deployed in the hot/real time deployment.(also want to make sure to clean all the junk in that folder before rerunning the application on server)


 when i try real time/hot deployment i am experiencing all kinds of issues.


please advise
Any links resources ideas highly appreciated. Thanks in advance
0
Comment
Question by:gudii9
  • 4
  • 3
7 Comments
 
LVL 35

Expert Comment

by:mccarl
Comment Utility
I'm not 100% sure what is the question here.. Is it "where is you code deployed to when running on the server started by Eclipse" ?

If so, then yeah, it is a little bit hidden, but you should be able to follow this to locate it...

Start from your Eclipse workspace folder (wherever that may be), and then follow...

.metadata\.plugins\org.eclipse.wst.server.core

In that folder you will find one (or more) folders called "tmp" and then followed by a number. Each of these represents server objects within your Eclipse IDE. If you only have one than great, just open up that folder otherwise either just poke around until you find the right one, or you can open up "tmp-data.xml" in that folder and it will give you the mapping between the server name in Eclipse and the correct "tmp?" folder.

Now inside this tmp? folder, you will find a number of folders, if you look in wtpwebapps you should see the folder the Eclipse has deployed your application into.
0
 
LVL 7

Author Comment

by:gudii9
Comment Utility
2. mvn eclipse:eclipse
3.  mvn clean instal


what is the purpose and difference of above two steps.
1.  env
I do above step  in the beginning by going to some specific folder in my local machine command prompt like
cd C:\xyz\lmn\aaHome then type env then enter then i get message saying "environment has been set" not sure what that step either means. Please advise
0
 
LVL 7

Author Comment

by:gudii9
Comment Utility
i see under workpace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\ROOT\WEB-INF

there is web.xml. can i delete this file.

when i open that file it is empty file and nothing in it like below
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd" version="2.5">
</web-app>

Open in new window



what this ROOT folder is used for.

I keep getting error as below

Nov 12, 2013 12:29:07 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:abc-def-web-app' did not find a matching property.
Nov 12, 2013 12:29:07 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Nov 12, 2013 12:29:07 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 359 ms
Nov 12, 2013 12:29:07 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Nov 12, 2013 12:29:07 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.37
Nov 12, 2013 12:29:09 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class com.sun.faces.config.ConfigureListener
com.sun.faces.config.ConfigurationException: no web.xml present
at com.sun.faces.config.ConfigureListener$WebXmlProcessor.scanForFacesServlet(ConfigureListener.java:822)
at com.sun.faces.config.ConfigureListener$WebXmlProcessor.<init>(ConfigureListener.java:782)
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:180)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4206)
I already deleted maven web application named 'abc-def-web-app'  from
workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps
(workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps looks corresponds to other tomcat 7 instance i have on my laptop which i am not interested right now as i did not deploy there but deployed on tomcat 6 i.e going to tmp0)

now after this clean up when i redeploy the application and hit the URL getting errors as below

INFO: Starting Servlet Engine: Apache Tomcat/6.0.37
Nov 13, 2013 3:57:23 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Error configuring application listener of class org.springframework.web.context.ContextLoaderListener
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)




SEVERE: Error configuring application listener of class org.springframework.web.context.request.RequestContextListener
java.lang.ClassNotFoundException: org.springframework.web.context.request.RequestContextListener
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)

Open in new window


couple of days back everything  working perfect not sure which got messed up later on.

when i deploy on tomcat7 instead of tomcat6 i see latest folder being updated under
workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps
with 'abc-def-web-app' with current timestamp but
when i hit the url
http://localhost:8080/abc-def-web-app/
i see error as below
HTTP Status 404 - /abc-def-web-app/

--------------------------------------------------------------------------------

type Status report

message /caf-dif-web-app/

description The requested resource is not available.

please advise
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 35

Expert Comment

by:mccarl
Comment Utility
2. mvn eclipse:eclipse
3.  mvn clean install
The first one, generates the Eclipse project files to align it with the maven configuration. The second one, first deletes any previous compiled/generated files, and then recompiles your code, packages as a jar/war/etc and then installs that packaged file into the local maven repository (if the default lifecycle hasn't been changed in the pom.xml)

"environment has been set" not sure what that step either means
I don't know either, this is something particular to your local setup. But I am guessing that env is actually a batch file "env.bat" in that directory that you mention, and so you can open up that file to see what it is actually doing.

there is web.xml. can i delete this file.
If it is empty then, yeah, probably. But this wouldn't be the cause of any of your errors, so I would just leave it alone if I were you.

what this ROOT folder is used for.
The ROOT folder in webapps (or wtpwebapps) supplies all the content that isn't in a specific webapp. For example, your web-app is named "abc-def-web-app" and so you access it via something like http://localhost:8080/abc-def-web-app/..... but if you had a file, say index.jsp, in the ROOT folder, you could access it via http://localhost:8080/index.jsp   (note that there is nothing between the host:port part and the filename part. That is what the ROOT is for.... But again, this won't be having any impact on why you have errors, so I would not focus on this.


The first error that you posted above, I am not sure about because the error has to do with JSF and I haven't used that.

The second error that you are getting (the ClassNotFoundExceptions) looks as though it is due to the spring library jars not being present. For some reason, maybe Eclipse is not deploying them properly, but just from this it is hard to work out why.

The last error (the 404) could be so many things, and since I have no idea about what your webapp is, I can't help here. All I can say, is that for this URL to work as is, you would either need to have a Controller mapped to the "/" resource, or else a correctly configured "welcome-file-list" section in your web.xml that listed a resource that is present in your webapp.
0
 
LVL 7

Author Comment

by:gudii9
Comment Utility
2. mvn eclipse:eclipse
3.  mvn clean install

why we need to execute those commands on the command prompt by going to the 'maven imported source code location(lets say going to --->cd C:\Users\aaaaa\Desktop\aafolder\subverersion_aaaaaaaa) rather than at going to workspace location -->cd C:\Users\eclipse_workspace_aaaaaa).

Please advise
0
 
LVL 7

Author Comment

by:gudii9
Comment Utility
But I am guessing that env is actually a batch file "env.bat" in that directory that you mention, and so you can open up that file to see what it is actually doing.

you are right. I opened and it is batch file where they are setting
JAVA_HOME, M2_HOME, PATH  by referring to one other properties file which has info like java.home and localhostname, server ip address etc.

I wonder what is the need of additional property file again. Please advise
0
 
LVL 35

Accepted Solution

by:
mccarl earned 500 total points
Comment Utility
why we need to execute those commands on the command prompt by going to the 'maven imported source code location(lets say going to --->cd C:\Users\aaaaa\Desktop\aafolder\subverersion_aaaaaaaa) rather than at going to workspace location -->cd C:\Users\eclipse_workspace_aaaaaa).
It's not normally done, but you can "import" projects where the source files are located outside of the workspace folder. There should be an option when you import, to copy the source files into your workspace folder, but it isn't a requirement that they be there. I think this is what has happened here. You have imported the project from that first location, but NOT selected to copy the files into your workspace and so they stay in that first location. This shouldn't be a problem for anything though.

I wonder what is the need of additional property file again. Please advise
As I mentioned, this use of a env.bat file is something that I have not heard about before, so I can't really answer as to why they have an additional properties file. You would have to ask the person that set that up.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now