wtpwebapps/myapp is empty when running Tomcat under Eclipse - java

I know that tomcat is running because when I type http://localhost, the tomcat page dispay. My problem is I can't figure out why the wtpwebapps/myapp is empty, is like the eclipse doesn't publish it and when i type http://localhost/myapp, I get 404 error.
In the server overview :
Server Location is set to "Use Tomcat installation" | server path: the servers's folder | deploy path : wtpwebapps
Server Option : Publish module contexts to separate XML file
Publishing : Automatically publish when ressource change
I use eclipse Ganymede 3.4.2, tomcat 6.0, under Win7
Any help would be appreciated, thanks

your files must be somwhere, so start searching in:
<YOUR_WORKSPACE_DIR>\.metadata\.plugins\org.eclipse.wst.server.core\tmp<SOME_NUMBER>\wtpwebapps

I had a similar problem, when updating our project (.project and .classpath are checked in for convenience, but causes sometimes problems).
Console-Log in eclipse always says:
Error configuring application listener of class org.sth.ThisClass
java.lang.ClassNotFoundException: org.sth.ThisClass
The reason was that $WORKSPACE_DIR/.metadata/.plugins/org.eclipse.wst.server.core/tmp$NUMBER/wtpwebapps/$CONTEXT/WEB-INF/lib/classes was empty. The solution was to enter under Project Properties > Deployment Assembly an entry:
Source: /src
Deploy Path: WEB-INF/classes

If you use a Maven in your project, this is a solution for you:
Delete the project(s) in the Eclipse.
create project from Maven sources (select your workspace directory).
Check found pom.xml to import.
Restart the Tomcat.

Try to look into servers explorer and it will show you what state is your application at and if its deployed.

Since I had difficulty finding where this "server overview" is, I like to add that you just double click on a server under the "servers" view. I kept on right click and look at the "Properties" and was not getting to this information.

Related

Cannot see sources will debugging on local JBoss server

I have a project producing a .war file, I created a local JBoss 7.1 server in eclipse referencing my local JBoss installation. Then I start the local server in debug mode, copy my war file to {JBOSS_HOME}\standalone\deployments, and it deploys it correctly.
But when I add a breakpoint in eclipse, the code stops like it should, but showing me a "Source not found" white page.
How can I link or synchronize the source code to my local server?
Thank you.
Okay so I solved my problem and it seems pretty obvious now that I found it :
My project is generating a projectname.war, and a projectname-sources.jar, I just had to deploy also the projectname-sources.jar...

Why won't basic spring 4 sample run with Eclipse kepler?

I am using the sample project code here that i've downloaded from the following:
http://javahash.com/spring-4-mvc-hello-world-tutorial-full-example/
Direct link here:
http://javahash.com/wp-content/uploads/2014/02/Spring4MVCHelloWorld.zip
I have Eclipse Kepler SR2 (J2EE), Tomcat 7 64-bit, Java 7.
The project does not appear to be a web project, so I add "Dynamic Web Module" version 3.0 and "Java" (version 1.7) to it. I right click, maven install, which appears to run fine. When I try to actually deploy it on tomcat, it does not give any errors in the console, but when the browser window pops up it shows a 404
http://localhost:8080/Spring4MVCHelloWorld/
HTTP Status 404 - /Spring4MVCHelloWorld/
--------------------------------------------------------------------------------
type Status report
message /Spring4MVCHelloWorld/
description The requested resource is not available.
--------------------------------------------------------------------------------
Apache Tomcat/6.0.39
That said, how do I get this "basic" example running in eclipse? Anyone able to get this working successfully? It feels like it should be more trivial than the 5 hours I've spent on trying to get this sample code working to no avail.
UPDATE:
Still continues to fail despite using Tomcat 7.0 server.
Download the sample, extract contents to workspace directory.
"Import Existing Project" in Eclipse
Since there is no "Run On Server" option, I right click on the imported project directory and hit "Properties".
I go to "Project Facets" and check 2 things: "Dynamic Web Module" (3.0) and "Java" (1.7) and hit apply then "Ok".
I right click on the project Spring4MVCHelloWorld and click "Maven"->"Update Project". Then I click "Run On Server".
There are no errors in the console, but the web browser that pops up in eclipse shows a HTTP STATUS 404.
I tried going to:
http://localhost:8080/Spring4MVCHelloWord/hello
and the same:
HTTP Status 404 - /Spring4MVCHelloWorld/hello
shows up, but the tomcat shows up as:
Apache Tomcat/7.0.53
Note that this is the 64-bit version. What steps am I missing? How do I get around this silent failing?
Apart from what Dimitri stated, your log seems to indicate that you are using
Apache Tomcat/6.0.39
That version of Tomcat does not support ServletContainerInitializer which your Spring web application depends on for configuration. Upgrade to a Tomcat version 7+.
It seems like the Maven update doesn't work for you (or for me).
First, go into Properties -> Deployment Assembly. You need to get rid of Web Content if it's there and add src/main/webapp (which is a maven convention). You also need to add the Maven Dependencies as shown below.
Finally, and this might not be necessary, delete the web.xml provided to you and re-create it by selecting and right clicking Deployment Descriptor in the Project Explorer and clicking Generate Deployment Descriptor Stub.
Also, make sure your Java Build Path in the Properties has a Java 7+ version of the JRE.
As far as I can see your controller only maps to /hello, which means your URL should be:
http://localhost:8080/Spring4MVCHelloWorld/hello
Another thing that might be interesting to you is that if your having problems with certain project facets (like Dynamic Web Module) not being recognized, you can usually fix them by righ clicking your project, opening the Maven menu and choosing Update Project.

