5 Replies Latest reply on Dec 27, 2005 1:33 AM by ervikas

    Spring MVC integration with JBoss Portal

    kevs3d

      Hi,

      I have modified the Spring Porlet-168 integration sandbox code to work with JBoss Portal. This allows you to use the Spring MVC as your web framework to create portlets for JBoss portal.

      http://www.kevs3d.co.uk/dev/jbossdeployspringportlet.zip

      I have created a JBoss portlet page for this example - so it's also a good example of how to create the config files for a simple portlet and give it a separate page in JBoss portal.

      Once deployed, you launch the test app using something like the following URL:
      http://localhost:8080/portal?page=springexample

      NOTE: I created this against the first JBoss Portal Alpha release - applogies if any config files etc. have changed since then, but i'm sure you can get it to work ;)

      Hope this is useful to people,

      Cheers,

      Kev
      --
      http://www.kevs3d.co.uk

        • 1. Re: Spring MVC integration with JBoss Portal
          kevs3d

          Applogies I forgot to mention you need to also download the Spring Portlet example code from the Spring website. I've put a full example which includes that and also the JBoss portlet deployment files http://www.kevs3d.co.uk/dev/SpringJBossPortletSample.zip. This is the complete Spring JSR-168 Portlet example integrated with Jboss.

          Cheers,

          Kev
          --
          http://www.kevs3d.co.uk



          • 2. Re: Spring MVC integration with JBoss Portal
            kevs3d

            Simply run the ANT script included to build the WAR, then deploy the WAR into JBoss Portal 2.0 Alpha as usual and go to the following page url:
            http://localhost:8080/portal?page=springexample

            Kev

            • 3. Re: Spring MVC integration with JBoss Portal

              I have it working now. I'm getting a npe on init due to portal not being able to find the localization file.

              Am also seeing this in the log when accessing the pages:

              10:42:56,948 WARN [ResourceBundleMessageSource] ResourceBundle [messages] not found for MessageSource: Can't find bundle for base name messages, locale en_US


              Let me know if you're getting this in alpha.

              I've seen this before with our portal. We don't like en_US as a locale. I'll debug our side and see what we can do.


              • 4. Re: Spring MVC integration with JBoss Portal

                ok. I looked at it a bit more, and it seems that the spring side is throwing when looking for the resourcebundle:

                11:52:28,675 INFO [DispatcherPortlet] Published PortletApplicationContext of portlet 'SpringExamplePortlet' as PortletContext attribute with name [org.springfr
                amework.web.portlet.FrameworkPortlet.CONTEXT.SpringExamplePortlet]
                11:52:28,715 INFO [DispatcherPortlet] Unable to locate LocaleResolver with name 'localeResolver': using default [org.springframework.web.portlet.i18n.RenderReq
                uestLocaleResolver@1e655d8]
                11:52:28,715 INFO [DispatcherPortlet] Loaded view resolver [org.springframework.web.servlet.view.InternalResourceViewResolver@1ecb1b2]
                11:52:28,745 INFO [DispatcherPortlet] Framework portlet 'SpringExamplePortlet' init completed in 521 ms
                11:52:28,745 INFO [DispatcherPortlet] Portlet 'SpringExamplePortlet' configured successfully
                11:52:28,745 INFO [PortletContainer] Initialized portlet object org.springframework.web.portlet.DispatcherPortlet
                11:52:28,785 INFO [SpringExamplePortlet] started
                11:52:28,785 INFO [SpringExamplePortlet-Invocation)] started
                11:52:28,785 INFO [SpringExamplePortlet-ContentTypes)] started
                11:52:28,825 INFO [InfoBundle] Creates the parent bundle
                11:52:28,825 INFO [SpringExamplePortlet-Language)] failed
                11:52:28,825 ERROR [SpringExamplePortlet-Language)] Exception occured when invoking nested lifecycle method
                java.lang.NullPointerException
                 at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:707)
                 at java.util.ResourceBundle.getBundle(ResourceBundle.java:700)
                 at org.jboss.portal.portlet.plugins.language.ResourceBundles.loadBundle(ResourceBundles.java:272)
                 at org.jboss.portal.portlet.plugins.language.ResourceBundles.init(ResourceBundles.java:199)
                 at org.jboss.portal.portlet.plugins.language.ResourceBundles.start(ResourceBundles.java:70)


                By the time it gets to org.jboss.portal.portlet.plugins.language.ResourceBundles.loadBundle, its passing in a null basename. Either way, I will post this example with some others in our wiki. I'm redoing this today, so people can download and play with different types of portlets we support.

                Thanks again!

                • 5. Re: Spring MVC integration with JBoss Portal
                  ervikas

                  Hi

                  I have tried with the test application as suggested by you. I had build the app and deployed it the server but i was unable to make a request to it. When i gave the URL as
                  http://localhost:8080/portal?page-springexample to the browser ,It was sying that the resource portal is not available. Can u suggest what's wrong. I m using Jboss 4.0.2.

                  Actually i have a spring application and i want ot migrate it to the jboss portlets. Can u refer to some good documentation for the same.

                  Thanks in advance