|
|
|
|
Re: HttpServlet class not found if using module dependency [message #222618 is a reply to message #222614] |
Thu, 09 October 2008 13:17 |
Larry Isaacs Messages: 1354 Registered: July 2009 |
Senior Member |
|
|
I'm not clear to me exactly how this is fixing the problem since I'm not
sure exactly what the cause of the error was. However, since you
mention maven, it seems conceivable that Bug 242476[1] might be
contributing to this issue, assuming you aren't already using WTP 3.0.2.
What is the difference in the contents of the webapp's WEB-INF/lib
with and without exporting all maven dependencies?
Cheers,
Larry
[1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=242476
Dominik Raymann wrote:
> Here's what I found out (and what solved the problem):
> The project I am referencing to is a maven project. If I export (via
> Java Build Path, Order and Export) all maven dependencies (and therefore
> the servlet api too) the error is gone and my web project (not being a
> maven project) works fine. Unfortunately this export is not
> automatically checked by the m2eclipse plugin on import. I'm not really
> sure whether this solution is exactly the best for servlet api & Co. But
> it works.
>
> By the way, what is the difference between referencing a project via the
> "Java EE Module Dependency" and referencing it via the "Java Build
> Path"/"Projects" tab?
>
> Cheers,
>
> Dominik
>
> Larry Isaacs schrieb:
>> Dominik Raymann wrote:
>>> Hi,
>>>
>>> I have a webproject with a "J2EE Module Dependency" to a project that
>>> contains the actual servlet (this servlet is quite generic and can be
>>> used in different webprojects). If I try to run the webproject on the
>>> server (Tomcat 6.0), I get an error saying that the class
>>> javax.servlet.http.HttpServlet cannot be found
>>> (java.lang.NoClassDefFoundError: HttpServlet). The error appears
>>> whether "Serve modules without publishing" is checked or not.
>>>
>>> Is this a classloader problem?
>>
>> Yes.
>>
>>> Is there a way to circumvent it?
>>
>> Probably. However, there isn't much here with which to make a guess
>> as to the exact cause and how to fix. Maybe the stacktrace associated
>> with the error will provide some clues.
>>
>> Cheers,
>> Larry
>>
>>>
>>> Cheers,
>>>
>>> Dominik
|
|
|
Re: HttpServlet class not found if using module dependency [message #222621 is a reply to message #222618] |
Fri, 10 October 2008 08:44 |
Dominik Raymann Messages: 37 Registered: July 2009 |
Member |
|
|
Mea culpa, maxima culpa.
Err, looks like I overlooked an important fact: the error I was getting
all the time was not (i.e. no longer) because of the Servlet defined in
the referenced project but because of a filter defined in the project
itself. This filter didn't compile because I missed to include the
servlet api in my build path. Then I didn't realize the compile error
since I had several other errors (mainly in HTML files).
So even without exporting (what included the servlet api in the build
path) the application runs now.
In the end, it was all my fault. Sorry for bothering you.
Larry Isaacs schrieb:
> I'm not clear to me exactly how this is fixing the problem since I'm not
> sure exactly what the cause of the error was. However, since you
> mention maven, it seems conceivable that Bug 242476[1] might be
> contributing to this issue, assuming you aren't already using WTP 3.0.2.
> What is the difference in the contents of the webapp's WEB-INF/lib with
> and without exporting all maven dependencies?
>
> Cheers,
> Larry
>
> [1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=242476
>
> Dominik Raymann wrote:
>> Here's what I found out (and what solved the problem):
>> The project I am referencing to is a maven project. If I export (via
>> Java Build Path, Order and Export) all maven dependencies (and
>> therefore the servlet api too) the error is gone and my web project
>> (not being a maven project) works fine. Unfortunately this export is
>> not automatically checked by the m2eclipse plugin on import. I'm not
>> really sure whether this solution is exactly the best for servlet api
>> & Co. But it works.
>>
>> By the way, what is the difference between referencing a project via
>> the "Java EE Module Dependency" and referencing it via the "Java Build
>> Path"/"Projects" tab?
>>
>> Cheers,
>>
>> Dominik
>>
>> Larry Isaacs schrieb:
>>> Dominik Raymann wrote:
>>>> Hi,
>>>>
>>>> I have a webproject with a "J2EE Module Dependency" to a project
>>>> that contains the actual servlet (this servlet is quite generic and
>>>> can be used in different webprojects). If I try to run the
>>>> webproject on the server (Tomcat 6.0), I get an error saying that
>>>> the class javax.servlet.http.HttpServlet cannot be found
>>>> (java.lang.NoClassDefFoundError: HttpServlet). The error appears
>>>> whether "Serve modules without publishing" is checked or not.
>>>>
>>>> Is this a classloader problem?
>>>
>>> Yes.
>>>
>>>> Is there a way to circumvent it?
>>>
>>> Probably. However, there isn't much here with which to make a guess
>>> as to the exact cause and how to fix. Maybe the stacktrace
>>> associated with the error will provide some clues.
>>>
>>> Cheers,
>>> Larry
>>>
>>>>
>>>> Cheers,
>>>>
>>>> Dominik
|
|
|
Powered by
FUDForum. Page generated in 0.02946 seconds