Web project does not starthttps://www.eclipse.org/forums/index.php/mv/msg/68329/214326/#msg_214326
Originally posted by: jarkko.miettinen.iki.fi

I have a following problem:
We have a project where we are using JSPs. I am using Tomcat as a web
container for this project and I have problems getting this project
running. What I've done is following:
Check out the project from SVN using new->SVN->checkout project from SVN.
Then I create the project as Web->Dynamic web project.

In our source structure that I check out from SVN we have src/main and
src/tests which I "use as source folders" to bring them to top level and
to get the packages right and webapps/equipment under which the WEB-INF
and META-INF lie. Then built classes (with ant) go in
webapps/equipment/WEB-INF/classes.
Context.xml lies in webapps/equipment/META-INF and web.xml in
webapps/equipment/WEB-INF.

Problem is that after I add this project to my tomcat server using Eclipse
tools (Servers view and add/remove projects) I do not get any program
started.
I've once successfully gotten this to work but I do not know what I've
done differently at that time.

I understand that this is kind of decoherent explanation but I do not know
that on what points should I give more details.

*** User Preferences:
#Tue May 27 13:44:40 EEST 2008
/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.builder. resourceCopyExclusionFilter=*.launch
/instance/org.eclipse.jdt.ui/org.eclipse.jdt.ui.PackageExplo rer.ImportDeclarationFilter=true
/instance/org.eclipse.hyades.execution/CLASSPATH_ORG_ECLIPSE _EMF_ECORE=/home/jmiettin/.eclipse/org.eclipse.sdk.ide/updat es/eclipse/plugins/org.eclipse.emf.ecore_2.2.2.v200702131851 .jar\:
/project/keke2/org.eclipse.wst.validation/USER_BUILD_PREFERE NCE=enabledBuildValidatorListorg.eclipse.wst.xsd.core.intern al.validation.eclipse.XSDDelegatingValidator;org.eclipse.wst .html.internal.validation.HTMLValidator;org.eclipse.wst.wsdl .validation.internal.eclipse.WSDLDelegatingValidator;org.ecl ipse.wst.common.componentcore.internal.ModuleCoreValidator;o rg.eclipse.wst.dtd.core.internal.validation.eclipse.Validato r;org.eclipse.jst.j2ee.internal.web.validation.UIWarValidato r;org.eclipse.wst.wsi.ui.internal.WSIMessageValidator;org.ec lipse.wst.xml.core.internal.validation.eclipse.Validator;org .eclipse.jst.jsp.core.internal.validation.JSPBatchValidator;
/instance/org.eclipse.wst.sse.core/task-tag-projects-already -scanned=keke2,Servers
/instance/org.eclipse.ui.workbench/Oletus_persp=<?xml version\="1.0"
encoding\="UTF-8"?>\n<perspective editorAreaVisible\="1" fixed\="0"
version\="0.016">\n<descriptor
descriptor\="org.eclipse.jdt.ui.JavaPerspective" id\="Oletus"
label\="Oletus"/>\n<window height\="1154" width\="1930" x\="0"
y\="25"/>\n<alwaysOnActionSet
id\="org.eclipse.ui.edit.text.actionSet.openExternalFile"/ >\n<alwaysOnActionSet
id\="org.eclipse.ui.edit.text.actionSet.annotationNavigation "/>\n<alwaysOnActionSet
id\="org.eclipse.ui.edit.text.actionSet.navigation"/>\n<alwaysOnActionSet
id\="org.eclipse.ui.edit.text.actionSet.convertLineDelimitersTo "/>\n<alwaysOnActionSet
id\="org.eclipse.ui.externaltools.ExternalToolsSet"/>\n<alwaysOnActionSet
id\="org.eclipse.ui.actionSet.keyBindings"/>\n<alwaysOnActionSet
id\="org.eclipse.ui.WorkingSetActionSet"/>\n<alwaysOnActionSet
id\="org.eclipse.update.ui.softwareUpdates"/>\n<alwaysOnActionSet
id\="org.eclipse.search.searchActionSet"/>\n<alwaysOnActionSet
id\="org.eclipse.ui.cheatsheets.actionSet"/>\n<alwaysOnActionSet
id\="org.eclipse.debug.ui.launchActionSet"/>\n<alwaysOnActionSet
id\="org.eclipse.jdt.ui.JavaActionSet"/>\n<alwaysOnActionSet
id\="org.eclipse.jdt.ui.JavaElementCreationActionSet"/>\n <alwaysOnActionSet
id\="org.eclipse.ui.NavigateActionSet"/>\n<alwaysOnActionSet
id\="org.eclipse.debug.ui.breakpointActionSet"/>\n<alwaysOnActionSet
id\="org.eclipse.jdt.debug.ui.JDTDebugActionSet"/>\n<alwaysOnActionSet
id\="org.eclipse.jdt.junit.JUnitActionSet"/>\n<alwaysOnActionSet
id\="org.eclipse.debug.ui.profileActionSet"/>\n<alwaysOnActionSet
id\="org.eclipse.debug.ui.analysisActionSet"/>\n<alwaysOnActionSet
id\="org.eclipse.jst.ws.consumption"/>\n<alwaysOnActionSet
id\=" org.eclipse.jst.servlet.ui.internal.actions.ConvertToWebModu leTypeActionSet "/>\n<alwaysOnActionSet
id\="org.eclipse.wst.server.ui.internal.webbrowser.actionSet "/>\n<show_view_action
id\="org.eclipse.jdt.ui.PackageExplorer"/>\n<show_view_action
id\="org.eclipse.jdt.ui.TypeHierarchy"/>\n<show_view_action
id\="org.eclipse.jdt.ui.SourceView"/>\n<show_view_action
id\="org.eclipse.jdt.ui.JavadocView"/>\n<show_view_action
id\="org.eclipse.search.ui.views.SearchView"/>\n<show_view_action
id\="org.eclipse.ui.console.ConsoleView"/>\n<show_view_action
id\="org.eclipse.ui.views.ContentOutline"/>\n<show_view_action
id\="org.eclipse.ui.views.ProblemView"/>\n<show_view_action
id\="org.eclipse.ui.views.ResourceNavigator"/>\n<show_view_action
id\="org.eclipse.ui.views.TaskList"/>\n<show_view_action
id\="org.eclipse.ui.views.ProgressView"/>\n<show_view_action
id\="org.eclipse.ant.ui.views.AntView"/>\n<show_view_action
id\="org.eclipse.pde.runtime.LogView"/>\n<new_wizard_action
id\="org.eclipse.jdt.ui.wizards.NewPackageCreationWizard"/ >\n<new_wizard_action
id\="org.eclipse.jdt.ui.wizards.NewClassCreationWizard"/>\n <new_wizard_action
id\="org.eclipse.jdt.ui.wizards.NewInterfaceCreationWizard"/ >\n<new_wizard_action
id\="org.eclipse.jdt.ui.wizards.NewEnumCreationWizard"/>\n <new_wizard_action
id\="org.eclipse.jdt.ui.wizards.NewAnnotationCreationWizard "/>\n<new_wizard_action
id\="org.eclipse.jdt.ui.wizards.NewSourceFolderCreationWizard "/>\n<new_wizard_action
id\="org.eclipse.jdt.ui.wizards.NewSnippetFileCreationWizard "/>\n<new_wizard_action
id\="org.eclipse.ui.wizards.new.folder"/>\n<new_wizard_action
id\="org.eclipse.ui.wizards.new.file"/>\n<new_wizard_action
id\="org.eclipse.ui.editors.wizards.UntitledTextFileWizard"/ >\n<new_wizard_action
id\="org.eclipse.jdt.junit.wizards.NewTestCaseCreationWizard "/>\n<perspective_action
id\="org.eclipse.jdt.ui.JavaPerspective"/>\n<perspective_action
id\="org.eclipse.debug.ui.DebugPerspective"/>\n<perspective_action
id\="org.eclipse.jdt.ui.JavaBrowsingPerspective"/>\n<view
id\="org.eclipse.ui.views.ProblemView"/>\n<view
id\="org.eclipse.jdt.ui.JavadocView"/>\n<view
id\="org.eclipse.jdt.ui.SourceView"/>\n<view
id\="org.eclipse.ui.views.ProgressView"/>\n<view
id\="org.eclipse.jdt.ui.PackageExplorer"/>\n<view
id\="org.eclipse.ui.views.ContentOutline"/>\n<layout>\n <mainWindow>\n<info
folder\="true"
part\="org.eclipse.ui.internal.ViewStack@3408ab31">\n<folder
activePageID\="org.eclipse.ui.views.ContentOutline" appearance\="2"
expanded\="2">\n<page content\="org.eclipse.ui.views.ContentOutline" 2008-05-27T10:44:43-00:00Re: Web project does not starthttps://www.eclipse.org/forums/index.php/mv/msg/68329/214506/#msg_214506
> I have a following problem:
> We have a project where we are using JSPs. I am using Tomcat as a web
> container for this project and I have problems getting this project
> running. What I've done is following:
> Check out the project from SVN using new->SVN->checkout project from
> SVN. Then I create the project as Web->Dynamic web project.
> In our source structure that I check out from SVN we have src/main and
> src/tests which I "use as source folders" to bring them to top level and
> to get the packages right and webapps/equipment under which the WEB-INF
> and META-INF lie. Then built classes (with ant) go in
> webapps/equipment/WEB-INF/classes.
> Context.xml lies in webapps/equipment/META-INF and web.xml in
> webapps/equipment/WEB-INF.
> Problem is that after I add this project to my tomcat server using
> Eclipse tools (Servers view and add/remove projects) I do not get any
> program started.
> I've once successfully gotten this to work but I do not know what I've
> done differently at that time.
>
> I understand that this is kind of decoherent explanation but I do not
> know that on what points should I give more details.
>

