Spring Boot Start Up error java.util.zip.ZipException: invalid stored block lengths - spring

I created a new Spring Started project from the online spring boot application generator and getting below Spring Boot Start Up error which is Caused by java.util.zip.ZipException invalid stored block lengths
org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:94) ~[paymentbatch-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_111]
... 40 common frames omitted
Caused by: java.util.zip.ZipException: invalid stored block lengths
at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:164) ~

Some problem in the maven dependencies being corrupted. Deleting maven repository and rebuilding (mvn clean install) the app fixed the issue.

Related

Grails Project Suddenly Missing Dependencies

I use multiple grails projects for various reporting and API related tasks. Yesterday when trying to build my projects I started getting various errors related to missing dependencies. I made no code changes to prompt these missing dependencies, some of which are coming from other packages that have been in use for years in my projects without ever complaining of these missing dependencies. Here is a sample of some of such errors:
C:\Users\Public\Grails3\fitment-app\grails-app\controllers\com\gammapowersports\FitmentProductController.groovy: 11: unable to resolve class org.apache.commons.io.FileUtils
And another:
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [grails.boot.config.GrailsApplicationPostProcessor]: Factory method 'grailsApplicationPostProcessor' threw exception; nested exception is org.grails.core.exceptions.GrailsRuntimeException: Failed to introspect class: class grails.plugin.springsecurity.rest.JwtService
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
... 23 common frames omitted
Caused by: org.grails.core.exceptions.GrailsRuntimeException: Failed to introspect class: class grails.plugin.springsecurity.rest.JwtService
at grails.core.ArtefactHandlerAdapter.isArtefact(ArtefactHandlerAdapter.java:129)
at grails.core.DefaultGrailsApplication.addOverridableArtefact(DefaultGrailsApplication.java:772)
at org.grails.plugins.AbstractGrailsPluginManager.registerProvidedArtefacts(AbstractGrailsPluginManager.java:310)
at grails.boot.config.GrailsApplicationPostProcessor.performGrailsInitializationSequence(GrailsApplicationPostProcessor.groovy:110)
at grails.boot.config.GrailsApplicationPostProcessor.initializeGrailsApplication(GrailsApplicationPostProcessor.groovy:93)
at grails.boot.config.GrailsApplicationPostProcessor.setApplicationContext(GrailsApplicationPostProcessor.groovy:225)
at grails.boot.config.GrailsApplicationPostProcessor.<init>(GrailsApplicationPostProcessor.groovy:77)
at grails.boot.config.GrailsAutoConfiguration.grailsApplicationPostProcessor(GrailsAutoConfiguration.groovy:69)
at com.gammapowersports.Application.grailsApplicationPostProcessor(Application.groovy)
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:498)
at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1426)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
... 24 common frames omitted
I can solve these errors by adding dependencies to satisfy the dependencies specifically, which I have done to get my projects building again.
My question is why did these dependencies suddenly start failing? I'm wondering if it is related to the migration away from Bintray as the main plugin provider for Grails. Has anyone else experienced these issues?
The most COMMON issue is just that you need to refresh your dependencies. Run this command:
./gradlew clean;./gradlew build --stacktrace --refresh-dependencies
This should give clean your cache and refresh your dependencies.
For the record, bintray has said they will continue to maintain all the old repos/archives but they will not acept any new ones.

Marklogic and Geoserver integration not working

We have successfully generated the jar and placed in the Geoserver lib folder, but could see the below exception.
https://github.com/marklogic-community/marklogic-geotools-plugin/
Caused by: java.lang.ClassNotFoundException:
com.marklogic.client.DatabaseClientFactory$SecurityContext
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1309)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1138)
... 154 more

How to resolve conflict in maven dependencies apache: commons-fileupload 1.3.2 and commons-io 2.5

