Re: Can Tomcat ignore overridden jar

2019-07-29 Thread Jmeter Tea
Thanks Konstantin Kolinko for feature refernce,
We are uploading jar(s) only, is it still relevant?

On Mon, Jul 29, 2019 at 4:06 PM Konstantin Kolinko 
wrote:

> вс, 28 июл. 2019 г. в 09:26, Jmeter Tea :
> >
> > We are using Tomcat 8.5 *without any hot deploy*,
> >
> > I assume that classes are loaded to memory and for example if class
> change
> > in jar it will ignore (not hot deploy)
>
> Mark have already answered your question.
>
> Adding to that: I think you should consider using the "parallel
> deployment" feature. You can deploy a new version of your application
> in parallel with the old one.
>
>
> http://tomcat.apache.org/tomcat-8.5-doc/config/context.html#Parallel_deployment
>
> Best regards,
> Konstantin Kolinko
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


Re: Can Tomcat ignore overridden jar

2019-07-29 Thread Konstantin Kolinko
вс, 28 июл. 2019 г. в 09:26, Jmeter Tea :
>
> We are using Tomcat 8.5 *without any hot deploy*,
>
> I assume that classes are loaded to memory and for example if class change
> in jar it will ignore (not hot deploy)

Mark have already answered your question.

Adding to that: I think you should consider using the "parallel
deployment" feature. You can deploy a new version of your application
in parallel with the old one.

http://tomcat.apache.org/tomcat-8.5-doc/config/context.html#Parallel_deployment

Best regards,
Konstantin Kolinko

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



Re: Can Tomcat ignore overridden jar

2019-07-29 Thread Mark Thomas
On 28/07/2019 07:26, Jmeter Tea wrote:
> We are using Tomcat 8.5 *without any hot deploy*,
> 
> I assume that classes are loaded to memory and for example if class change
> in jar it will ignore (not hot deploy)

Correct. But, classes are only loaded as needed. Tomcat does not load
every class in a JAR when the web application starts. And only classes
are loaded into memory. Other resources may be read from the JAR as
required and NOT cached.

> But if we override a jar when application is running it overrides classes
> (or removing it)

Yes, for classes that haven't yet been loaded.

> For example when I copy empty jar it throws ZipException for classes that
> were in the jar:

No, that is not what is happening here. Your code is using the
ServiceLoader which means each JAR's META-INF directory will be searched
for service definitions. The empty JAR file is triggering the error.

> java.lang.IllegalStateException: java.util.zip.ZipException: zip file is empty
> at 
> org.apache.catalina.webresources.AbstractSingleArchiveResourceSet.getArchiveEntry(AbstractSingleArchiveResourceSet.java:97)
> at 
> org.apache.catalina.webresources.AbstractArchiveResourceSet.getResource(AbstractArchiveResourceSet.java:260)
> at 
> org.apache.catalina.webresources.StandardRoot.getResourcesInternal(StandardRoot.java:327)
> at 
> org.apache.catalina.webresources.CachedResource.validateResources(CachedResource.java:127)
> at org.apache.catalina.webresources.Cache.getResources(Cache.java:147)
> at 
> org.apache.catalina.webresources.StandardRoot.getResources(StandardRoot.java:315)
> at 
> org.apache.catalina.webresources.StandardRoot.getClassLoaderResources(StandardRoot.java:231)
> at 
> org.apache.catalina.loader.WebappClassLoaderBase.findResources(WebappClassLoaderBase.java:939)
> at java.lang.ClassLoader.getResources(ClassLoader.java:1142)
> at 
> java.util.ServiceLoader$LazyIterator.hasNextService(ServiceLoader.java:348)
> at 
> java.util.ServiceLoader$LazyIterator.hasNext(ServiceLoader.java:393)
> at java.util.ServiceLoader$1.hasNext(ServiceLoader.java:474)
> at javax.xml.parsers.FactoryFinder$1.run(FactoryFinder.java:293)
> at java.security.AccessController.doPrivileged(Native Method)
> at 
> javax.xml.parsers.FactoryFinder.findServiceProvider(FactoryFinder.java:289)
> at javax.xml.parsers.FactoryFinder.find(FactoryFinder.java:267)
> at 
> javax.xml.parsers.DocumentBuilderFactory.newInstance(DocumentBuilderFactory.java:120)
> at com.MyHelper.createDoc(MyHelper.java:64)
> 
> Can tomcat ignore overridden jar and pull classes from memory only ?

No.

> Is there some sort of built-in hot deploy I'm not aware of?

No.

> Or is it related to issue specific for tomcat with empty jar opening

No.

Mark

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



Can Tomcat ignore overridden jar

2019-07-28 Thread Jmeter Tea
We are using Tomcat 8.5 *without any hot deploy*,

I assume that classes are loaded to memory and for example if class change
in jar it will ignore (not hot deploy)

But if we override a jar when application is running it overrides classes
(or removing it)

For example when I copy empty jar it throws ZipException for classes that
were in the jar:

java.lang.IllegalStateException: java.util.zip.ZipException: zip file is empty
at 
org.apache.catalina.webresources.AbstractSingleArchiveResourceSet.getArchiveEntry(AbstractSingleArchiveResourceSet.java:97)
at 
org.apache.catalina.webresources.AbstractArchiveResourceSet.getResource(AbstractArchiveResourceSet.java:260)
at 
org.apache.catalina.webresources.StandardRoot.getResourcesInternal(StandardRoot.java:327)
at 
org.apache.catalina.webresources.CachedResource.validateResources(CachedResource.java:127)
at org.apache.catalina.webresources.Cache.getResources(Cache.java:147)
at 
org.apache.catalina.webresources.StandardRoot.getResources(StandardRoot.java:315)
at 
org.apache.catalina.webresources.StandardRoot.getClassLoaderResources(StandardRoot.java:231)
at 
org.apache.catalina.loader.WebappClassLoaderBase.findResources(WebappClassLoaderBase.java:939)
at java.lang.ClassLoader.getResources(ClassLoader.java:1142)
at 
java.util.ServiceLoader$LazyIterator.hasNextService(ServiceLoader.java:348)
at java.util.ServiceLoader$LazyIterator.hasNext(ServiceLoader.java:393)
at java.util.ServiceLoader$1.hasNext(ServiceLoader.java:474)
at javax.xml.parsers.FactoryFinder$1.run(FactoryFinder.java:293)
at java.security.AccessController.doPrivileged(Native Method)
at 
javax.xml.parsers.FactoryFinder.findServiceProvider(FactoryFinder.java:289)
at javax.xml.parsers.FactoryFinder.find(FactoryFinder.java:267)
at 
javax.xml.parsers.DocumentBuilderFactory.newInstance(DocumentBuilderFactory.java:120)
at com.MyHelper.createDoc(MyHelper.java:64)

Can tomcat ignore overridden jar and pull classes from memory only ?

Is there some sort of built-in hot deploy I'm not aware of?

Or is it related to issue specific for tomcat with empty jar opening