2

there I'm getting this during Spring Boot deployment to GF3,4 although it is know problem see

spring boot problem

another

there is nowhere solution to be found, except for the hack with try/catch in GF sources.

The whole problem is about @Conditional... Spring-Boot annotations, which holds classes references that are not on CP and this GF check disables the usage of Spring-Boot.

I don't want to abandon Spring-Boot, but switching off @EnableAutoconfiguration is not working, exclude auto-config classes in the annotation does not work either. Is there a way around(throw away all auto-configs) or I am doomed and need to fall back to vanilla Spring?????

Everybody is giving hands away as it seems to be GF problem. Any hack advice appreciated.

WARNING|glassfish3.1.2|global|_ThreadID=86;_ThreadName=Thread-2;|Error in annotation processing: java.lang.NoClassDefFoundError: org/springframework/batch/core/configuration/annotation/BatchConfigurer|#]

WARNING|glassfish3.1.2|global|_ThreadID=86;_ThreadName=Thread-2;|Error in annotation processing: java.lang.NoClassDefFoundError: org/springframework/batch/core/configuration/annotation/BatchConfigurer|#]

SEVERE|glassfish3.1.2|global|_ThreadID=86;_ThreadName=Thread-2;|Class [ org/apache/solr/client/solrj/SolrServer ] not found. Error while loading [ class org.springframework.boot.autoconfigure.solr.SolrAutoConfiguration ]|#]

SEVERE|glassfish3.1.2|global|_ThreadID=86;_ThreadName=Thread-2;|Class [ liquibase/integration/spring/SpringLiquibase ] not found. Error while loading [ class org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfiguration$LiquibaseConfiguration ]|#]

SEVERE|glassfish3.1.2|javax.enterprise.system.core.com.sun.enterprise.v3.server|_ThreadID=86;_ThreadName=Thread-2;|Exception while deploying the app [PaySafeCardConnector-1.0-SNAPSHOT]|#]

SEVERE|glassfish3.1.2|javax.enterprise.system.core.com.sun.enterprise.v3.server|_ThreadID=86;_ThreadName=Thread-2;|sun.reflect.annotation.TypeNotPresentExceptionProxy
java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
    at sun.reflect.annotation.AnnotationParser.parseClassArray(AnnotationParser.java:715)
    at sun.reflect.annotation.AnnotationParser.parseArray(AnnotationParser.java:522)
    at sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:348)
Zveratko
  • 2,663
  • 6
  • 35
  • 64
  • I am using jhipster for generating my spring-boot project. After many tries and differrent glassfish versions, the war was deployed successfully after adding a glassfish-web.xml file in the WEB-INF directory and adding the following configuration: I still get some exceptions ( *java.lang.ClassNotFoundException: org.sprin – Nikos May 02 '17 at 10:31

2 Answers2

4

The problem's due to a bug in GlassFish. The addition of the try-catch in GlassFish isn't a hack, in my opinion. It's making GlassFish's annotation handling more robust and bringing it into line with other Java EE servers such as WildFly and TomEE.

If you're happy to get your hands dirty you could try applying the patch in that issue or using the Payara download that's linked to in the issue. Failing that, to continue using Spring Boot you'll have to move away from GlassFish, either to another Java EE server or to an embedded container (Spring Boot supports Tomcat, Jetty, and Undertow).

Andy Wilkinson
  • 108,729
  • 24
  • 257
  • 242
  • This is the crazy thing about it. As our production servers are unlikely to change I'm forced to leave Spring Boot with all it's candy. I did some research, excluding autoconfigure in maven and disable @EnableAutoConfiguration, did the trick, but only partially. Spring Boot striped to the bone, doesn't have so much additional value. So sadly now I'm on Spring only, throwing away my embedded server tests and nice and easy configuration. Anyway as I know there is possibility to use String names in Spring Boot annotations. Maybe Spring Boot guys should consider that as possible help for GF users. – Zveratko Feb 26 '15 at 11:40
  • @Andy Update bug Link to https://github.com/javaee/glassfish/issues/21265 if iam correct. – SAMUEL Aug 11 '17 at 08:45
4

You can get around this by putting metadata-complete="true" in your web.xml, which tells glassfish to not process the annotations, as the app has already done so.

This fixes the java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy and will, for example, allow the example Spring Boot war application that Spring provide to deploy and run successfully.