You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Lmhelp1 <lm...@orange.fr> on 2015/03/29 15:57:37 UTC
ClassNotFoundException - Involving a class implementing Filter and
two projects depending on another one
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.
Best regards.
--
Léa Massiot
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: ClassNotFoundException - Involving a class implementing Filter
and two projects depending on another one
Posted by Lmhelp1 <lm...@orange.fr>.
On 3/29/2015 6:57 PM, Tim Watts-3 [via Tomcat] wrote:
> On Sun, 2015-03-29 at 18:06 +0200, Lmhelp1 wrote:
>
> > 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
>
> In Eclipse, try Project / Properties / Deployment Assembly. Add project
> 'project3'. It should add project3's resulting jar file to WEB-INF/lib
> or resulting classes to WEB-INF/classes depending on how project3 is
> configured.
>
> Note that I'm using the Maven plug-in so this may be a consequent
> feature of the plug-in, I'm not sure.
It solves my problem.
Thank you very much :).
Apparently, "project3.jar" files are being put in:
eclipse\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\project1\WEB-INF\lib
eclipse\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\project2\WEB-INF\lib
for "project1" and "project2" respectively...
Best regards.
--
Léa
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: ClassNotFoundException - Involving a class implementing Filter
and two projects depending on another one
Posted by Léa Massiot <lm...@orange.fr>.
On 3/30/2015 2:36 AM, Tim Watts-3 [via Tomcat] wrote:
> On Sun, 2015-03-29 at 12:56 -0400, Tim Watts wrote:
>
> > On Sun, 2015-03-29 at 18:06 +0200, Lmhelp1 wrote:
> > > 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
> >
> > In Eclipse, try Project / Properties / Deployment Assembly. Add
> project
> > 'project3'. It should add project3's resulting jar file to WEB-INF/lib
> > or resulting classes to WEB-INF/classes depending on how project3 is
> > configured.
>
> UPDATE: The 2nd part of that sentence is not true; it will always add
> the resulting jar file of project3. However, it will create jar file on
> the fly when the webapp is re/deployed OR when project3 is modified.
>
> Keep in mind that this is simply a quick & dirty way of testing the app
> from within Eclipse and NOT suitable for building a deployable war file.
> You should use Maven or Ant or etc. for that.
Ok. Thank you.
--
Léa
--
View this message in context: http://tomcat.10.x6.nabble.com/ClassNotFoundException-Involving-a-class-implementing-Filter-and-two-projects-depending-on-another-oe-tp5032615p5032638.html
Sent from the Tomcat - User mailing list archive at Nabble.com.
Re: ClassNotFoundException - Involving a class implementing Filter
and two projects depending on another one
Posted by Tim Watts <ti...@cliftonfarm.org>.
On Sun, 2015-03-29 at 12:56 -0400, Tim Watts wrote:
> On Sun, 2015-03-29 at 18:06 +0200, Lmhelp1 wrote:
> > 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
>
> In Eclipse, try Project / Properties / Deployment Assembly. Add project
> 'project3'. It should add project3's resulting jar file to WEB-INF/lib
> or resulting classes to WEB-INF/classes depending on how project3 is
> configured.
UPDATE: The 2nd part of that sentence is not true; it will always add
the resulting jar file of project3. However, it will create jar file on
the fly when the webapp is re/deployed OR when project3 is modified.
Keep in mind that this is simply a quick & dirty way of testing the app
from within Eclipse and NOT suitable for building a deployable war file.
You should use Maven or Ant or etc. for that.
>
> Note that I'm using the Maven plug-in so this may be a consequent
> feature of the plug-in, I'm not sure.
This feature does not appear to require the Maven plug-in.
>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: ClassNotFoundException - Involving a class implementing Filter
and two projects depending on another one
Posted by Tim Watts <ti...@cliftonfarm.org>.
On Sun, 2015-03-29 at 18:06 +0200, Lmhelp1 wrote:
> 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
In Eclipse, try Project / Properties / Deployment Assembly. Add project
'project3'. It should add project3's resulting jar file to WEB-INF/lib
or resulting classes to WEB-INF/classes depending on how project3 is
configured.
Note that I'm using the Maven plug-in so this may be a consequent
feature of the plug-in, I'm not sure.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: ClassNotFoundException - Involving a class implementing Filter
and two projects depending on another one
Posted by Lmhelp1 <lm...@orange.fr>.
On 3/29/2015 6:06 PM, Lmhelp1 wrote:
> 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
Me again.
Maybe the "problem" is within the "web.xml" file.
For example, let's consider the following line in the "web.xml" file of
"project1":
<filter-class>my.package.MyFilter</filter-class>
If, at runtime, the class file "MyFilter.class" is being looked for in
the "classes/" directory of "project1",
it is clear it won't be found because it is in the "bin/" directory of
"project3"...
Maybe we should tell "project1", in its "web.xml", that the class
"MyFilter" is in "project3", not in "project1"...
--
Léa
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: ClassNotFoundException - Involving a class implementing Filter
and two projects depending on another one
Posted by Lmhelp1 <lm...@orange.fr>.
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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: ClassNotFoundException - Involving a class implementing Filter
and two projects depending on another one
Posted by André Warnier <aw...@ice-sa.com>.
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 ?
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org