You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Amir Wasim <am...@gmail.com> on 2010/08/18 17:09:11 UTC

loaderClass for jsps

Hi all,

HI, i have a question regarding tomcat class loader

I have configured to load my classes through my custom class loader
and have it configured in my Catalina as follows

	<Loader loaderClass="de.fwsb.loader.EncryptedClassLoader" delegate="true" />

The EncryptedClassLoader extends
org.apache.catalina.loader.WebappClassLoader class.

The web server starts fine, which means the class loader is working
fine, because the server is started through our own contextListner
which is loaded through this class loader.#
The problem is that when i visit the index page i get the following exception,

org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException
        at org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader.<init>(ClassFileReader.java:342)
        at org.apache.jasper.compiler.JDTCompiler$1.findType(JDTCompiler.java:206)
        at org.apache.jasper.compiler.JDTCompiler$1.findType(JDTCompiler.java:178)
        at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:122)
        at org.eclipse.jdt.internal.compiler.lookup.PackageBinding.getTypeOrPackage(PackageBinding.java:178)
        at org.eclipse.jdt.internal.compiler.lookup.Scope.getPackage(Scope.java:2101)
        at org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.getTypeBinding(QualifiedTypeReference.java:69)
        at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:134)
        at org.eclipse.jdt.internal.compiler.ast.LocalDeclaration.resolve(LocalDeclaration.java:138)
        at org.eclipse.jdt.internal.compiler.ast.Block.resolveUsing(Block.java:115)
        at org.eclipse.jdt.internal.compiler.ast.TryStatement.resolve(TryStatement.java:799)
        at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:429)
        at org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:196)
        at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:400)


Which basically means that the classes referenced in the jsp are not
being loaded through this custom class loader. Can someone please let
me know how to configure it so that the classes in JSPs are also
loaded through this class loader


Regards
-- 
Amir Wasim

PS: My tomcat version is 6.0.20 using jdk1.6.0_18 and Windows 7

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


Re: loaderClass for jsps

Posted by Pid <pi...@pidster.com>.
On 18/08/2010 16:38, Konstantin Kolinko wrote:
> 2010/8/18 Pid <pi...@pidster.com>:
>> On 18/08/2010 16:09, Amir Wasim wrote:
>>> org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException
>>>         at org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader.<init>(ClassFileReader.java:342)
>>>         at org.apache.jasper.compiler.JDTCompiler$1.findType(JDTCompiler.java:206)
>>>         at org.apache.jasper.compiler.JDTCompiler$1.findType(JDTCompiler.java:178)
>>>
>>>
>>> Which basically means that the classes referenced in the jsp are not
>>> being loaded through this custom class loader. Can someone please let
>>> me know how to configure it so that the classes in JSPs are also
>>> loaded through this class loader
>>
>> That seems like an Eclipse specific question, rather than a Tomcat one.
>>
>> The Eclipse IDE uses a custom config when launching apps in Tomcat,
>> you'll have to track down where that config is and adjust it if possible.
>>
> 
> It is not Eclipse IDE, but Eclipse JDT compiler called by Jasper (see
> jasper-jdt.jar in TC distribution).
> 
> Back to the question:
> Jsp classes are loaded by org.apache.jasper.servlet.JasperLoader. You
> can start digging from there.

Oh, yes.  Doh.

(more coffee, Pid, more coffee).


p

> Best regards,
> Konstantin Kolinko
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 


Re: loaderClass for jsps

Posted by Konstantin Kolinko <kn...@gmail.com>.
2010/8/18 Pid <pi...@pidster.com>:
> On 18/08/2010 16:09, Amir Wasim wrote:
>> org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException
>>         at org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader.<init>(ClassFileReader.java:342)
>>         at org.apache.jasper.compiler.JDTCompiler$1.findType(JDTCompiler.java:206)
>>         at org.apache.jasper.compiler.JDTCompiler$1.findType(JDTCompiler.java:178)
>>
>>
>> Which basically means that the classes referenced in the jsp are not
>> being loaded through this custom class loader. Can someone please let
>> me know how to configure it so that the classes in JSPs are also
>> loaded through this class loader
>
> That seems like an Eclipse specific question, rather than a Tomcat one.
>
> The Eclipse IDE uses a custom config when launching apps in Tomcat,
> you'll have to track down where that config is and adjust it if possible.
>

It is not Eclipse IDE, but Eclipse JDT compiler called by Jasper (see
jasper-jdt.jar in TC distribution).

Back to the question:
Jsp classes are loaded by org.apache.jasper.servlet.JasperLoader. You
can start digging from there.

Best regards,
Konstantin Kolinko

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


Re: loaderClass for jsps

Posted by Pid <pi...@pidster.com>.
On 18/08/2010 16:09, Amir Wasim wrote:
> Hi all,
> 
> HI, i have a question regarding tomcat class loader
> 
> I have configured to load my classes through my custom class loader
> and have it configured in my Catalina as follows
> 
> 	<Loader loaderClass="de.fwsb.loader.EncryptedClassLoader" delegate="true" />
> 
> The EncryptedClassLoader extends
> org.apache.catalina.loader.WebappClassLoader class.
> 
> The web server starts fine, which means the class loader is working
> fine, because the server is started through our own contextListner
> which is loaded through this class loader.#
> The problem is that when i visit the index page i get the following exception,
> 
> org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException
>         at org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader.<init>(ClassFileReader.java:342)
>         at org.apache.jasper.compiler.JDTCompiler$1.findType(JDTCompiler.java:206)
>         at org.apache.jasper.compiler.JDTCompiler$1.findType(JDTCompiler.java:178)
>         at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:122)
>         at org.eclipse.jdt.internal.compiler.lookup.PackageBinding.getTypeOrPackage(PackageBinding.java:178)
>         at org.eclipse.jdt.internal.compiler.lookup.Scope.getPackage(Scope.java:2101)
>         at org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.getTypeBinding(QualifiedTypeReference.java:69)
>         at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:134)
>         at org.eclipse.jdt.internal.compiler.ast.LocalDeclaration.resolve(LocalDeclaration.java:138)
>         at org.eclipse.jdt.internal.compiler.ast.Block.resolveUsing(Block.java:115)
>         at org.eclipse.jdt.internal.compiler.ast.TryStatement.resolve(TryStatement.java:799)
>         at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:429)
>         at org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:196)
>         at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:400)
> 
> 
> Which basically means that the classes referenced in the jsp are not
> being loaded through this custom class loader. Can someone please let
> me know how to configure it so that the classes in JSPs are also
> loaded through this class loader

That seems like an Eclipse specific question, rather than a Tomcat one.

The Eclipse IDE uses a custom config when launching apps in Tomcat,
you'll have to track down where that config is and adjust it if possible.


p