Spring Roo
  1. Spring Roo
  2. ROO-204 datepicker semi-language dependent
  3. ROO-224

Hibernate Validator dependency on Java 6 causes exception in projects created by Roo on Java 5 machines

    Details

    • Type: Sub-task Sub-task
    • Status: Closed
    • Priority: Major Major
    • Resolution: Complete
    • Affects Version/s: 1.0.0.RC1
    • Fix Version/s: 1.0.0.RC2, 1.1.0.M1
    • Component/s: PERSISTENCE
    • Labels:
      None

      Description

      As originally reported in the comments of ROO-204:

      After initially building roo I saw the following stacktrace after entering a date:
      java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
      at org.hibernate.validation.engine.ConfigurationImpl.parseValidationXml(ConfigurationImpl.java:187)
      at org.hibernate.validation.engine.ConfigurationImpl.buildValidatorFactory(ConfigurationImpl.java:116)
      at javax.validation.Validation.buildDefaultValidatorFactory(Validation.java:109)
      at com.springsource.petclinic.web.OwnerController_Roo_Controller.ajc$interMethod$com_springsource_petclinic_web_OwnerController_Roo_Controller$com_springsource_petclinic_web_OwnerController$cr
      eate(OwnerController_Roo_Controller.aj:18)
      at com.springsource.petclinic.web.OwnerController.create(OwnerController.java:1)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.doInvokeMethod(HandlerMethodInvoker.java:654)

      I was using Java 5 to build and run this. Turns out javax.xml.bind is not present in Java 5, only Java 6. This may be a problem, because roo is supposed to require just Java 5.

        Issue Links

          Activity

          Hide
          Ben Alex added a comment -

          Bug in Hibernate Validator: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4427

          This is being closed as "won't fix" because it is a bug in Hibernate that is known to be corrected in Hibernate 3.5, and a request to upgrade Roo to Hibernate 3.5 is being tracked as ROO-223. You are welcome to upgrade to Hibernate 3.5 in the meantime, although we cannot make it the default version for new Roo projects given it is only in beta and intended for development purposes. Thanks for your understanding.

          Show
          Ben Alex added a comment - Bug in Hibernate Validator: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4427 This is being closed as "won't fix" because it is a bug in Hibernate that is known to be corrected in Hibernate 3.5, and a request to upgrade Roo to Hibernate 3.5 is being tracked as ROO-223 . You are welcome to upgrade to Hibernate 3.5 in the meantime, although we cannot make it the default version for new Roo projects given it is only in beta and intended for development purposes. Thanks for your understanding.
          Hide
          John Cameron added a comment -

          While I understand your reluctance to to fix this, it is an unfortunate bug since it crops up in your tenminute example - intended for people like me that just want to get a feel of Roo.

          It is not a good look when your "simple" example does not work out of the box.

          At the very least, I would suggest that you specify that the example currently only works under Java 1.6 or greater.

          Show
          John Cameron added a comment - While I understand your reluctance to to fix this, it is an unfortunate bug since it crops up in your tenminute example - intended for people like me that just want to get a feel of Roo. It is not a good look when your "simple" example does not work out of the box. At the very least, I would suggest that you specify that the example currently only works under Java 1.6 or greater.
          Hide
          Ben Alex added a comment -

          John, I have created ROO-520 to document this properly in the reference guide. Thanks for the feedback.

          Show
          Ben Alex added a comment - John, I have created ROO-520 to document this properly in the reference guide. Thanks for the feedback.
          Hide
          Daeron Meyer added a comment -

          While this is a real nuisance for JDK 1.5 users there is a workaround. You just have to add the jaxb dependencies explicitly in the project pom (this worked for me):

          <dependencies>
          <!-- ....-->
          <dependency>
          <groupid>javax.xml.bind</groupid>
          <artifactid>jaxb-api</artifactid>
          <version>2.1</version>
          </dependency>

          <dependency>
          <groupid>com.sun.xml.bind</groupid>
          <artifactid>jaxb-impl</artifactid>
          <version>2.1.3</version>
          </dependency>
          </dependencies>

          Show
          Daeron Meyer added a comment - While this is a real nuisance for JDK 1.5 users there is a workaround. You just have to add the jaxb dependencies explicitly in the project pom (this worked for me): <dependencies> <!-- ....--> <dependency> <groupid>javax.xml.bind</groupid> <artifactid>jaxb-api</artifactid> <version>2.1</version> </dependency> <dependency> <groupid>com.sun.xml.bind</groupid> <artifactid>jaxb-impl</artifactid> <version>2.1.3</version> </dependency> </dependencies>
          Hide
          Ben Alex added a comment -

          According to http://forum.springsource.org/showpost.php?p=287635&postcount=3 just add stax:stax:1.2.0 to the POM to resolve this. I've reopened this task to remind me to try it out and update the default POM config/docs accordingly.

          Show
          Ben Alex added a comment - According to http://forum.springsource.org/showpost.php?p=287635&postcount=3 just add stax:stax:1.2.0 to the POM to resolve this. I've reopened this task to remind me to try it out and update the default POM config/docs accordingly.
          Hide
          Ben Alex added a comment -

          Roo 1.1.0.M1 development master uses hibernate-validator 4.0.2.GA which is post-3.5.0.Beta-1 fix version indicated in http://opensource.atlassian.com/projects/hibernate/browse/HHH-4427. As such I'm closing this issue.

          Show
          Ben Alex added a comment - Roo 1.1.0.M1 development master uses hibernate-validator 4.0.2.GA which is post-3.5.0.Beta-1 fix version indicated in http://opensource.atlassian.com/projects/hibernate/browse/HHH-4427 . As such I'm closing this issue.
          Hide
          MiB added a comment -

          When I tried out the current Chapter 5 code of "Spring Roo in Action" with Roo 1.1.4, using Hibernate 3.6, this error returned. Adding Stax 1.20 alone did not work, but doing as Daeron Meyer did and adding jaxb-api 2.1 and jaxb-impl 2.1.3 did resolve the situation.

          Show
          MiB added a comment - When I tried out the current Chapter 5 code of "Spring Roo in Action" with Roo 1.1.4, using Hibernate 3.6, this error returned. Adding Stax 1.20 alone did not work, but doing as Daeron Meyer did and adding jaxb-api 2.1 and jaxb-impl 2.1.3 did resolve the situation.
          Hide
          MiB added a comment -

          The code I currently add is the corrected:

          <dependency>
          <groupId>javax.xml.bind</groupId>
          <artifactId>jaxb-api</artifactId>
          <version>2.1</version>
          </dependency>
          <dependency>
          <groupId>com.sun.xml.bind</groupId>
          <artifactId>jaxb-impl</artifactId>
          <version>2.1.3</version>
          </dependency>

          Show
          MiB added a comment - The code I currently add is the corrected: <dependency> <groupId>javax.xml.bind</groupId> <artifactId>jaxb-api</artifactId> <version>2.1</version> </dependency> <dependency> <groupId>com.sun.xml.bind</groupId> <artifactId>jaxb-impl</artifactId> <version>2.1.3</version> </dependency>

            People

            • Assignee:
              Ben Alex
              Reporter:
              Erik-Jan Blanksma
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: