2014-02-18 11:44 GMT+01:00 Mark Thomas <ma...@apache.org>:
> Again, please stop top posting.
>
> On 18/02/2014 10:14, Romain Manni-Bucau wrote:
>> let say we have an interface Foo. I deploy a war with Foo and FooImpl.
>> In the since I'm in embedded mode I can get FooImpl casting it to Foo.
>> Foo has been loaded from the Junit JVM for instance and FooImpl from
>> the webapp cause we use a framework (spring, CDI, ...). The cast will
>> fail cause FooImpl will use Foo from the webapp.
>
> In which case you need either:
>
> a) Have Foo treated as a Java SE provided class. Adding the JAR
> containing Foo to the endorsed dir rather than the class path should work.

This is a workaround, not a solution. Think to new Tomcat() in JUnit at least.

>
> b) Have Foo treated as a container provided class and filter it out via
> WebappClassLoader.filter(String)
>

Thought filtering system classes like before in filter but then there
are 2 filtering which makes performances very bad so I'd prefer to be
able to override j2seClassLoader.

>> It was working fine before and it was convenient. By default you don't
>> add jars in tomcat system loader so the behavior of tomcat was fine +
>> in unit test of embedded mode it was convenient so I dont get the
>> point changing it.
>
> The point of changing it was:
>
> - fixing the reported bug
> - have the actual behaviour align with the documented / spec required
> behaviour
>
> There was nothing in either the spec or the docs that required Tomcat to
> prevent web applications overridding a class on the system class path.
>

Nothing forces it to be done so IMO it should be configurable and not
the default behavior for backward compatibility (spoken of v7).

> Switching to using the endorsed dir looks like the simplest solution to
> me and it should work for Tomcat versions before and after the BZ 55943
> change.
>
> Other possible solutions include:
> - removing the final from j2seClassLoader / always accessing it via an
> over-ridable getter() (I'd recommend checking that that will work for
> you as the other related changes may also cause problems)


I set by reflection j2seClassLoader it solved this particular issue.

> - making it possible to add to the packages used to define the filter
> for container classes

Not enough since user classes should get this bahavior too in embedded
case (I don't say that's good but common, convenient and done so we
need to leave with it).

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

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

Reply via email to