I have developed an app using jhipster generator. I have only slightly changed the pom.xml file. I needed the commons file-upload to be able to receive multipart requests. I am not sure but i believe that was the only change i have made.
I have only noticed the maven build problems when started trying to build the production image.
My IntelliJ uses bundled maven 2 and it works fine there, but when I switch back to maven 3 bundled or installed in my operating system (windows 7 x64) I receive this error.
Exception in thread "main" java.lang.reflect.InvocationTargetException
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:498)
at org.apache.maven.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:39)
at org.apache.maven.wrapper.WrapperExecutor.execute(WrapperExecutor.java:122)
at org.apache.maven.wrapper.MavenWrapperMain.main(MavenWrapperMain.java:50)
Caused by: java.lang.NoClassDefFoundError: org/apache/maven/exception/ExceptionHandler
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at org.codehaus.plexus.classworlds.launcher.Launcher.getEnhancedMainMethod(Launcher.java:172)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:268)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
... 7 more
Caused by: java.lang.ClassNotFoundException: org.apache.maven.exception.ExceptionHandler
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
... 17 more
I believe one of the reasons my be conflict in my dependencies.
Here is snapshot of intelij analysis of my pom.xml.
[edit 1]
I have gave up trying to resolve this error. So what i tried to do now is to generate a new project with jhipster and copy all custom elements that was created by me into it.
And here i stumbled on a problem, which is i cant really do that, uperantly i have upgraded the jhipster-generator package incorrectly somewhere in the past.
So now on freshly generated projects i receive the same error + in my webapp bunch of files has an error like "ng-jhipster has no exported class AlertService" or the same but instead of AlertService its EventManager or some other class but it`s always the same package. Yes tried upgrading it.
I have found similar classes with Jhi prefixes on them in #ngx-jhipster package so it seams to me as as generator uses classes for one version of jhipster and package.json, pom.xml for another.
I tried upgrading the jhipster-generator, yarn and yo, removing the jhipster-generator dependency altogether and adding them back again, and generating projects again. Nothing worked =(

Exception: Multiple service implementations found for interface DeployableContainer when running Arquillian tests

I'm trying to follow the example project "Feedback" from Continuous Enterprise Development in Java, ch. 3 with a bit of modification.
I am using IntelliJ Idea and its JBoss-Forge plugin which shouldn't differ from using the console like in the book.
So far I've created a new project with the following characteristics:
Java 1.8
JEE 7
Wildfly 10.1.0.Final
JUnit 4.12
Arquillian 1.1.13.0
Hibernate
Maven profile: arquillian-wildfly-remote
I've followed every step from the tutorial, all using the IntelliJ plugin:
set ACCEPT_DEFAULTS true
created the project
set up persistence with Hibernate
set up validation with Hibernate validator
created entity FeedbackEntry
scaffolded the UI
forge install-plugin arquillian
set up Arquillian with Wildfly remote container
created an Arquillian
built and deploy the app
All of them ended successfully, I can open the UI and store some values in the DB. The problem comes when trying to run the test: I create an Wildfly Remote Arquillian container:
After clicking OK this is the stacktrace I get:
java.lang.RuntimeException: Could not create new instance of class org.jboss.arquillian.test.impl.EventTestRunnerAdaptor
at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:166)
at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:103)
at org.jboss.arquillian.test.spi.TestRunnerAdaptorBuilder.build(TestRunnerAdaptorBuilder.java:52)
at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:114)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:51)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:162)
... 8 more
Caused by: org.jboss.arquillian.container.impl.ContainerCreationException: Could not create Container arquillian-wildfly-remote
at org.jboss.arquillian.container.impl.LocalContainerRegistry.create(LocalContainerRegistry.java:85)
at org.jboss.arquillian.container.impl.client.container.ContainerRegistryCreator.createRegistry(ContainerRegistryCreator.java:78)
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:498)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:96)
at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:103)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:85)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:143)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:114)
at org.jboss.arquillian.core.impl.ManagerImpl.bindAndFire(ManagerImpl.java:263)
at org.jboss.arquillian.core.impl.InstanceImpl.set(InstanceImpl.java:74)
at org.jboss.arquillian.config.impl.extension.ConfigurationRegistrar.loadConfiguration(ConfigurationRegistrar.java:73)
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:498)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:96)
at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:103)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:85)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:143)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:114)
at org.jboss.arquillian.core.impl.ManagerImpl.start(ManagerImpl.java:288)
at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.<init>(EventTestRunnerAdaptor.java:63)
... 13 more
Caused by: java.lang.IllegalStateException: Multiple service implementations found for interface org.jboss.arquillian.container.spi.client.container.DeployableContainer. org.jboss.as.arquillian.container.remote.RemoteDeployableContainer, org.arquillian.container.chameleon.ChameleonContainer
at org.jboss.arquillian.core.impl.loadable.ServiceRegistryLoader.onlyOne(ServiceRegistryLoader.java:74)
at org.jboss.arquillian.container.impl.LocalContainerRegistry.create(LocalContainerRegistry.java:76)
... 37 more
Test ignored.
Test ignored.
Process finished with exit code 255
I've searched in many places and I only have found this. However I don't think I have more than 1 container, only Wildfly, so I'm completely clueless about this.
Pom and other key files here: https://gist.github.com/josemigallas/a139fc601b022356391fad5b2ec588b0
Why is this failing and how can I solve/workaround this issue?
From my experience, it might be an issue with Arquillian Plugin or IDEA Maven support having troubles with activating the profile. Please make sure that arquillian-wildfly-remote is in fact enabled by default (if it's ticked then untick and tick it again :)). Also run the test using regular JUnit runner, not the Arquillian one.
I think this is a problem when using IntelliJ with Arquillian support. Can you try to run it from CLI?

Spring Boot 1.4 to 1.5, unable to deploy

I have a very large and working Spring Boot project that is running OK with Boot 1.4.2. When I try to upgrade to 1.5.3 it works from my IDE (Intellij Idea) but it does not work on deployment. It's a Maven project, so I use the "package" directive to generate a WAR file and I get the error bellow on deployment. From what I can see, it says something is missing on the WAR but I even inspected it and the files are there... Any ideas?
Caused by: java.io.FileNotFoundException: file:(...)/target/ultraip-intranet-2.0-RELEASE.war*/WEB-INF/classes/com/ultraip/intranet/entities (No such file or directory)
at java.util.zip.ZipFile.open(Native Method) ~[na:1.8.0_131]
at java.util.zip.ZipFile.<init>(ZipFile.java:219) ~[na:1.8.0_131]
at java.util.zip.ZipFile.<init>(ZipFile.java:149) ~[na:1.8.0_131]
at java.util.jar.JarFile.<init>(JarFile.java:166) ~[na:1.8.0_131]
at java.util.jar.JarFile.<init>(JarFile.java:103) ~[na:1.8.0_131]
at org.springframework.core.io.support.PathMatchingResourcePatternResolver.doFindPathMatchingJarResources(PathMatchingResourcePatternResolver.java:593) ~[spring-core-4.3.8.RELEASE.jar!/:4.3.8.RELEASE]
at org.springframework.core.io.support.PathMatchingResourcePatternResolver.findPathMatchingResources(PathMatchingResourcePatternResolver.java:475) ~[spring-core-4.3.8.RELEASE.jar!/:4.3.8.RELEASE]
at org.springframework.core.io.support.PathMatchingResourcePatternResolver.getResources(PathMatchingResourcePatternResolver.java:279) ~[spring-core-4.3.8.RELEASE.jar!/:4.3.8.RELEASE]
at org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager.buildDefaultPersistenceUnitInfo(DefaultPersistenceUnitManager.java:525) ~[spring-orm-4.3.8.RELEASE.jar!/:4.3.8.RELEASE]
... 105 common frames omitted
Screenshot of the generated WAR file
http://imgur.com/a/5aORQ
A change was made in Tomcat such that it now uses a * as the separator in war:file: URLs. This broke Spring Framework's resource resolution where the * was incorrectly interpreted as a wildcard.
The problem should have been been fixed in Spring Framework 4.3.8 which is used in Spring Boot 1.5.3 but it appears that you have found a case that wasn't considered. Can you please open a Spring Boot issue with a small sample that reproduces the problem?
You don't see the problem when you package your application as a jar file as that stops Tomcat from producing war:file: URLs for resources.

Resources