On 3/29/2015 5:36 PM, André Warnier [via Tomcat] wrote:
Lmhelp1 wrote:

> Hello,
>
> Thank you for reading my post.
>
> I am getting a "ClassNotFoundException".
>
> Below is the situation.
> - I'm working with "Eclipse" ("Luna"), "Tomcat 8" and "Java 8".
> - I have three projects "project1", "project2" and "project3".
> - "project1" and "project2" depend on the third project "project3".
>   In "Project -> Properties -> Java Build Path -> Projects", I added
> "project3" for both projects "project1" and "project2".
> - "project3" is a "Java project".
> - "project1" and "project2" are "Dynamic Web Projects".
> - "project3" defines the class "MyFilter" which implements "Filter" and
> which I put in the package "my.package".
> - "project1" contains a "web.xml" file which contains the following
> elements:
>   [...]
>   <filter>
>     <filter-name>MyFilter</filter-name>
> <filter-class>my.package.MyFilter</filter-class>
>     <init-param>
>       <param-name>requestEncoding</param-name>
>       <param-value>UTF-8</param-value>
>     </init-param>
>   </filter>
>   <filter-mapping>
>     <filter-name>MyFilter</filter-name>
>     <url-pattern>/*</url-pattern>
>   </filter-mapping>
>   [...]
> - "project2" contains a "web.xml" file which contains the following
> elements (same as in "project 1"):
>   [...]
>   <filter>
>     <filter-name>MyFilter</filter-name>
> <filter-class>my.package.MyFilter</filter-class>
>     <init-param>
>       <param-name>requestEncoding</param-name>
>       <param-value>UTF-8</param-value>
>     </init-param>
>   </filter>
>   <filter-mapping>
>     <filter-name>MyFilter</filter-name>
>     <url-pattern>/*</url-pattern>
>   </filter-mapping>
>   [...]
>
> When running a JSP of "project1" on the "Tomcat" server, I get the error:
> SEVERE: Exception starting filter MyFilter
> java.lang.ClassNotFoundException: my.package.MyFilter
>
> There are no errors at build time.
>
> I just would like to mention that I'm working with "Tomcat 8" for the
> first time.
> It used to work with "Tomcat 7" but I might have done something more to
> make it work... I don't remember what...
>
> What can I do to solve that problem?
> Please let me know if you need additional information or if I'm not
> clear enough.
>

I do not really know how to translate this for Eclipse but if this was a stand-alone Tomcat, the way you describe it above, project1 and project2 (when deployed) should also
have the class available under their respective
(catalina_base)/webapps/projectX/WEB-INF/classes/ directory (or /WEB-INF/classes/lib/, if
in a jar). Is it the case ?

Thank you for your answer.

No, it is not the case.
- There are no ".class" files from "project3" under "classes" directories for the two projects "project1" and "project2". - I didn't make a ".jar" file out of "project3" because I don't want to have to do it every time I change the code of the classes in "project3"...

Note - If I do not add "project3" via "Project -> Properties -> Java Build Path -> Projects" for both projects "project1" and "project2" I get hundreds of errors. So clearly this is a required setting...
I don't know what is missing...

Thank you for helping me.
Best regards.
--
Léa

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to