# Aufruf eines Servlets auf einer JSP Seite funktioniert nicht



## andyx1975 (7. Jan 2013)

Hallo,

ich habe ein Problem mit einer JSP Seite. Ich bin zurzeit dabei eine Website mit JSP, EclipseLink und Servlets zu basteln. Ich habe jetzt das Problem, dass wenn ich die JSP über den Link "http://127.0.0.1:8888/news.jsp" aufrufe, bekomme ich den Wert NULL zurück geliefert. Wenn ich das Servlet über den Browser aufrufe mit dem Link "http://127.0.0.1:8888/websiteNews" funktioniert es. Weiß jemand wo mein Problem liegt? Das Servlet funktioniert ja wohl offensichtlich. Mache ich beim Aufruf in der JSP was falsch?

Meine web.xml beinhaltet folgendes:
[XML]
<servlet>
     	<servlet-name>NewsForWebsite</servlet-name>
     	<servlet-class>com.uds.webadmin.server.CServletWebsiteNews</servlet-class>
	</servlet>
	<servlet-mapping>
     	<servlet-name>NewsForWebsite</servlet-name>
     	<url-pattern>/websiteNews</url-pattern>
	</servlet-mapping>	
[/XML]

Das Servlet sieht wie folgt aus:

```
package com.uds.webadmin.server;

import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import javax.persistence.PersistenceContext;
import javax.persistence.PersistenceContextType;
import javax.persistence.Query;

import com.uds.webadmin.data.DNews;
import com.uds.webadmin.data.DSettings;
import com.uds.webadmin.data.DUpload;

import javax.servlet.*;

import javax.servlet.http.*;

public class CServletWebsiteNews
    extends HttpServlet
{
    @PersistenceContext( unitName = "persistance", type = PersistenceContextType.TRANSACTION )
    private static String PERSISTENCE_UNIT_NAME = "LSF-5434"; // Name of the persistance unit which will be chosen
    private static EntityManagerFactory factory = Persistence.createEntityManagerFactory( PERSISTENCE_UNIT_NAME );

    public void doGet( HttpServletRequest request, HttpServletResponse response )

        throws ServletException, IOException
    {
        response.setContentType( "text/html" );
        PrintWriter out = response.getWriter();
        String newsItem = "";
        File file = null;

        // Search for a central upload path
        CRestSettings prop = new CRestSettings();
        DSettings settings = prop.getAllSettings();
        String path = settings.getUploadPath();
        if ( path.equals( "" ) )
        {
            // gets the file name / path
            file = new File( DUpload.class.getResource( "/" ).getPath() );
            file = file.getParentFile();
            file = file.getParentFile();
            file =
                new File( file.getAbsoluteFile() + System.getProperty( "file.separator" ) + "uploads"
                    + System.getProperty( "file.separator" ) );
        }
        else
        {
            file =
                new File( path + System.getProperty( "file.separator" ) + "uploads"
                    + System.getProperty( "file.separator" ) );
        }

        try
        {
            EntityManager em = factory.createEntityManager();
            Query query = em.createQuery( "SELECT e FROM DNews e ORDER BY e.news_id DESC" );
            List<DNews> news = query.getResultList();
            em.close();

            for ( int i = 0; i < news.size(); i++ )
            {

                String picture = "";
                DUpload upload = news.get( i ).getPicture();
                if ( upload != null )
                {
                    picture = file.getName() + "/" + upload.getUpload_link();
                }
                String headline = news.get( i ).getNews_headline();
                String text = news.get( i ).getTxt();

                newsItem =
                    newsItem + "<article>" + "<img src=\" " + picture + "\" alt=\"\" class=\"thumb\" /> "
                        + "<p><a href=\"#\" class=\"title\">" + headline + "</a></p><p class=\"story\">" + text
                        + "</p>" + "</article>";
            }

        }
        catch ( Exception e )
        {

            System.out.println( "Exception is ;" + e );

        }

        request.setAttribute( "news", newsItem );

        // Disptching request
        RequestDispatcher dispatcher = request.getRequestDispatcher( "news.jsp" );

        if ( dispatcher != null )
        {
            dispatcher.forward( request, response );
        }

    }

}
```

Die JSP sieht wie folgt aus:

```
<!doctype html>
<%@page language="java" import="java.util.*" %>
<html lang="en">
<head>
	<meta charset="utf-8" />
	<title>Endless Roads</title>
	<link rel="stylesheet" href="styles.css" type="text/css" media="screen" />
	<link rel="stylesheet" type="text/css" href="print.css" media="print" />
	<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script> 
	<script type="text/javascript" src="js/simpletabs.js"></script> 
	<!--[if IE]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
</head>
<body>
<div id="wrapper"><!-- #wrapper -->

	<header><!-- header -->
		<h1><a href="#">XXXXXXX</a></h1> <!-- main title on the left side-->
		<h2>XXXXXXXXX</h2> <!-- subtitle on the right side -->
		<img src="images/headerPicture.jpg" width="940" height="200" alt=""><!-- header image -->
	</header><!-- end of header -->
	
	<nav><!-- top nav -->
		<div class="menu">
			<ul>
    			<li><a href="contact.jsp">Contact</a></li>
    			<li><a href="about.jsp">About Us</a></li>
    			<li><a href="bands.jsp">Bands</a></li>
    			<li><a href="tours.jsp">Tours</a></li>
    			<li><a href="news.jsp">News</a></li>
			</ul>
		</div>
	</nav><!-- end of top nav -->
	
	<section id="main"><!-- #main content and sidebar area -->
			<section id="content"><!-- #content -->
				
				
				<!--article class="featured">
					<img src="images/newspic.jpg" alt="" class="featuredthumb" />
					<p><a href="#" class="featuredtitle">This is the featured article</a></p><p class="featuredstory">Pellentesque ut sapien arcu, egestas mollis massa. Fusce lectus leo, fringilla at aliquet sit amet, volutpat non erat. Aenean molestie nibh vitae turpis venenatis vel accumsan nunc tincidunt. Pellentesque ut sapien arcu, egestas mollis massa. Fusce lectus leo, fringilla at aliquet sit amet, volutpat non erat. Aenean molestie nibh vitae turpis venenatis vel accumsan nunc tincidunt. Pellentesque ut sapien arcu, egestas mollis massa. Fusce lectus leo, fringilla at aliquet.</p>
				</article>
				
				

				<article>
					<img src="images/newspic1.jpg" alt="" class="thumb" />
					<p><a href="#" class="title">This is the title of a news article</a></p><p class="story">Pellentesque ut sapien arcu, egestas mollis massa. Fusce lectus leo, fringilla at aliquet sit amet, volutpat non erat. Aenean molestie nibh vitae turpis venenatis vel accumsan nunc tincidunt. Pellentesque ut sapien arcu, egestas mollis massa.</p>
				</article-->
				
				
				<!-- AUFRUF DES SERVLETS -->
				<%
					out.print(request.getAttribute("news"));
				%>

			</section><!-- end of #content -->

		<aside id="sidebar"><!-- sidebar -->

			<div class="tabwidget"> 
  	  <ul class="tabs"> 
  	      <li><a href="#tab1">Recent</a></li> 
  	      <li><a href="#tab2">Popular</a></li>
  	      <li><a href="#tab3">About Me</a></li>
  	  </ul> 
  	  <div class="tab_container"> 
  	      <div id="tab1" class="tab_content"> 
  	          <h3>Recent Articles</h3> 
  	          <ul>
  	          	<li><a href="#">Interesting Recent Link 1</a></li>
			<li><a href="#">Interesting Recent Link 2</a></li>
			<li><a href="#">Interesting Recent Link 3</a></li>
			<li><a href="#">Interesting Recent Link 4</a></li>
			<li><a href="#">Interesting Recent Link 5</a></li>
			<li><a href="#">Interesting Recent Link 6</a></li>
			<li><a href="#">Interesting Recent Link 7</a></li>
							</ul>
  	      </div> 
  	      <div id="tab2" class="tab_content"> 
  	          <h3>Our Most Popular</h3> 
  	          <ul>
  	          	<li><a href="#">Most Popular Link 1</a></li>
			<li><a href="#">Most Popular Link 2</a></li>
			<li><a href="#">Most Popular Link 3</a></li>
			<li><a href="#">Most Popular Link 4</a></li>
		</ul>
  	      </div> 
  	      <div id="tab3" class="tab_content"> 
  	          <h3>Who I Am</h3> 
  	          <img src="images/me.png" alt="" /><p>Lorem ipsum in libris debitis facilis qui, in usu esse falli deseruisse. Vel ut vivendo sensibus partiendo, liber philosophia ne vim. Viris oblique explicari has et. Nam noster iisque discere te, sale doming delectus est te, an debet quando eruditi pro. Ad dicant praesent persequeris has, ne vel minimum petentium periculis.</p>
  	      </div>
  	     </div>
  	    </div>
  	    
  	     <div class="standard">
        	
				<h3>Connect With Us</h3>
					<ul>
						<li><a href="#">Twitter</a></li>
						<li><a href="#">Facebook</a></li>
						<li><a href="#">LinkedIn</a></li>
						<li><a href="#">Flickr</a></li>
					</ul>
			</div>

		</aside><!-- end of sidebar -->

	</section><!-- end of #main content and sidebar-->
	
		<footer>
		<section id="footer-area">

			<section id="footer-outer-block">
					<aside class="footer-segment">
							<h4>XXXXXXXXXXXXXXXXX</h4>
								<p>&copy; 2012 <a href="#">Impressum</a></p>
					</aside><!-- end of #fourth footer segment -->

			</section><!-- end of footer-outer-block -->

		</section><!-- end of footer-area -->
	</footer>
	
</div><!-- #wrapper -->
</body>
</html>
```


----------



## andyx1975 (7. Jan 2013)

achso damit es besser zu finden ist... auf der JSP rufe ich das Servlet wie folgt auf:


```
<%
                    out.print(request.getAttribute("news"));
                %>
```


----------



## nillehammer (7. Jan 2013)

Tust du leider nicht. Du liest ein Request-Attribut aus. Das ist nicht gesetzt und deswegen wird null angezeigt. IMHO ist das Reingenerieren des Servlet-Outputs in die JSP so auch nicht möglich. Ich glaube, eine normale Methode, welche den gewünschten Output als String zurück gibt, führt hier eher zum Ziel. Also garnix mit Servlet, eher eine Hilfsklasse, welche von der JSP benutzt wird. Und schlussendlich bleibt wie immer die Anmerkung, dass die Darstellung am besten garnicht in Java-Code zusammengebaut wird, sondern wiederum über eine (andere) JSP. Die kann man bequem includen.