When you created the Dynamic Web Project, did you specify the Content
Directory as "webapps/equipment" and the Java Source Directory as
"src/main"?

Note, after doing so, you would still need to add the "src/tests" as a
second Java Source folder. Both of the source folders should output to
the default output folder which would be "build\classes". These built
classes will get copied to the WEB-INF/classes folder during Export to a
war file or when the project is published to a server. They do not need
to be directed to the "webapps/equipment/WEB-INF/classes" in your
project using an Ant build.

> When you created the Dynamic Web Project, did you specify the Content
> Directory as "webapps/equipment" and the Java Source Directory as
> "src/main"?

> Note, after doing so, you would still need to add the "src/tests" as a
> second Java Source folder. Both of the source folders should output to
> the default output folder which would be "buildclasses". These built
> classes will get copied to the WEB-INF/classes folder during Export to a
> war file or when the project is published to a server. They do not need
> to be directed to the "webapps/equipment/WEB-INF/classes" in your
> project using an Ant build.

> Cheers,
> Larry

I changed the source directories manually by selecting the directory and
"use as a source folder". After I changed the Content Directory to
"webapps/equipment" when creating a new project I got the project to
deploy quite well. Is there a way to change this content directory
afterwards?
The thing is that it only seems to work halfway through:
The jsp-pages cannot find all the compiled java-classes and so I get a
jasper error of following sort:

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

