11 Replies Latest reply on Mar 7, 2013 5:19 PM by Andrew Evans

    Load JDK resources in AS7

    Maksym Gryevtsov Newbie



      I getting exception when try to use CachedRowSet:

      Can't find bundle for base name com/sun/rowset/RowSetResourceBundle, locale en_US

          at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1499) [rt.jar:1.7.0_04]

          at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1322) [rt.jar:1.7.0_04]

          at java.util.ResourceBundle.getBundle(ResourceBundle.java:1028) [rt.jar:1.7.0_04]

          at com.sun.rowset.JdbcRowSetResourceBundle.<init>(JdbcRowSetResourceBundle.java:105) [rt.jar:1.7.0_04]

          at com.sun.rowset.JdbcRowSetResourceBundle.getJdbcRowSetResourceBundle(JdbcRowSetResourceBundle.java:124) [rt.jar:1.7.0_04]


      My jboss-deployment-structure.xml took care about loading all needed classes from rt.jar. But com.sun.rowset.RowSetResourceBundle class located inside JDK's resource.jar






                          <path name="com/sun/rowset" />

                          <path name="com/sun/rowset/internal" />

                          <path name="com/sun/rowset/providers" />







      What's need to be done to include classes from JDK's resource.jar?





      7.1.2.Final-SNAPSHOT, JDK 1.7.0_04

        • 1. Re: Load JDK resources in AS7
          Maksym Gryevtsov Newbie

          Can someone help?


          It only happens in domain configuration, standalone works fine.



          • 2. Re: Load JDK resources in AS7
            Tomaž Cerar Master



            did you try modifying jboss_home\modules\sun\jdk\main\module.xml to include this? does it work if you do?






            • 3. Re: Load JDK resources in AS7
              Maksym Gryevtsov Newbie



              That helped. But it leaves a bad design taste:

              • Class loading works differently for standalone & domain modes
              • I'm forced to modify internal JBoss modules

              Better aproach would be to have a separate empty module which wil be loaded by sun.jdk module. That would give everyone a standard placeholder to add "optional" JDK staff without worring during JBoss upgrade.


              Thanks a lot,


              • 4. Re: Load JDK resources in AS7
                Jaikiran Pai Master

                I wouldn't expect the classloading to behave differently for domain and standalone modes. Can you attach a simple application which reproduces this? Just out of curiosity - do all your hosts run on the same Java vendor and version? Also can you post the entire exception stacktrace and tell us where exactly this exception happens?

                • 5. Re: Load JDK resources in AS7
                  Maksym Gryevtsov Newbie

                  It would be quite diffucult to build a sample application. Here is a full stack trace. It's originated by spring scheduler:


                  15:34:33,420 ERROR [com.docupace.dflow.image.impl.DbImageServiceImpl] (dflow-core-scheduler-1) Error on files purging: java.lang.NoClassDefFoundError: com/sun/rowset/CachedRowSetImpl

                      at org.springframework.jdbc.core.SqlRowSetResultSetExtractor.newCachedRowSet(SqlRowSetResultSetExtractor.java:78) [spring-jdbc-3.0.4.RELEASE.jar:3.0.4.RELEASE]

                      at org.springframework.jdbc.core.SqlRowSetResultSetExtractor.createSqlRowSet(SqlRowSetResultSetExtractor.java:62) [spring-jdbc-3.0.4.RELEASE.jar:3.0.4.RELEASE]

                      at org.springframework.jdbc.core.SqlRowSetResultSetExtractor.extractData(SqlRowSetResultSetExtractor.java:46) [spring-jdbc-3.0.4.RELEASE.jar:3.0.4.RELEASE]

                      at org.springframework.jdbc.core.SqlRowSetResultSetExtractor.extractData(SqlRowSetResultSetExtractor.java:1) [spring-jdbc-3.0.4.RELEASE.jar:3.0.4.RELEASE]

                      at org.springframework.jdbc.core.JdbcTemplate$1QueryStatementCallback.doInStatement(JdbcTemplate.java:445) [spring-jdbc-3.0.4.RELEASE.jar:3.0.4.RELEASE]

                      at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:395) [spring-jdbc-3.0.4.RELEASE.jar:3.0.4.RELEASE]

                      at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:455) [spring-jdbc-3.0.4.RELEASE.jar:3.0.4.RELEASE]

                      at org.springframework.jdbc.core.JdbcTemplate.queryForRowSet(JdbcTemplate.java:498) [spring-jdbc-3.0.4.RELEASE.jar:3.0.4.RELEASE]

                      at com.docupace.dflow.image.impl.DbImageServiceImpl.purgeImages(DbImageServiceImpl.java:145) [dflow-core-support_classes.jar:]

                      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_04]

                      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_04]

                      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_04]

                      at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_04]

                      at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:273) [spring-core-3.0.4.RELEASE.jar:3.0.4.RELEASE]

                      at org.springframework.scheduling.support.MethodInvokingRunnable.run(MethodInvokingRunnable.java:65) [spring-context-3.0.4.RELEASE.jar:3.0.4.RELEASE]

                      at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:51) [spring-context-3.0.4.RELEASE.jar:3.0.4.RELEASE]

                      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [rt.jar:1.7.0_04]

                      at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:351) [rt.jar:1.7.0_04]

                      at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:178) [rt.jar:1.7.0_04]

                      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178) [rt.jar:1.7.0_04]

                      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [rt.jar:1.7.0_04]

                      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_04]

                      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_04]

                      at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_04]

                  • 6. Re: Load JDK resources in AS7
                    Andrew Evans Newbie

                    Is there some solution to this that doesn't involve modifying modules?

                    Such as adding the resources.jar to jboss-deployment-structure.xml...

                    We run our app on a JBoss farm and it's always a pain to get them to modify the modules.

                    • 7. Re: Load JDK resources in AS7
                      Jaikiran Pai Master

                      Andrew, welcome to the forums!


                      I'm not sure what exact issue you are running into. Can you please add some details including the AS7 version and the exception stacktrace(s) that you are seeing?

                      • 8. Re: Load JDK resources in AS7
                        Nicklas Karlsson Master

                        So you are asking "Is there a way of including stuff from resources.jar in the same way as the system/paths does for rt.jar"?

                        • 9. Re: Load JDK resources in AS7
                          Andrew Evans Newbie

                          Thanks Jaikiran,


                          JBoss: jboss-as-7.1.1.Final

                          JDK: jdk1.6.0_16


                          As per the original poster, without modifying any modules i got rid of the initial error: java.lang.NoClassDefFoundError: com/sun/rowset/CachedRowSetImpl

                          Did this by modifying the jboss-deployment-structure.xml file as follows:







                               <path name="com/sun/rowset" />

                               <path name="com/sun/rowset/internal" />

                               <path name="com/sun/rowset/providers" />







                          But then i get the resource bundle missing error:


                          java.util.MissingResourceException: Can't find bundle for base name com/sun/rowset/RowSetResourceBundle, locale en_AU, stacktrace=java.util.MissingResourceException: Can't find bundle for base name com/sun/rowset/RowSetResourceBundle, locale en_AU
                            at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1521)
                            at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1260)
                            at java.util.ResourceBundle.getBundle(ResourceBundle.java:962)
                            at com.sun.rowset.JdbcRowSetResourceBundle.<init>(JdbcRowSetResourceBundle.java:88)
                            at com.sun.rowset.JdbcRowSetResourceBundle.getJdbcRowSetResourceBundle(JdbcRowSetResourceBundle.java:107)
                            at com.sun.rowset.CachedRowSetImpl.<init>(CachedRowSetImpl.java:335)
                            at org.springframework.jdbc.core.SqlRowSetResultSetExtractor.newCachedRowSet(SqlRowSetResultSetExtractor.java:78)



                          So, without modifying any modules or generally external to my EAR file, i would like to be able to fix this error.

                          • 10. Re: Load JDK resources in AS7
                            Andrew Evans Newbie

                            Hi Nicklas,

                            Yes this could somehow be the solution i guess.

                            I don't want to have to manually load the bundle file into my EAR since that would lead to mismatched versions (between bundle and jars) if they changed the underlying JRE in the farm servers.

                            • 11. Re: Load JDK resources in AS7
                              Andrew Evans Newbie

                              Well, eventually i discarded the common library code that was using the Spring SqlRowSet class and rewrote it (minor change) using the RowMapper pattern.


                              This removed the issues of using com.sun.rowset classes altogether

                              This removes some of the caching ability of the class but then again i have caching at other levels.


                              Still, it would be nice to be able to resolve other issues like this that may arise.