----------



## HLX (7. Jan 2013)

Wie nillehammer schreibt rufst du mit  
	
	
	
	





```
request.getAttribute("news")
```
 nicht das Servlet auf, sondern ein Attribut, das du am Request unter der Id "news" hinterlegt hast.

Der Weg über das Servlet funktioniert bei dir, da du hier das Request-Attribut "news" zuvor explizit setzt.


----------



## andyx1975 (7. Jan 2013)

Danke für die Antwort... Also ich verwende eclipseLink für die daten... Wenn ich die Methode in eine Hilfsklasse baue und aufrufe bekomme ich einen 500er. Ich baue das gleich mal und Poster das Ergebnis.


----------



## andyx1975 (7. Jan 2013)

*Der JSP Aufruf sieht wie folgt aus:*

```
<!-- Include -->
<%@ page import="com.uds.webadmin.server.BWebsiteItems" %>
<!-- AUFRUF DES SERVLETS -->
				<%
				    BWebsiteItems.getNewsForWebsite();
				%>
```

*Die Hilfsklasse sieht wie folgt aus:*

```
package com.uds.webadmin.server;

import java.io.File;
import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import javax.persistence.PersistenceContext;
import javax.persistence.PersistenceContextType;
import javax.persistence.Query;

import com.uds.webadmin.data.DNews;
import com.uds.webadmin.data.DSettings;
import com.uds.webadmin.data.DUpload;

public class BWebsiteItems
{

    @PersistenceContext( unitName = "persistance", type = PersistenceContextType.TRANSACTION )
    private static String PERSISTENCE_UNIT_NAME = "LSF-5434"; // Name of the persistance unit which will be chosen
    private static EntityManagerFactory factory = Persistence.createEntityManagerFactory( PERSISTENCE_UNIT_NAME );

    public static String getNewsForWebsite()
    {
        String newsItem = "";
        File file = null;

        // Search for a central upload path
        CRestSettings prop = new CRestSettings();
        DSettings settings = prop.getAllSettings();
        String path = settings.getUploadPath();
        if ( path.equals( "" ) )
        {
            // gets the file name / path
            file = new File( DUpload.class.getResource( "/" ).getPath() );
            file = file.getParentFile();
            file = file.getParentFile();
            file =
                new File( file.getAbsoluteFile() + System.getProperty( "file.separator" ) + "uploads"
                    + System.getProperty( "file.separator" ) );
        }
        else
        {
            file =
                new File( path + System.getProperty( "file.separator" ) + "uploads"
                    + System.getProperty( "file.separator" ) );
        }

        try
        {
            EntityManager em = factory.createEntityManager();
            Query query = em.createQuery( "SELECT e FROM DNews e ORDER BY e.news_id DESC" );
            List<DNews> news = query.getResultList();
            em.close();

            for ( int i = 0; i < news.size(); i++ )
            {

                String picture = "";
                DUpload upload = news.get( i ).getPicture();
                if ( upload != null )
                {
                    picture = file.getName() + "/" + upload.getUpload_link();
                }
                String headline = news.get( i ).getNews_headline();
                String text = news.get( i ).getTxt();

                newsItem =
                    newsItem + "<article>" + "<img src=\" " + picture + "\" alt=\"\" class=\"thumb\" /> "
                        + "<p><a href=\"#\" class=\"title\">" + headline + "</a></p><p class=\"story\">" + text
                        + "</p>" + "</article>";
            }

        }
        catch ( Exception e )
        {

            System.out.println( "Exception is ;" + e );

        }

        return newsItem;
    }
}
```


*Die Fehlermeldung sieht wie folgt aus:*



