Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-users] Request for sample POM for maven to embedded jetty

Dear all

Well first off sorry for such a noob question

 

Currently I am trying to develop an application with embedded jetty /w jsp support [struts2]

I am new to using jetty esp in embedded mode.

 

My pom.xml files is [ slightly modified from struts2-archtype-blank

 

 

    <properties>

        <struts2.version>2.3.24</struts2.version>

        <log4j2.version>2.2</log4j2.version>

        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <jetty-version>9.2.6.v20141205</jetty-version>

    </properties>

 

    <dependencies>

 

        <dependency>

            <groupId>org.apache.struts</groupId>

            <artifactId>struts2-core</artifactId>

            <version>${struts2.version}</version>

        </dependency>

 

        <dependency>

            <groupId>org.apache.struts</groupId>

            <artifactId>struts2-config-browser-plugin</artifactId>

            <version>${struts2.version}</version>

        </dependency>

 

        <dependency>

            <groupId>org.apache.struts</groupId>

            <artifactId>struts2-junit-plugin</artifactId>

            <version>${struts2.version}</version>

            <scope>test</scope>

        </dependency>

 

        <dependency>

            <groupId>org.apache.logging.log4j</groupId>

            <artifactId>log4j-api</artifactId>

            <version>${log4j2.version}</version>

        </dependency>

        <dependency>

            <groupId>org.apache.logging.log4j</groupId>

            <artifactId>log4j-core</artifactId>

            <version>${log4j2.version}</version>

        </dependency>

 

        <dependency>

            <groupId>junit</groupId>

            <artifactId>junit</artifactId>

            <version>4.5</version>

            <scope>test</scope>

        </dependency>

                        <!--  -->

               

                                <dependency>

                                                <groupId>javax.servlet</groupId>

                                                <artifactId>javax.servlet-api</artifactId>

                                                <version>3.1.0</version>

                                                <scope>runtime</scope>

                                </dependency>

                                <dependency>

                                                <groupId>org.eclipse.jetty</groupId>

                                                <artifactId>jetty-annotations</artifactId>

                                                <version>${jetty-version}</version>

                                </dependency>

                                <dependency>

                                                <groupId>org.eclipse.jetty</groupId>

                                                <artifactId>jetty-webapp</artifactId>

                                                <version>${jetty-version}</version>

                                </dependency>

                                <dependency>

                                                <groupId>org.eclipse.jetty</groupId>

                                                <artifactId>apache-jsp</artifactId>

                                                <version>${jetty-version}</version>

                                                <scope>runtime</scope>

                                </dependency>

                                <dependency>

                                                <groupId>org.eclipse.jetty</groupId>

                                                <artifactId>apache-jstl</artifactId>

                                                <version>${jetty-version}</version>

                                                <type>pom</type>

                                                <scope>runtime</scope>

                                </dependency>

    </dependencies>

 

 

Simple java class to start the application

 

 

import org.eclipse.jetty.server.Server;

import org.eclipse.jetty.webapp.WebAppContext;

 

public class WebServer {

      

       public static void main(String[] args) throws Exception

         {

           String webappDirLocation = "src/main/webapp/";

      

           Server server = new Server(8080);

           WebAppContext root = new WebAppContext();

          

           root.setContextPath("/");

           root.setDescriptor(webappDirLocation + "/WEB-INF/web.xml");

           root.setResourceBase(webappDirLocation);

      

           root.setParentLoaderPriority(true);

      

           server.setHandler(root);

      

           server.start();

           server.join();

         }

 

}

 

 

When I start the application I get this error

 

Struts Problem Report

 

Struts has detected an unhandled exception:

 

Messages:         

Unable to compile class for JSP

File:        org/apache/jasper/JspCompilationContext.java

Line number:     530

Stacktraces

 

org.apache.jasper.JasperException: Unable to compile class for JSP

 

initially I was getting jsp not supported error, after trial and error and searching on web, fixed the dependencies to the point its loading strust2 configs but still having issues with jsp

 

if anyone can give me any pointers/tutorials/links/pom.xml it would be greatly appreciated.

 

I just want to use struts2+jetty [jsp+jetty, with minimal configuration ]

 

 

With regards
Prabhu

 


Back to the top