Glassfish 4 deployment error

I added some libraries to my JavaEE project and then deploy the application works. I modified something and I got this error message in Eclipse:
Cannot Deploy ProjectName
deploy is failing=Error occurred during deployment: Keys cannot be duplicate.
Old value of this key property, nullwill be retained.
Please see server.log for more details.
java.lang.LinkageError: loader (instance of
org/glassfish/web/loader/WebappClassLoader):
attempted duplicate class definition for name:
"org/glassfish/web/loader/JdbcLeakPrevention"
loader (instance of org/glassfish/web/loader/WebappClassLoader): attempted duplicate
class definition for name: "org/glassfish/web/loader/JdbcLeakPrevention"
I made some research and I found out that it is not an Eclipse bug. I'm working with Kepler but I tested with Juno too. Got the same error message.
I downloaded Glassfish 3.1.2.2 and the message gone.
Why am I getting this message?
I Had the same error. I stopped the GLassfish server and then I cleaned the project (Project -> Clean... ). Started the server and worked
I also had this issue, and I was also using the SVNKit library plus its dependencies so it looks like there is some kind of conflict there. I can get around it by cleaning out the osgi-cache folder & restarting glassfish, but I have to do this every time I want to deploy, so not a great solution.
Try to remove all the files under osgi-cache and generated directories. It worked for me.
In my Glassfish log file it says:
Application with name ws is already registered. Either specify that redeployment must be forced, or redeploy the application. Or if this is a new deployment, pick a different name
Following my logs instructions I deployed the app with --force option:
asadmin deploy --force=true ws.war
and it worked. More info on deploy --force=true
Try to clean autodeploy directory, restart the server.
Also clean the project deployment directory.
following steps worked for me.
stop the glassfish server(if running)
kill all the java process (using terminal or activity monitor)
now try redeploy.
Was somehow related to a single #Singleton bean. Converted it to #Stateless and everything worked fine. Not quite sure why this happened...

Running dynamic web projects on Eclipse brings up a 404 error in Tomcat 7

I'm not entirely sure why this happens.
Right now I'm able to build the project without running into any issues, and it deploys to the eclipse tomcat server that I have running
So with that kept in mind, the index here is hera.jsp, which I have set in my web.xml file:
to make matters worse it seems like no matter what I try I always get this same error message:
All I can think to include to make this more complete before posting is my build path and the server settings, so here's those as well.
I had similar problem. First of all:
Check if all the sources are copied to tomcat7 webapps, especially hera/WEB-INF/web.xml.
If its not there, try to create dummy folder in your project, e.g. "hera/fix", and in your
"project properties->deployment assembly" add this folder (as a result, "hera/fix -> /" mapping should be created). This worked for me when the eclipse plugin didn't want to copy web.xml.
Check in "project properties->deployment assembly" if all needed libraries are there, if not, add them.
Check why you have problems in src in your eclipse project, as that may interrupt or conflict the dynamic project deployment from eclipse.
Hope it helps.

Webapp shows 404 page after project renaming

I have been working on this web application using Eclipse and m2e (maven plugin for Eclipse).
After a while I decide to change the project name in eclipse doing: Right click on project >> refactor >> rename
Following this I see a few errors coming up, mostly to do with classpath configuration & java versions mismatch. I fix them, adding the maven dependencies to the build path, and updating the java versions to be used during compilation & run time.
I rebuild my web app & restart my server (Tomcat in this case). Open my browser to go to my app's root url. And I get a 404 page (everything looks fine in the console btw).
I've been going through my buildpath and classpath config to double check if anything was coming from there but everything seems fine. I'm confused and unsure where to look at.
Thanks in advance
This really depends on your Setup. If you are using the default path, it is (as Kal said) myserver/newappname.
If you are using a url that you have configured in webserver for easier readability like (myapp.myserver.com) you would have to change the redirection in your server from your old appname to the new one.
Actually,
404 HTTP standard response code indicating that the client was able to communicate with the server, but the server could not find what was requested.
1. Check your path with newapplication name.
2. See inside your server, Is there a resource with (newNameApp.war)?
3. As you are using maven, try to build the project and see the log, by which name war is generated, and where the war got placed.
I faced the same situation and simply restarted Eclipse and no more 404 afterward

Categories

Resources