0

I tried to build a Dropwizard app and when i tried to execute it using mvn exec:java after including

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>exec-maven-plugin</artifactId>
    <version>1.6.0</version>
        <configuration>
            <mainClass>${mainClass}</mainClass> //the application java class from properties tag 
            <arguments>
                <argument>server</argument>
            </arguments>
      </configuration>
</plugin>

in command prompt when using the mvn command > mvn exec:java expected it to build and deploy it, instead got the below issue

[INFO] --- exec-maven-plugin:1.6.0:java (default-cli) @ hello-dropwizard ---
[WARNING]
java.lang.ArrayIndexOutOfBoundsException: 1
        at org.hibernate.validator.internal.util.Version.getJavaRelease(Version.java:36)
        at org.hibernate.validator.internal.engine.ConfigurationImpl.<init>(ConfigurationImpl.java:120)
        at org.hibernate.validator.internal.engine.ConfigurationImpl.<init>(ConfigurationImpl.java:106)
        at org.hibernate.validator.HibernateValidator.createSpecializedConfiguration(HibernateValidator.java:27)
        at org.hibernate.validator.HibernateValidator.createSpecializedConfiguration(HibernateValidator.java:24)
        at javax.validation.Validation$ProviderSpecificBootstrapImpl.configure(Validation.java:220)
        at io.dropwizard.validation.BaseValidator.newConfiguration(BaseValidator.java:28)
        at io.dropwizard.jersey.validation.Validators.newConfiguration(Validators.java:35)
        at io.dropwizard.jersey.validation.Validators.newValidatorFactory(Validators.java:27)
        at io.dropwizard.setup.Bootstrap.<init>(Bootstrap.java:68)
        at io.dropwizard.Application.run(Application.java:72)
        at com.dropwizard.demo.HeloDropWizardApplication.main

Is there any reason for this behaviour?

Tim
  • 1,321
  • 1
  • 22
  • 47

1 Answers1

0

Noticed that i had java 9 installed in the system, with little research on the hibernate validator class, it expects 8 to be returned since i had 9 the version was not returned in a specific way as the below code

String[] specificationVersion = System.getProperty( "java.specification.version" ).split( "\\." );
return Integer.parseInt( specificationVersion[1] );

I have changed the PATH to include the java 1.8 path even then maven threw same exception. I have to use > mvn package then use > java -jar target\dropwizarddemo.jar server

Tim
  • 1,321
  • 1
  • 22
  • 47