Struts 2 Beginner asking for help

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Struts 2 Beginner asking for help

Akku
Hello there!

I am new to struts2, jsp, servlets and all this java web technology. I was hoping to find some help here. I deployed a simple struts2 application. I get this exception:



HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException
        org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:515)
        org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419)

note The full stack trace of the root cause is available in the Apache Tomcat/6.0.16 logs.
-->
Servlet.service() for servlet default threw exception
javax.servlet.ServletException
        at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:515)
        at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
        at java.lang.Thread.run(Unknown Source)

.

I'm pretty sure my web.xml and struts.xml are correctly set up as the error began after creating an object with this line:

                OntModel ontmodel = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM, null);

(from Jena).

Does anybody see my noob mistake? Something about servlets perhaps, that I might have not seen? If you need additional info please let me know.

Greetings, Akku
Reply | Threaded
Open this post in threaded view
|

Re: Struts 2 Beginner asking for help

vinodkashyap
Administrator
Hi
You must try this link hope this will help for u

http://javachamp.blogspot.com/2008/07/struts-2-hello-world-example.html
Reply | Threaded
Open this post in threaded view
|

Re: Struts 2 Beginner asking for help

Akku
Hi there!

V K Kashyap wrote
Hi
You must try this link hope this will help for u

http://javachamp.blogspot.com/2008/07/struts-2-hello-world-example.html

I wasn't searching for a HelloWorld application, as this already works. I think my error is somehow linked to the servlet-thingy ... does an object that is created inside an action need to be handled somehow else?

I use the execute()-method of an action to let a static method construct an object and want to print out a string from it, and in an offline application this works fine, therefore the error has to lie in struts or servlets somehow. The code from the action looks like this:

import com.opensymphony.xwork2.ActionSupport;

public class Greet extends ActionSupport {

private String message =null;

public String execute() {
System.out.println("Hello my fabulous world!");
MyController x = MyControllerFactory.produce("mystring"); // <-- error here
setMessage(x.test());
return "success";
}

public String getMessage() {
            return message;
}

public void setMessage(String message) {
            this.message = message;
}



Shown error on website:

HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException
        org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:515)
        org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.16 logs.

Eclipse-Console:

22.07.2008 17:04:34 com.opensymphony.xwork2.validator.ActionValidatorManagerFactory <clinit>
INFO: Detected AnnotationActionValidatorManager, initializing it...
Hello my fabulous world!
22.07.2008 17:04:38 org.apache.catalina.core.StandardWrapperValve invoke
SCHWERWIEGEND: Servlet.service() for servlet default threw exception
javax.servlet.ServletException
        at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:515)
        at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
        at java.lang.Thread.run(Unknown Source)
Reply | Threaded
Open this post in threaded view
|

Re: Struts 2 Beginner asking for help

dynamicd
make sure u have all the required jar files.
Reply | Threaded
Open this post in threaded view
|

Re: Struts 2 Beginner asking for help

Akku
The error was indeed that one of the included jars needed another jar that I didn't include in the project.