```
HTTP ERROR: 500

Unable to compile class for JSP

Generated servlet error:
	@NamedQuery( name = "findAllMyPictures", query = "SELECT e FROM DUpload e WHERE e.creator = :login AND e.upload_type = :upload_type ORDER BY e.creation_date DESC" ) } )
	^^^^^^^^^^^
Syntax error, annotations are only available if source level is 1.5
----------
52. ERROR in C:\workspace\bookingAdmin\src\com\uds\webadmin\data\DUpload.java (at line 41)
	@Id
	^^^
Syntax error, annotations are only available if source level is 1.5
----------
1267. ERROR in C:\workspace\bookingAdmin\src\com\uds\webadmin\data\DRight.java (at line 64)
	@ManyToOne (fetch = FetchType.EAGER)
	^^^^^^^^^^
Syntax error, annotations are only available if source level is 1.5
----------
1268. ERROR in C:\workspace\bookingAdmin\src\com\uds\webadmin\data\DRight.java (at line 65)
	@JoinColumn( name = "role_id" )
	^^^^^^^^^^^
Syntax error, annotations are only available if source level is 1.5
----------
1268 problems (1262 errors, 6 warnings)Jan 07, 2013 5:04:04 PM org.apache.jasper.compiler.Compiler generateClass
SEVERE: Javac exception 
Compile failed; see the compiler error output for details.
	at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:933)
	at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:757)
	at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:382)
	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
	at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
	at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
	at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)
	at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
	at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49)
	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
	at org.mortbay.jetty.Server.handle(Server.java:324)
	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
	at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:829)
	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:513)
	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
	at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
	at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)

Jan 07, 2013 5:04:04 PM org.apache.jasper.compiler.Compiler generateClass
SEVERE: Env: Compile: javaFileName=/C:/Users/andy/AppData/Local/Temp/Jetty_127_0_0_1_8888_war____-g0qk00/jsp//org/apache/jsp\news_jsp.java
    classpath=/C:/workspace/bookingAdmin/war/WEB-INF/classes/;/C:/workspace/bookingAdmin/war/WEB-INF/lib/asm-3.1.jar;/C:/workspace/bookingAdmin/war/WEB-INF/lib/avalon-framework-4.2.0.jar;/C:/workspace/bookingAdmin/war/WEB-INF/lib/barcode4j-fop-ext.jar;/C:/workspace/bookingAdmin/war/WEB-INF/lib/barcode4j.jar;/C:/workspace/bookingAdmin/war/WEB-INF/lib/batik-all-1.7.jar;/C:/workspace/bookingAdmin/war/WEB-INF/lib/com.sun.tools.xjc_2.2.0.jar;/C:/workspace/bookingAdmin/war/WEB-INF/lib/com.sun.xml.bind_2.2.0.v201004141950.jar;/C:/workspace/bookingAdmin/war/WEB-INF/lib/commonj.sdo_2.1.1.v201112051852.jar;/C:/workspace/bookingAdmin/war/WEB-INF/lib/commons-fileupload-1.2.2.jar;/C:/workspace/bookingAdmin/war/WEB-INF/lib/commons-io-1.3.1.jar;/C:/workspace/bookingAdmin/war/WEB-INF/lib/commons-io-2.1.jar;/C:/workspace/bookingAdmin/war/WEB-INF/lib/commons-logging-1.0.4.jar;/C:/workspace/bookingAdmin/war/WEB-INF/lib/dsn.jar;/C:/workspace/bookingAdmin/war/WEB-INF/lib/eclipselink-jpa-modelgen_2.4.0.v20120608-r11652.jar;/C:/workspace/bookingAdmin/war/WEB-INF/lib/eclipselink.jar;/C:/workspace/bookingAdmin/war/WEB-INF/lib/fop.jar;/C:/workspace/bookingAdmin/war/WEB-INF/lib/gwt-servlet.jar;/C:/workspace/bookingAdmin/war/WEB-INF/lib/imap.jar;/C:/workspace/bookingAdmin/war/WEB-INF/lib/imgscalr-lib-4.2.jar;/C:/workspace/bookingAdmin/war/WEB-INF/lib/jackson-core-asl-1.8.3.jar;/C:/workspace/bookingAdmin/war/WEB-INF/lib/jackson-jaxrs-1.8.3.jar;/C:/workspace/bookingAdmin/war/WEB-INF/lib/jackson-mapper-asl-1.8.3.jar;/C:/workspace/bookingAdmin/war/WEB-INF/lib/jackson-xc-1.8.3.jar;/C:/workspace/bookingAdmin/war/WEB-INF/lib/javax.activation_1.1.0.v201108011116.jar;/C:/workspace/bookingAdmin/war/WEB-INF/lib/javax.ejb.jar;/C:/workspace/bookingAdmin/war/WEB-INF/lib/javax.mail-1.4.6-rc1.jar;/C:/workspace/bookingAdmin/war/WEB-INF/lib/javax.persistence_2.0.4.v201112161009.jar;/C:/workspace/bookingAdmin/war/WEB-INF/lib/javax.xml.bind_2.2.0.v201105210648.jar;/C:/workspace/bookingAdmin/war/WEB-INF/lib/javax.xml.stream_1.0.1.v201004272200.jar;/C:/workspace/bookingAdmin/war/WEB-INF/lib/jaxen-1.1.3.jar;/C:/workspace/bookingAdmin/war/WEB-INF/lib/jdom-2.0.3.jar;/C:/workspace/bookingAdmin/war/WEB-INF/lib/jersey-client-1.9.1.jar;/C:/workspace/bookingAdmin/war/WEB-INF/lib/jersey-core-1.9.1.jar;/C:/workspace/bookingAdmin/war/WEB-INF/lib/jersey-json-1.9.1.jar;/C:/workspace/bookingAdmin/war/WEB-INF/lib/jersey-server-1.9.1.jar;/C:/workspace/bookingAdmin/war/WEB-INF/lib/jettison-1.1.jar;/C:/workspace/bookingAdmin/war/WEB-INF/lib/jsr311-api-1.1.1.jar;/C:/workspace/bookingAdmin/war/WEB-INF/lib/logback-classic-1.0.1.jar;/C:/workspace/bookingAdmin/war/WEB-INF/lib/logback-core-1.0.1.jar;/C:/workspace/bookingAdmin/war/WEB-INF/lib/mail.jar;/C:/workspace/bookingAdmin/war/WEB-INF/lib/mailapi.jar;/C:/workspace/bookingAdmin/war/WEB-INF/lib/mysql-connector-java-5.1.18-bin.jar;/C:/workspace/bookingAdmin/war/WEB-INF/lib/org.eclipse.persistence.jpars_2.4.0.v20120608-r11652.jar;/C:/workspace/bookingAdmin/war/WEB-INF/lib/pop3.jar;/C:/workspace/bookingAdmin/war/WEB-INF/lib/postgresql-8.4-701.jdbc4.jar;/C:/workspace/bookingAdmin/war/WEB-INF/lib/serializer-2.7.0.jar;/C:/workspace/bookingAdmin/war/WEB-INF/lib/slf4j-api-1.6.4.jar;/C:/workspace/bookingAdmin/war/WEB-INF/lib/smartgwt-skins.jar;/C:/workspace/bookingAdmin/war/WEB-INF/lib/smartgwt.jar;/C:/workspace/bookingAdmin/war/WEB-INF/lib/smtp.jar;/C:/workspace/bookingAdmin/war/WEB-INF/lib/xalan-2.7.0.jar;/C:/workspace/bookingAdmin/war/WEB-INF/lib/xercesImpl-2.7.1.jar;/C:/workspace/bookingAdmin/war/WEB-INF/lib/xercesImpl.jar;/C:/workspace/bookingAdmin/war/WEB-INF/lib/xml-apis-1.3.04.jar;/C:/workspace/bookingAdmin/war/WEB-INF/lib/xml-apis-ext-1.3.04.jar;/C:/workspace/bookingAdmin/war/WEB-INF/lib/xml-apis.jar;/C:/workspace/bookingAdmin/war/WEB-INF/lib/xmlgraphics-commons-1.4.jar;/C:/eclipse/plugins/com.google.gwt.eclipse.sdkbundle_2.5.0.v201211121240-rel-r42/gwt-2.5.0/validation-api-1.0.0.GA.jar;C:\Users\andy\AppData\Local\Temp\Jetty_127_0_0_1_8888_war____-g0qk00\jsp;null
    cp=C:/workspace/bookingAdmin/src;C:\workspace\bookingAdmin\war\WEB-INF\classes;C:\eclipse\plugins\com.google.gwt.eclipse.sdkbundle_2.5.0.v201211121240-rel-r42\gwt-2.5.0\gwt-user.jar;C:\eclipse\plugins\com.google.gwt.eclipse.sdkbundle_2.5.0.v201211121240-rel-r42\gwt-2.5.0\gwt-dev.jar;C:\eclipse\plugins\com.google.gwt.eclipse.sdkbundle_2.5.0.v201211121240-rel-r42\gwt-2.5.0\validation-api-1.0.0.GA-sources.jar;C:\eclipse\plugins\com.google.gwt.eclipse.sdkbundle_2.5.0.v201211121240-rel-r42\gwt-2.5.0\validation-api-1.0.0.GA.jar;C:\workspace\libraries\EclipseLink 2.4.1 - Juno\eclipselink\jlib\eclipselink.jar;C:\workspace\libraries\EclipseLink 2.4.1 - Juno\eclipselink\jlib\jpa\eclipselink-jpa-modelgen_2.4.1.v20121003-ad44345.jar;C:\workspace\libraries\EclipseLink 2.4.1 - Juno\eclipselink\jlib\jpa\javax.persistence_2.0.4.v201112161009.jar;C:\workspace\libraries\EclipseLink 2.4.1 - Juno\eclipselink\jlib\jpa\org.eclipse.persistence.jpars_2.4.1.v20121003-ad44345.jar;C:\workspace\libraries\EclipseLink 2.4.1 - Juno\eclipselink\jlib\moxy\com.sun.tools.xjc_2.2.0.jar;C:\workspace\libraries\EclipseLink 2.4.1 - Juno\eclipselink\jlib\moxy\com.sun.xml.bind_2.2.0.v201004141950.jar;C:\workspace\libraries\EclipseLink 2.4.1 - Juno\eclipselink\jlib\moxy\javax.activation_1.1.0.v201108011116.jar;C:\workspace\libraries\EclipseLink 2.4.1 - Juno\eclipselink\jlib\moxy\javax.mail_1.4.0.v201005080615.jar;C:\workspace\libraries\EclipseLink 2.4.1 - Juno\eclipselink\jlib\moxy\javax.xml.bind_2.2.0.v201105210648.jar;C:\workspace\libraries\EclipseLink 2.4.1 - Juno\eclipselink\jlib\moxy\javax.xml.stream_1.0.1.v201004272200.jar;C:\workspace\bookingAdmin\war\WEB-INF\lib\asm-3.1.jar;C:\workspace\bookingAdmin\war\WEB-INF\lib\avalon-framework-4.2.0.jar;C:\workspace\bookingAdmin\war\WEB-INF\lib\barcode4j-fop-ext.jar;C:\workspace\bookingAdmin\war\WEB-INF\lib\barcode4j.jar;C:\workspace\bookingAdmin\war\WEB-INF\lib\batik-all-1.7.jar;C:\workspace\bookingAdmin\war\WEB-INF\lib\com.sun.tools.xjc_2.2.0.jar;C:\workspace\bookingAdmin\war\WEB-INF\lib\com.sun.xml.bind_2.2.0.v201004141950.jar;C:\workspace\bookingAdmin\war\WEB-INF\lib\commonj.sdo_2.1.1.v201112051852.jar;C:\workspace\bookingAdmin\war\WEB-INF\lib\commons-fileupload-1.2.2.jar;C:\workspace\bookingAdmin\war\WEB-INF\lib\commons-io-1.3.1.jar;C:\workspace\bookingAdmin\war\WEB-INF\lib\commons-io-2.1.jar;C:\workspace\bookingAdmin\war\WEB-INF\lib\commons-logging-1.0.4.jar;C:\workspace\bookingAdmin\war\WEB-INF\lib\dsn.jar;C:\workspace\bookingAdmin\war\WEB-INF\lib\eclipselink-jpa-modelgen_2.4.0.v20120608-r11652.jar;C:\workspace\bookingAdmin\war\WEB-INF\lib\eclipselink.jar;C:\workspace\bookingAdmin\war\WEB-INF\lib\xml-apis.jar;C:\workspace\bookingAdmin\war\WEB-INF\lib\serializer-2.7.0.jar;C:\workspace\bookingAdmin\war\WEB-INF\lib\xercesImpl.jar;C:\workspace\bookingAdmin\war\WEB-INF\lib\xalan-2.7.0.jar;C:\workspace\bookingAdmin\war\WEB-INF\lib\xercesImpl-2.7.1.jar;C:\workspace\bookingAdmin\war\WEB-INF\lib\xml-apis-1.3.04.jar;C:\workspace\bookingAdmin\war\WEB-INF\lib\xml-apis-ext-1.3.04.jar;C:\workspace\bookingAdmin\war\WEB-INF\lib\xmlgraphics-commons-1.4.jar;C:\workspace\bookingAdmin\war\WEB-INF\lib\fop.jar;C:\workspace\bookingAdmin\war\WEB-INF\lib\gwt-servlet.jar;C:\workspace\bookingAdmin\war\WEB-INF\lib\imap.jar;C:\workspace\bookingAdmin\war\WEB-INF\lib\imgscalr-lib-4.2.jar;C:\workspace\bookingAdmin\war\WEB-INF\lib\jackson-core-asl-1.8.3.jar;C:\workspace\bookingAdmin\war\WEB-INF\lib\jackson-jaxrs-1.8.3.jar;C:\workspace\bookingAdmin\war\WEB-INF\lib\jackson-mapper-asl-1.8.3.jar;C:\workspace\bookingAdmin\war\WEB-INF\lib\jackson-xc-1.8.3.jar;C:\workspace\bookingAdmin\war\WEB-INF\lib\javax.activation_1.1.0.v201108011116.jar;C:\workspace\bookingAdmin\war\WEB-INF\lib\javax.ejb.jar;C:\workspace\bookingAdmin\war\WEB-INF\lib\javax.mail-1.4.6-rc1.jar;C:\workspace\bookingAdmin\war\WEB-INF\lib\javax.persistence_2.0.4.v201112161009.jar;C:\workspace\bookingAdmin\war\WEB-INF\lib\javax.xml.bind_2.2.0.v201105210648.jar;C:\workspace\bookingAdmin\war\WEB-INF\lib\javax.xml.stream_1.0.1.v201004272200.jar;C:\workspace\bookingAdmin\war\WEB-INF\lib\jaxen-1.1.3.jar;C:\workspace\bookingAdmin\war\WEB-INF\lib\jdom-2.0.3.jar;C:\workspace\bookingAdmin\war\WEB-INF\lib\jersey-client-1.9.1.jar;C:\workspace\bookingAdmin\war\WEB-INF\lib\jersey-core-1.9.1.jar;C:\workspace\bookingAdmin\war\WEB-INF\lib\jersey-json-1.9.1.jar;C:\workspace\bookingAdmin\war\WEB-INF\lib\jersey-server-1.9.1.jar;C:\workspace\bookingAdmin\war\WEB-INF\lib\jettison-1.1.jar;C:\workspace\bookingAdmin\war\WEB-INF\lib\jsr311-api-1.1.1.jar;C:\workspace\bookingAdmin\war\WEB-INF\lib\logback-classic-1.0.1.jar;C:\workspace\bookingAdmin\war\WEB-INF\lib\logback-core-1.0.1.jar;C:\workspace\bookingAdmin\war\WEB-INF\lib\mail.jar;C:\workspace\bookingAdmin\war\WEB-INF\lib\mailapi.jar;C:\workspace\bookingAdmin\war\WEB-INF\lib\mysql-connector-java-5.1.18-bin.jar;C:\workspace\bookingAdmin\war\WEB-INF\lib\org.eclipse.persistence.jpars_2.4.0.v20120608-r11652.jar;C:\workspace\bookingAdmin\war\WEB-INF\lib\pop3.jar;C:\workspace\bookingAdmin\war\WEB-INF\lib\postgresql-8.4-701.jdbc4.jar;C:\workspace\bookingAdmin\war\WEB-INF\lib\slf4j-api-1.6.4.jar;C:\workspace\bookingAdmin\war\WEB-INF\lib\smartgwt-skins.jar;C:\workspace\bookingAdmin\war\WEB-INF\lib\smartgwt.jar;C:\workspace\bookingAdmin\war\WEB-INF\lib\smtp.jar;C:/eclipse/plugins/com.google.gwt.eclipse.sdkbundle_2.5.0.v201211121240-rel-r42/gwt-2.5.0/gwt-dev.jar
    cp=C:\workspace\bookingAdmin\war\WEB-INF\classes
    cp=C:\workspace\bookingAdmin\war\WEB-INF\lib\asm-3.1.jar
    cp=C:\workspace\bookingAdmin\war\WEB-INF\lib\avalon-framework-4.2.0.jar
    cp=C:\workspace\bookingAdmin\war\WEB-INF\lib\barcode4j-fop-ext.jar
    cp=C:\workspace\bookingAdmin\war\WEB-INF\lib\barcode4j.jar
    cp=C:\workspace\bookingAdmin\war\WEB-INF\lib\batik-all-1.7.jar
    cp=C:\workspace\bookingAdmin\war\WEB-INF\lib\com.sun.tools.xjc_2.2.0.jar
    cp=C:\workspace\bookingAdmin\war\WEB-INF\lib\com.sun.xml.bind_2.2.0.v201004141950.jar
    cp=C:\workspace\bookingAdmin\war\WEB-INF\lib\commonj.sdo_2.1.1.v201112051852.jar
    cp=C:\workspace\bookingAdmin\war\WEB-INF\lib\commons-fileupload-1.2.2.jar
    cp=C:\workspace\bookingAdmin\war\WEB-INF\lib\commons-io-1.3.1.jar
    cp=C:\workspace\bookingAdmin\war\WEB-INF\lib\commons-io-2.1.jar
    cp=C:\workspace\bookingAdmin\war\WEB-INF\lib\commons-logging-1.0.4.jar
    cp=C:\workspace\bookingAdmin\war\WEB-INF\lib\dsn.jar
    cp=C:\workspace\bookingAdmin\war\WEB-INF\lib\eclipselink-jpa-modelgen_2.4.0.v20120608-r11652.jar
    cp=C:\workspace\bookingAdmin\war\WEB-INF\lib\eclipselink.jar
    cp=C:\workspace\bookingAdmin\war\WEB-INF\lib\fop.jar
    cp=C:\workspace\bookingAdmin\war\WEB-INF\lib\gwt-servlet.jar
    cp=C:\workspace\bookingAdmin\war\WEB-INF\lib\imap.jar
    cp=C:\workspace\bookingAdmin\war\WEB-INF\lib\imgscalr-lib-4.2.jar
    cp=C:\workspace\bookingAdmin\war\WEB-INF\lib\jackson-core-asl-1.8.3.jar
    cp=C:\workspace\bookingAdmin\war\WEB-INF\lib\jackson-jaxrs-1.8.3.jar
    cp=C:\workspace\bookingAdmin\war\WEB-INF\lib\jackson-mapper-asl-1.8.3.jar
    cp=C:\workspace\bookingAdmin\war\WEB-INF\lib\jackson-xc-1.8.3.jar
    cp=C:\workspace\bookingAdmin\war\WEB-INF\lib\javax.activation_1.1.0.v201108011116.jar
    cp=C:\workspace\bookingAdmin\war\WEB-INF\lib\javax.ejb.jar
    cp=C:\workspace\bookingAdmin\war\WEB-INF\lib\javax.mail-1.4.6-rc1.jar
    cp=C:\workspace\bookingAdmin\war\WEB-INF\lib\javax.persistence_2.0.4.v201112161009.jar
    cp=C:\workspace\bookingAdmin\war\WEB-INF\lib\javax.xml.bind_2.2.0.v201105210648.jar
    cp=C:\workspace\bookingAdmin\war\WEB-INF\lib\javax.xml.stream_1.0.1.v201004272200.jar
    cp=C:\workspace\bookingAdmin\war\WEB-INF\lib\jaxen-1.1.3.jar
    cp=C:\workspace\bookingAdmin\war\WEB-INF\lib\jdom-2.0.3.jar
    cp=C:\workspace\bookingAdmin\war\WEB-INF\lib\jersey-client-1.9.1.jar
    cp=C:\workspace\bookingAdmin\war\WEB-INF\lib\jersey-core-1.9.1.jar
    cp=C:\workspace\bookingAdmin\war\WEB-INF\lib\jersey-json-1.9.1.jar
    cp=C:\workspace\bookingAdmin\war\WEB-INF\lib\jersey-server-1.9.1.jar
    cp=C:\workspace\bookingAdmin\war\WEB-INF\lib\jettison-1.1.jar
    cp=C:\workspace\bookingAdmin\war\WEB-INF\lib\jsr311-api-1.1.1.jar
    cp=C:\workspace\bookingAdmin\war\WEB-INF\lib\logback-classic-1.0.1.jar
    cp=C:\workspace\bookingAdmin\war\WEB-INF\lib\logback-core-1.0.1.jar
    cp=C:\workspace\bookingAdmin\war\WEB-INF\lib\mail.jar
    cp=C:\workspace\bookingAdmin\war\WEB-INF\lib\mailapi.jar
    cp=C:\workspace\bookingAdmin\war\WEB-INF\lib\mysql-connector-java-5.1.18-bin.jar
    cp=C:\workspace\bookingAdmin\war\WEB-INF\lib\org.eclipse.persistence.jpars_2.4.0.v20120608-r11652.jar
    cp=C:\workspace\bookingAdmin\war\WEB-INF\lib\pop3.jar
    cp=C:\workspace\bookingAdmin\war\WEB-INF\lib\postgresql-8.4-701.jdbc4.jar
    cp=C:\workspace\bookingAdmin\war\WEB-INF\lib\serializer-2.7.0.jar
    cp=C:\workspace\bookingAdmin\war\WEB-INF\lib\slf4j-api-1.6.4.jar
    cp=C:\workspace\bookingAdmin\war\WEB-INF\lib\smartgwt-skins.jar
    cp=C:\workspace\bookingAdmin\war\WEB-INF\lib\smartgwt.jar
    cp=C:\workspace\bookingAdmin\war\WEB-INF\lib\smtp.jar
    cp=C:\workspace\bookingAdmin\war\WEB-INF\lib\xalan-2.7.0.jar
    cp=C:\workspace\bookingAdmin\war\WEB-INF\lib\xercesImpl-2.7.1.jar
    cp=C:\workspace\bookingAdmin\war\WEB-INF\lib\xercesImpl.jar
    cp=C:\workspace\bookingAdmin\war\WEB-INF\lib\xml-apis-1.3.04.jar
    cp=C:\workspace\bookingAdmin\war\WEB-INF\lib\xml-apis-ext-1.3.04.jar
    cp=C:\workspace\bookingAdmin\war\WEB-INF\lib\xml-apis.jar
    cp=C:\workspace\bookingAdmin\war\WEB-INF\lib\xmlgraphics-commons-1.4.jar
    cp=C:\eclipse\plugins\com.google.gwt.eclipse.sdkbundle_2.5.0.v201211121240-rel-r42\gwt-2.5.0\validation-api-1.0.0.GA.jar
    cp=C:\Users\andy\AppData\Local\Temp\Jetty_127_0_0_1_8888_war____-g0qk00\jsp
    cp=null
    work dir=C:\Users\andy\AppData\Local\Temp\Jetty_127_0_0_1_8888_war____-g0qk00\jsp
    extension dir=C:\Program Files\Java\jre7\lib\ext;C:\Windows\Sun\Java\lib\ext
    srcDir=C:\Users\andy\AppData\Local\Temp\Jetty_127_0_0_1_8888_war____-g0qk00\jsp
    include=org/apache/jsp/news_jsp.java
```


