In WEB-INF/lib i only have 2 JARs, which are my application JAR’s. All other 
dependent JAR’s i have moved to /mylibs.

Below mentioned com.myapp.CustomGrantedAuth class is part of my application JAR 
present under WEB-INF/lib.

Here is the stack trace:

DEBUG [http-nio-8080-exec-3] (DefaultExceptionHandler.java:123) - error.
java.lang.IllegalArgumentException: java.lang.ClassNotFoundException: 
com.myapp.CustomGrantedAuth
        at 
org.springframework.security.oauth2.common.util.SerializationUtils.deserialize(SerializationUtils.java:36)
        at 
com.arl.mg.services.CustomTokenStore$2.mapRow(CustomTokenStore.java:124)
        at 
com.arl.mg.services.CustomTokenStore$2.mapRow(CustomTokenStore.java:1)
        at 
org.springframework.jdbc.core.RowMapperResultSetExtractor.extractData(RowMapperResultSetExtractor.java:93)
        at 
org.springframework.jdbc.core.RowMapperResultSetExtractor.extractData(RowMapperResultSetExtractor.java:60)
        at 
org.springframework.jdbc.core.JdbcTemplate$1.doInPreparedStatement(JdbcTemplate.java:708)
        at 
org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:644)
        at 
org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:695)
        at 
org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:727)
        at 
org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:737)
        at 
org.springframework.jdbc.core.JdbcTemplate.queryForObject(JdbcTemplate.java:811)
        at 
com.arl.mg.services.CustomTokenStore.readAuthentication(CustomTokenStore.java:121)
        at 
com.arl.mg.services.CustomTokenServices.loadAuthentication(CustomTokenServices.java:139)
        at 
org.springframework.security.oauth2.provider.filter.OAuth2ProtectedResourceFilter.doFilter(OAuth2ProtectedResourceFilter.java:53)
        at 
org.springframework.security.oauth2.provider.filter.CompositeFilter$VirtualFilterChain.doFilter(CompositeFilter.java:79)
        at 
com.arl.mg.error.CustomExceptionHandlerFilter.doFilter(CustomExceptionHandlerFilter.java:59)
        at 
org.springframework.security.oauth2.provider.filter.CompositeFilter$VirtualFilterChain.doFilter(CompositeFilter.java:79)
        at 
org.springframework.security.oauth2.provider.filter.CompositeFilter.doFilter(CompositeFilter.java:59)
        at 
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
        at 
org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
        at 
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
        at 
org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)
        at 
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
        at 
org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
        at 
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
        at 
org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:139)
        at 
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
        at 
org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154)
        at 
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
        at 
org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)
        at 
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
        at 
org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199)
        at 
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
        at 
org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50)
        at 
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
        at 
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
        at 
org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
        at 
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
        at 
org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
        at 
org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
        at 
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)
        at 
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
        at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
        at 
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
        at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
        at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
        at 
org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:617)
        at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
        at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
        at 
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
        at 
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:668)
        at 
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1521)
        at 
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1478)
        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at 
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: com.myapp.CustomGrantedAuth
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:348)
        at java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:626)
        at 
java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1613)
        at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1518)
        at 
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1774)
        at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:371)
        at java.util.ArrayList.readObject(ArrayList.java:791)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at 
java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1017)
        at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1896)
        at 
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801)
        at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)
        at 
java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1993)
        at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1918)
        at 
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801)
        at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)
        at 
java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1993)
        at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1918)
        at 
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801)
        at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:371)
        at 
org.springframework.security.oauth2.common.util.SerializationUtils.deserialize(SerializationUtils.java:32)
        ... 59 more
DEBUG [http-nio-8080-exec-3] (ExceptionTranslationFilter.java:115) - Chain 
processed normally



> On 26-May-2015, at 3:17 pm, Mark Thomas <ma...@apache.org> wrote:
> 
> On 26/05/2015 10:44, Aditya Chopra wrote:
>> Thanks for quick response Mark.
>> 
>> JARs in /mylib are not dependent on JARs in web app. In fact its the other 
>> way round. /mylib is having all Spring, hibernate jar’s, other common libs 
>> and WEB-INF/lib is containing jar of one of my application modules.
>> The class for which i am getting ClassNotFoundException exception is part of 
>> JAR present under WEB-INF/lib.
>> 
>> I enabled the class loader logs and don’t see that class getting loaded on 
>> server startup. However, when i copy all JAR’s from /mylib to WEB-INF/lib, 
>> that class is getting loaded and i don’t get the ClassNotFoundException on 
>> runtime.
>> 
>> Any thoughts what might be causing this?
> 
> Yes. One of the JARs in /mylib depends on one of the JARs in WEB-INF/lib
> and that is not permitted.
> 
> The dependency may not be obvious. If you provide the full stack trace
> we might be able to provide you with some pointers.
> 
> Mark
> 
>> 
>> Aditya
>> 
>>> On 26-May-2015, at 3:04 pm, Mark Thomas <ma...@apache.org> wrote:
>>> 
>>> On 26/05/2015 08:36, Aditya Chopra wrote:
>>>> Hi,
>>>> 
>>>> To reduce the size of my war file, i am trying to put all the jar files 
>>>> being used by my web app in a separate folder /mylibs. I added path to 
>>>> /mylibs folder under shared.loader property in catalina.properties but on 
>>>> runtime i am getting a ClassNotFoundException for one of the classes that 
>>>> is present in one the project module jar under WEB-INF/lib folder.
>>>> 
>>>> When i add all the libraries required by my project in WEB-INF/lib folder 
>>>> my application works fine. However, when i put the libraries in a separate 
>>>> /mylibs folder i get a ClassNotFoundException on runtime. 
>>>> 
>>>> I suspect that it could be due to order in which the classes are being 
>>>> loaded, so added a Loader component in my context.xml as below, but that 
>>>> too didn’t work. Can someone please help me on this?
>>> 
>>> JARs in /mylibs must not depend on JARs in a web application. There is
>>> no configuration option that would enable you to bypass this restriction.
>>> 
>>> Mark
>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>>> For additional commands, e-mail: users-h...@tomcat.apache.org
>>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: users-h...@tomcat.apache.org
>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 

Reply via email to