An error occurred at line: 19 in the generated java file
The import com.foo.bar.classy cannot be resolved

An error occurred at line: 564 in the jsp file: /jsp/MyJSP.jsp
DatatypeHelper cannot be resolved

I wonder what this means as clearly the classes are in some place where
tomcat can find them but yet the jsp's cannot?]]>2008-05-30T09:09:34-00:00Re: Web project does not starthttps://www.eclipse.org/forums/index.php/mv/msg/68329/214587/#msg_214587
> Larry Isaacs wrote:
>
>> When you created the Dynamic Web Project, did you specify the Content
>> Directory as "webapps/equipment" and the Java Source Directory as
>> "src/main"?
>
>> Note, after doing so, you would still need to add the "src/tests" as a
>> second Java Source folder. Both of the source folders should output
>> to the default output folder which would be "buildclasses". These
>> built classes will get copied to the WEB-INF/classes folder during
>> Export to a war file or when the project is published to a server.
>> They do not need to be directed to the
>> "webapps/equipment/WEB-INF/classes" in your project using an Ant build.
>
>> Cheers,
>> Larry
>
> I changed the source directories manually by selecting the directory and
> "use as a source folder". After I changed the Content Directory to
> "webapps/equipment" when creating a new project I got the project to
> deploy quite well. Is there a way to change this content directory
> afterwards?
> The thing is that it only seems to work halfway through:
> The jsp-pages cannot find all the compiled java-classes and so I get a
> jasper error of following sort:
>
> org.apache.jasper.JasperException: Unable to compile class for JSP:
> An error occurred at line: 19 in the generated java file
> The import com.foo.bar.classy cannot be resolved
>
> An error occurred at line: 564 in the jsp file: /jsp/MyJSP.jsp
> DatatypeHelper cannot be resolved
>
>
> I wonder what this means as clearly the classes are in some place where
> tomcat can find them but yet the jsp's cannot?
>

The publishing of Java classes and what is considered the "Content
Directory" folder is controlled by the
".settings/org.eclipse.wst.common.component" file in your project (use
the Navigator view to see it within Eclipse). In this file,
<wb-resource> entries of the form:

define which Java source folders are going to have their build artifacts
included in the webapp's WEB-INF/classes. You should have one of
these for each Java source folder intended for WEB-INF/classes.

For the "Content Directory", an entry similar to the following should be
present:

I haven't been looking, but I'm not aware of a UI way, even in WTP 3.0,
to change the "Content Directory" after the project is created.
Modifying the org.eclipse.wst.common.component file directly is the only
alternative I'm currently aware of. Note that you can add additional
entries to pickup content from multiple folders if that would make sense
in your use case. Also, I would recommend closing and reopening the
project after making manual changes to help ensure those changes are
seen in the current Eclipse session.

As a test, you can always export a war file and inspect the war to see
if everything you expect is included.