tag:blogger.com,1999:blog-18577364.post4864506186007652182..comments2020-07-11T09:07:32.561+02:00Comments on PortletWork: maven-jetty-plugin and JSR168 portletsNils-Helge Garli Hegvikhttp://www.blogger.com/profile/15756010546034756427noreply@blogger.comBlogger19125tag:blogger.com,1999:blog-18577364.post-38579487099203881362009-01-27T14:30:00.000+01:002009-01-27T14:30:00.000+01:00Nice post for further reading on jsr-168 you can v...Nice post <BR/>for further reading on jsr-168 you can visit <BR/><BR/>http://java2us.blogspot.com/<BR/><BR/>Please pay a visit to it. And don't forget to write a comment.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-18577364.post-25142051371516954512008-12-26T11:47:00.000+01:002008-12-26T11:47:00.000+01:00There's really no need for that download anymore. ...There's really no need for that download anymore. It's all configured and set up in the struts2-portlet example application, which you can download instead.Nils-Helge Garli Hegvikhttps://www.blogger.com/profile/15756010546034756427noreply@blogger.comtag:blogger.com,1999:blog-18577364.post-31800406639597216822008-12-26T06:38:00.000+01:002008-12-26T06:38:00.000+01:00Great work... Can you check the link http://static...Great work... Can you check the link http://static.nilshelgeogmaria.com/struts2/myportlet.zip . I am getting page not found message here. Thanks.Unknownhttps://www.blogger.com/profile/00891871598426389634noreply@blogger.comtag:blogger.com,1999:blog-18577364.post-72942651236349103042007-08-17T10:23:00.000+02:002007-08-17T10:23:00.000+02:00Yup, that's what I ended up doing, Kristoffer. If ...Yup, that's what I ended up doing, Kristoffer. If you take a look at the pom of the sample portlet in my <A HREF="http://portletwork.blogspot.com/2007/08/maven-jetty-plugin-and-jsr168-portlets.html" REL="nofollow">follow up article</A>, you can see that the servlet api is excluded.Nils-Helge Garli Hegvikhttps://www.blogger.com/profile/15756010546034756427noreply@blogger.comtag:blogger.com,1999:blog-18577364.post-70072358726772639722007-08-17T10:18:00.000+02:002007-08-17T10:18:00.000+02:00I couldn't help but notice the issues with servlet...I couldn't help but notice the issues with servlet APIs being in different versions etc. I have had my fair share with these problems already, and I think I may have a solution to the problem. If you use Spring, then Spring is dependent on commons-logging (I hate commons-logging btw) which, of course has a dependency to servlet-api. I am not kidding. Try to add commons-logging explicitly to your pom and then exclude the servlet API from that dependency.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-18577364.post-54496881195081406532007-08-08T17:35:00.000+02:002007-08-08T17:35:00.000+02:00I have posted a new entry explaining how I solved ...I have <A HREF="http://portletwork.blogspot.com/2007/08/maven-jetty-plugin-and-jsr168-portlets.html" REL="nofollow">posted a new entry</A> explaining how I solved some of the problems and improved the solution.Nils-Helge Garli Hegvikhttps://www.blogger.com/profile/15756010546034756427noreply@blogger.comtag:blogger.com,1999:blog-18577364.post-4024237112457228042007-08-06T01:11:00.000+02:002007-08-06T01:11:00.000+02:00I figured out the issue with the Namespace handler...I figured out the issue with the Namespace handler. I had put the pluto-driver-config.xml file in the ContextListener parameter, so Spring was trying to parse that xml file. *blush*.<BR/><BR/>My web application starts now, all that remains is figuring out how to place the portlet on a page. I noticed that your pluto-portal-driver-config.xml file was incomplete - it was missing the portlet-app and render-config sections. Yet your portlet rendered. I'll have to figure out how you did that.Stephenhttps://www.blogger.com/profile/09811464579094850621noreply@blogger.comtag:blogger.com,1999:blog-18577364.post-17917901112441466022007-08-04T22:16:00.000+02:002007-08-04T22:16:00.000+02:00Hope you get your internet connection back. :-)We ...Hope you get your internet connection back. :-)<BR/><BR/>We should work off a common shared repository. My vision for this is to have a project which, during integration testing, fires up pluto in jetty, then executes some selenium tests against it. After all the selenium tests are done, then jetty is shut down. <BR/><BR/>Information about which unit tests passed or failed would be aggregaed into the surefire reports.<BR/><BR/>Code coverage statistics would be added to the code coverage stats from the surefire reports.<BR/><BR/>Then everything gets published to your maven site.<BR/><BR/>Oh yea, let's make this a single, easy to configure plugin too. We could call it: maven-surefire-pluto-jetty-selenium-plugin. :-)<BR/><BR/>I just have simple needs. :-)Stephenhttps://www.blogger.com/profile/09811464579094850621noreply@blogger.comtag:blogger.com,1999:blog-18577364.post-21080414149852512052007-08-04T22:05:00.000+02:002007-08-04T22:05:00.000+02:00As it turns out, you can't specify all three of &l...As it turns out, you can't specify all three of <defaultWebXml>, <overrideWebXml> and <webXml>. By moving your defaultWebXml to my overrideWebXml, I got Spring to load the testing context parameters as I wanted.<BR/><BR/>Then it didn't like the pluto-portal-driver-config.xml - it was missing the <portlet-app> and <render-config> sections. Fixed that easy enough. <BR/><BR/>Now I'm faced with the next issue. I'm getting this odd error: Caused by: org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'pluto-portal-driver'.<BR/><BR/>I hope this is the last error to work out. Once I get this in place, I think I'll make a sample app which uses your portlet to start with, but which adds in spring and hibernate (and JSF). It will also separate out the pluto/jetty stuff to under src/test instead of under src/main. (No critisim meant to you - I'm just planning on using this for automated maven integration testing, and since I'm not deploying production to Pluto or Jetty, I don't want them in the main/src directory tree)Stephenhttps://www.blogger.com/profile/09811464579094850621noreply@blogger.comtag:blogger.com,1999:blog-18577364.post-80425173194125426632007-08-04T22:01:00.000+02:002007-08-04T22:01:00.000+02:00Thanks for all the detailed information. As I ment...Thanks for all the detailed information. As I mentioned in the blog, there are some issues to be resolved when you're using Spring in your portlet as well. I have written a servlet context listener that overrides the ContextLoaderListener so all the Spring contexts are initialized correctly. I'll post more about this later, when I have my internet connection back...Nils-Helge Garli Hegvikhttps://www.blogger.com/profile/15756010546034756427noreply@blogger.comtag:blogger.com,1999:blog-18577364.post-65898999415698778562007-08-04T21:39:00.000+02:002007-08-04T21:39:00.000+02:00Thanks to this wiki entry, I was able to diagnose ...Thanks to this <A HREF="http://simile.mit.edu/wiki/How_to_debug_mvn_jetty:run_in_Eclipse" REL="nofollow">wiki</A> entry, I was able to diagnose that only my spring context is being loaded, and not pluto's.<BR/><BR/>Since I want to keep my web.xml as the production one, and only add in pluto stuff for testing, I need to figure out how to override the context parameter which lists what spring files to load when running in jetty. More soon.Stephenhttps://www.blogger.com/profile/09811464579094850621noreply@blogger.comtag:blogger.com,1999:blog-18577364.post-7660121302599499192007-08-04T18:40:00.000+02:002007-08-04T18:40:00.000+02:00I'm soo close now. Thank you for all your help. ...I'm soo close now. Thank you for all your help. Sorry for this long comment, but I hope it will be helpful to others.<BR/><BR/>The version change you gave me fixed the sample application - thanks. The action links don't do anything, and I was hoping to see a portlet titlebar with edit/maximize links. That's a small matter compared to actually getting the app running.<BR/><BR/>Here's what I ended up doing with my application which also uses Spring.<BR/><BR/>First, I took your advice and put the parent first class loader in place. That got me past the classcast exception, but then I got NoClassDefFound exceptions for hibernate classes. :-(<BR/><BR/>I started pulling more and more of my classpath into the jetty classpath, then it struck me. I took spring and pluto *out* of the jetty classpath, and instead put them in my application classpath (I'll switch them to scope "test" once I get this working). That got me a heck of a lot further.<BR/><BR/>Since my app uses a jndi datasource, I configured one (hsqldb) and had to put dbcp, commons-pool, hsqldb and some other dependencies on the jetty classpath, but now I've gotten to the point where it fully initializes my spring context root, and then blows up with a null pointer exception here:<BR/><BR/>java.lang.NullPointerException at org.apache.pluto.driver.PortalStartupListener.contextInitialized(PortalStartupListener.java:102)<BR/><BR/><BR/>Here's what I ended up having for a plugin configuration:<BR/> <plugin><BR/> <groupId>org.apache.pluto</groupId><BR/> <artifactId>maven-pluto-plugin</artifactId><BR/> <version>1.1.3</version><BR/> <executions><BR/> <execution><BR/> <phase>generate-resources</phase><BR/> <goals><BR/> <goal>assemble</goal><BR/> </goals><BR/> </execution><BR/> </executions><BR/> </plugin><BR/> <plugin><BR/> <groupId>org.mortbay.jetty</groupId><BR/> <artifactId>maven-jetty-plugin</artifactId><BR/> <version>6.1.5</version><BR/> <configuration><BR/> <jettyConfig>src/main/webapp/WEB-INF/jetty-ds.xml</jettyConfig><BR/> <useTestClasspath>true</useTestClasspath><BR/><systemProperties><BR/><systemProperty><BR/><key>org.mortbay.jetty.webapp.parentLoaderPriority</key><BR/><value>false</value><BR/></systemProperty><BR/></systemProperties><BR/> <contextPath>/HCIMedRec</contextPath><BR/> <overrideWebXml>src/test/web.xml</overrideWebXml><BR/> <connectors><BR/> <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector"><BR/> <port>9090</port><BR/> <maxIdleTime>60000</maxIdleTime><BR/> </connector><BR/> </connectors><BR/> <scanIntervalSeconds>10</scanIntervalSeconds><BR/> <webXml>target/pluto-resources/web.xml</webXml><BR/> <webDefaultXml>src/main/webapp/WEB-INF/jetty-pluto-web-default.xml</webDefaultXml><BR/> </configuration><BR/> <dependencies><BR/> <dependency><BR/> <groupId>commons-dbcp</groupId><BR/> <artifactId>commons-dbcp</artifactId><BR/> <version>1.2</version><BR/> </dependency><BR/> <dependency><BR/> <groupId>hsqldb</groupId><BR/> <artifactId>hsqldb</artifactId><BR/> <version>1.8.0.7</version><BR/> </dependency><BR/> <dependency><BR/> <groupId>commons-pool</groupId><BR/> <artifactId>commons-pool</artifactId><BR/> <version>1.3</version><BR/> </dependency><BR/> <dependency><BR/> <groupId>commons-logging</groupId><BR/> <artifactId>commons-logging</artifactId><BR/> <version>1.0.4</version><BR/> <scope>provided</scope><BR/> </dependency><BR/> <dependency><BR/> <groupId>javax.portlet</groupId><BR/> <artifactId>portlet-api</artifactId><BR/> <version>1.0</version><BR/> </dependency><BR/> <dependency><BR/> <groupId>commons-beanutils</groupId><BR/> <artifactId>commons-beanutils</artifactId><BR/> <version>1.7.0</version><BR/> <scope>provided</scope><BR/> </dependency><BR/> <dependency><BR/> <groupId>commons-beanutils</groupId><BR/> <artifactId>commons-beanutils-core</artifactId><BR/> <version>1.7.0</version><BR/> <scope>provided</scope><BR/> </dependency><BR/><BR/> </dependencies><BR/> </plugin><BR/><BR/><BR/>The nullpointer exception may have to do with how I ended up configuring my spring ContextListener - I moved it to an overrideWebXml (I split my spring context so that the datasource is in a separate file, and I used hsqldb for testing like this). I'll keep investigating. I just thought my configuration would be useful for others using Hibernate and Spring in a JSR 168 portlet and wanting to test in Pluto running in Jetty via Maven (there - that should cover the keywords I usually google on :-)Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-18577364.post-58653026575621492832007-08-04T11:41:00.000+02:002007-08-04T11:41:00.000+02:00Regarding the first error you had, have you tried ...Regarding the first error you had, have you tried setting the plugin version to 6.1.4rc0? It appears that a 6.1.5 version has been released tha t does not work for me either. <BR/><BR/>Regarding the second error, as I mentioned in the entry, there are some issues when you're using Spring in your application which I'm trying to solve. You can try adding a system property to the plugin:<BR/><configuration><BR/> <systemProperties><BR/> <systemProperty><BR/> <key>org.mortbay.jetty.webapp.parentLoaderPriority</key><BR/> <value>true</value><BR/> </systemProperty><BR/></systemProperties><BR/></configuration>Nils-Helge Garli Hegvikhttps://www.blogger.com/profile/15756010546034756427noreply@blogger.comtag:blogger.com,1999:blog-18577364.post-57699171666393998982007-08-04T07:07:00.000+02:002007-08-04T07:07:00.000+02:00I get the same error even when I switch to the 2.0...I get the same error even when I switch to the 2.0.2 version of spring. Must be that the jar is loaded twice or something.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-18577364.post-40086268438847513492007-08-04T06:58:00.000+02:002007-08-04T06:58:00.000+02:00I gave up on the sample project, but I did get my ...I gave up on the sample project, but I did get my portlet configured with your excellent write-up here.<BR/><BR/>There is one thing, which you alluded to in your post. I have a dependency on Spring, but a different version - 2.0.5. <BR/><BR/>I get this error on startup (and a 503 error thereafter)<BR/>java.lang.ClassCastException: org.springframework.web.context.support.XmlWebApplicationContext<BR/><BR/>Any thoughts?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-18577364.post-64962880883518065852007-08-04T01:23:00.000+02:002007-08-04T01:23:00.000+02:00I haven't had much time for this today, but I foun...I haven't had much time for this today, but I found that it's picking up the class in question from servlet-api-2.3.jar. <BR/><BR/>I can't find a constructor for TagAttributeInfo which takes 5 strings as its arguments in any release of J2EE.<BR/><BR/>Perhaps I'm reading the error message wrong:<BR/><B><BR/>javax.servlet.ServletException: javax.servlet.jsp.tagext.TagAttributeInfo.(Ljava/lang/String;ZLjava/lang/String;ZZLjava/lang/String;ZZLjava/lang/String;Ljava/lang/String;)V</B>Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-18577364.post-92014891831012648052007-08-03T22:30:00.000+02:002007-08-03T22:30:00.000+02:00Hi coop!Have you resolved the issue yet? I tried s...Hi coop!<BR/><BR/>Have you resolved the issue yet? I tried stripping down the example, removing dependencies to JSP 2.0 and almost everything else, and it still worked here. Have you tried running it with "mvn -U" to update the plugins?Nils-Helge Garli Hegvikhttps://www.blogger.com/profile/15756010546034756427noreply@blogger.comtag:blogger.com,1999:blog-18577364.post-86214991189536651672007-08-03T08:06:00.000+02:002007-08-03T08:06:00.000+02:00This is great work! Thanks!I downloaded your proj...This is great work! Thanks!<BR/>I downloaded your project, and having put the pluto staging repository in its pom.xml, I'm able to start jetty. However, I get the following error when I try to hit the URL:<BR/>java.lang.NoSuchMethodError: javax.servlet.jsp.tagext.TagAttributeInfo.(Ljava/lang/String;ZLjava/lang/String;ZZLjava/lang/String;ZZLjava/lang/String;Ljava/lang/String;)V<BR/><BR/>This method has been around since JSP 2.0, which you also specify in your dependency as provided.<BR/><BR/>I figure I'll investigate this tomorrow or over the weekend.<BR/><BR/>Thanks again!Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-18577364.post-24898768551647643392007-08-02T14:53:00.000+02:002007-08-02T14:53:00.000+02:00Great stuff Nils!Thank you for the detailed writeu...Great stuff Nils!<BR/>Thank you for the detailed writeup.Anonymousnoreply@blogger.com