----------



## andyx1975 (7. Jan 2013)

Die Fehlermeldung musste ich ein wenig kürzen in der Mitte, da hier alle ca. 1200 JPA Annotationen bemängelt wurden. Jemand eine Idee? Mein Tomcat läuft mit java 1.7 und im Build Path ist auch 1.7 integriert.


----------



## nillehammer (7. Jan 2013)

Du schreibst das hier (also Tomcat)


> Mein Tomcat läuft mit java 1.7 und im Build Path ist auch 1.7 integriert.


Die Exception sieht aber nach Jetty aus:

```
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
...
```
Wie ist der denn konfiguriert? Eventuell Maven im Einsatz? Dann mal in die pom.xml gucken.


----------



## andyx1975 (7. Jan 2013)

Ups ja sorry hast mich auf dem linke Fuss erwischt  Also ich habe das Backend mit GTW entwickelt... da ist ein Jetty integriert... aber ich habe lokal auch noch einen Tomcat laufen in dem ich den kompilierten Code teste.

Ich habe das Problem jetzt mit dem Aufruf gelöst... so hats funktioniert:


```
<!-- AUFRUF DES SERVLETS -->
				<%
				    RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/websiteNews");
				    dispatcher.include(request,response);
				    out.print(request.getAttribute("news"));
				%>
```

