Hello World Struts 2 Eclipse project 404 error - eclipse

I've created a struts2 project with eclipse, when executing it shows the message error:
HTTP Status 404 - /StrutsHelloWorld/Login.jsp
type Status report
message /StrutsHelloWorld/Login.jsp
description The requested resource (/StrutsHelloWorld/Login.jsp) is not available.
Apache Tomcat/7.0.26
I've followed step by step guide http://viralpatel.net/blogs/tutorial-create-struts-2-application-eclipse-example/
and i got that message error.
Please anybody help me!
This is the directory structure. URL: localhost:8080/StrutsHelloWorld/Login.jsp

try to add the following jars into aweb-inf/lib folder and BuildPath
commons-fileupload-x.y.z.jar
commons-io-x.y.z.jar
commons-lang-x.y.jar
commons-logging-x.y.z.jar
commons-logging-api-x.y.jar
freemarker-x.y.z.jar
javassist-.xy.z.GA
ognl-x.y.z.jar
struts2-core-x.y.z.jar
xwork-core.x.y.z.jar

From the given url, there is full project available for download. And never forget to include struts2 libraries in WEB-INF/lib. It works for me.

I also followed the tutorial, what was missing (for me) is that I have to add the struts libraries to the deployment assembly (project->properties->'Deployment Assembly')
I have configured a user library as Struts2 that contains all struts2 jars, I have included this entry to be deployed to web-inf/lib. Take a look to the console error.

Related

404 JSP file not found Dynamic Web Module imported project

I imported a project from sample codes from a book https://github.com/pauldeck/springmvc-2ed/tree/master/chapter-02/eclipse/appdesign1 into Eclipse.
I convert the project to Dynamic Web Module by right click project>properties>project facets>convert to facets form. However, when I run as run on server on Tomcat 8.5, I got HTTP Status 404 – Not Found.
enter image description here
Why my controller is already working but I cannot find the resource jsp in my webapp?
As the Tomcat server returns message JSP is not found, the url is successfully dispatched by the controller. Have you checked if your jsp files are deployed when run on server?
enter image description here
make sure you have included all your resources under deployment assembly configuration.

GWT and Gradle build - the war file doesn't contain html page and WEB-INF dir also empty

I am working on a GWT application and want to use Gradle as a build tool.
Went thorough with various post on internet but none of them is really complete.
I followed couple of blogs as given below:
https://blog.eveoh.nl/2012/01/using-google-web-toolkit-with-gradle/
and
https://examples.javacodegeeks.com/core-java/gradle/gradle-gwt-integration-example/
I downloaded the example from these blogs but still not working.
War file doesn't contain html host page and also WEB-INF folder comes empty in war.
When I try to hit the URL generated by gradle build, I am not able to see any html page there hence getting not found message.
I was trying to run sample given in second link.
Could anyone please help me to give complete example of GWT with Gradle?
Example which create proper war file.
That will be great help!
You can try GWT Gradle Plugin which have a lot of examples and documentation.
By the way, this is the first result in Google for "gradle gwt"...

Getting java.lang.NoClassDefFoundError: org/apache/ws/commons/schema/utils/NamespacePrefixList on creating the web service in eclipse

I am trying to create a web service using axis2.
I have created it.
I am following the below steps for getting the wsdl info.
Right click Project -> Run on server -> Next.
No class found error is coming. Is any jar file is required.
Please guide me how to resolve this.
Error: java.lang.NoClassDefFoundError: org/apache/ws/commons/schema/utils/NamespaceMap at org.apache.axis2.deployment.util.Utils.fillAxisService(Utils.java:437) at org.apache.axis2.deployment.ServiceBuilder.populateService(ServiceBuilder.java:396) at org.apache.axis2.deployment.repository.util.ArchiveReader.buildServiceGroup(ArchiveReader.java:109) at org.apache.axis2.deployment.repository.util.ArchiveReader.processServiceGroup(ArchiveReader.java:232) at org.apache.axis2.deployment.ServiceDeployer.deploy(ServiceDeployer.java:154) at
You can download and include the XmlSchema jar in the lib folder of your dynamic web project /WebContent/WEB_INF folder.
But, this will only solve the problem temporarily. On creating WS client the XMLSchema jar will not get included. So check the compatibility of the version of your server with axis2 version (like Tomcat 6 created problem with axis2 1.7 but works fine with axis2 1.5.2).
On successful compatibility the XMLSchema jar will get included in the respective folder automatically.
You can correct your issue by referencing the XmlSchema jar in the lib folder. You can find the latest version of the jar file in the link below.
http://www.java2s.com/Code/Jar/x/DownloadXmlSchema142jar.htm

Requested factory com.ctc.wstx.stax.WstxOutputFactory cannot be located

I am trying to generate webservice client using axix2 on Eclipse
so I followed the tutorial here.
but at the last step when clicking finish, I am getting the error:
Exception occurred during code generation for WSDL : javax.xml.stream.FactoryConfigurationError: Requested factory com.ctc.wstx.stax.WstxOutputFactory cannot be located. Classloader =org.eclipse.osgi.internal.framework.ContextFinder#2de030
So I downloaded wstx-asl-4.0.0.jar and added it to the build path of the project, but still keep getting same error.
How can I fix this issue?
I ve got the same issue but:
I place the jar in WEB-INF/lib , check that it is also in build path
and restart eclipse
Without restarting eclipse I was stucked like you.
Hope that help

Apache tomcat 7 No error with localhost page, But when run project: show HTTP Status 404

I know there are many questions about Apache tomcat 404 error: but I think mine is different.
I am using windows 7 64 bit
unzipped eclipse-jee-juno-SR2-win32-x86_64 to C:\
unzipped apache-tomcat-7.0.37-windows-x64
changed port server.xml to 3030 instead of 8080
continue with this steps "Quick Start" from point (2)
I didn't forget:
copying ROOT folder
R-click tomcat node in eclipse Servers tab -> properties -> Switch location
Double click tomcat node in Project explorer and check use tomcat instillation (takes control of tomcat installation)
The page:http://localhost:3030/ works fine. It shows the message If you're seeing this, you've successfully installed Tomcat. Congratulations!
But when I tried simple project (I followed basic tutorial) and use Run as -> Run on Server the page of error 404 is shown. When back to http://localhost:3030/ it shows no error.
No error with http://localhost:3030/
Error when running a project!
HTTP Status 404 - /SimpleProject/
type Status report
message /SimpleProject/
description The requested resource is not available.
Apache Tomcat/7.0.37
I am The author of this question, and I solved it. I will provide the solution so that others can get help from it.
As I followed this installation steps carefully, then the installation is correct.
The only problem that caused the error is in the web.xml:
- When create a new "Dynamic Web Project" (As my case)
- Take care of this file: WebContent -> WEB-INF -> web.xml
- The <welcome-file> </welcome-file> tags must refer to exist files to display in the browser.
- If there are some default tags delete them.
- when you create for example a new HTML file named index.html, then make sure that the web.xml file refers to it. <welcome-file>index.html</welcome-file>
Digression (irrelevant to the solution above)
I am actually working on NetBeans extensively doing simple Java Standard Edition projects. I rarely encountered problems with NetBeans, and when they occur I can solve them easily either myself or by searching for information about the problem.
When I began learning the Java Entrprise Edition, and see tutorial on NetBeans, I started my first project from the first day.
But I found most of the tutorials use Eclipse and that was the reason why I installed it.
When I moved to Eclipse. I encountered many problems, and each problem take many hours to search and solve. that takes three days before starting one project.
I am wondering why people prefer Eclipse over NetBeans. I think there is some reason. (^_^)