Danke schon einmal für eure Hilfe... unter Jetty gehts... nur wenn ich den kompilierten Code in den Tomcat kopiere bekomme ich jetzt die folgende Meldung:


```
description The server encountered an internal error that prevented it from fulfilling this request.

exception
org.apache.jasper.JasperException: org.apache.jasper.JasperException: javax.servlet.ServletException: java.lang.StackOverflowError
	org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:549)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:455)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:722)

root cause

org.apache.jasper.JasperException: org.apache.jasper.JasperException: org.apache.jasper.JasperException: javax.servlet.ServletException: java.lang.StackOverflowError
	org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:549)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:455)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
	com.uds.webadmin.server.CServletWebsiteNews.doGet(CServletWebsiteNews.java:103)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
	org.apache.jsp.news_jsp._jspService(news_jsp.java:118)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:722)

root cause

org.apache.jasper.JasperException: org.apache.jasper.JasperException: javax.servlet.ServletException: java.lang.StackOverflowError
	org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:549)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:455)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
	com.uds.webadmin.server.CServletWebsiteNews.doGet(CServletWebsiteNews.java:103)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
	org.apache.jsp.news_jsp._jspService(news_jsp.java:118)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
	com.uds.webadmin.server.CServletWebsiteNews.doGet(CServletWebsiteNews.java:103)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
	org.apache.jsp.news_jsp._jspService(news_jsp.java:118)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
```


----------



## andyx1975 (7. Jan 2013)

Und achso Maven habe ich nicht im Einsatz. Danke und Gruß!!!


----------



## andyx1975 (7. Jan 2013)

Ok hat sich jetzt erledigt.... musste im servlet die folgende Stelle entfernen:


```
RequestDispatcher dispatcher = request.getRequestDispatcher( "news.jsp" );

        if ( dispatcher != null )
        {
            dispatcher.forward( request, response );
        }
```


----------

