1 2 Previous Next 17 Replies Latest reply on Apr 11, 2009 10:28 AM by piergiorgiolucidi Go to original post
      • 15. Re: URGENT - Problem when deploying on jboss portal

        I did not explain properly.

        When i removed the 'portlet-api-lib.jar' from my 'lib' folder, in eclipse it was giving compilation error in 'PortletDefination.java' for 'import javax.portlet.*;', so in eclipse, 'properties-java build path-liabraries' i had to add the jar file from 'ADD EXTERNAL JAR' button.

        In 'portlet.xml' file, when i tried to use 'org.apache.myfaces.portlet.MyFacesGenericPortlet' class, it was giving error 'portlet threw exception', but when i added 'myfaces.jar' file from 'ADD EXTERNAL JAR' button, it did not give any error and the problem got solved.

        
         <portlet>
         <portlet-name>JsfTest-HelloPortlet</portlet-name>
         <portlet-class>org.apache.myfaces.portlet.MyFacesGenericPortlet</portlet-class>
         <init-param>
         <name>default-view</name>
         <value>/pages/test.jsp</value>
         </init-param>
         <supports>
         <mime-type>text/html</mime-type>
         <portlet-mode>VIEW</portlet-mode>
         </supports>
         <portlet-info>
         </portlet-info>
         </portlet>
        
        




        These jar files are not in my 'war' but i have to keep them somewhere and using 'ADD EXTERNAL BUTTON' add them in the project, otherwise it gives compilation error.

        So the 'classpath' file is also updated for these jar files.

        I have explained the problem i was facing and how it got resolved, but i am confused.

        What i have understood from this is ---
        1) There are few jar files which are available in JBoss Portal, which should not be included in the application 'lib' folder.
        2) In eclipse when i created the project it was giving compilation error, coz 'lib' doesn't have the jar files.

        Please correct me if i am wrong.
        How will the application take the jar files which are in JBoss Portal and not in 'war'?

        • 16. Re: URGENT - Problem when deploying on jboss portal
          peterj

          And finally the word "Eclipse" shows up. No wonder I had no idea what you were talking about in regards to the classpath.

          It appears that at this point you are fighting with Eclipse, rather than having an issue with running portlets. And yes you do need to add the portlet-api-lib.jar file to the Libraries tab on the Java Build Path for the project, otherwise Eclipse will not know about the portlet classes. However, doing so does not add the JARs to the classpath because the portlet runs within JBoss AS and not as a standalone app.

          However, you do have to make certain that Eclipse does not package those JARs in your WAR file. When the WAR file is packaged, it should contain the following (based on the files you have mentioned so far):

          pages/test.jsp
          WEB-INF/classes/com/test/PortletDefination.class
          WEB-INF/dummy-object.xml
          WEB-INF/portlet-instances.xml
          WEB-INF/portlet.xml
          WEB-INF/web.xml

          You might wonder how to convince Eclipse to generate such a WAR. I have no idea. I never compile, package or deploy anything with Eclipse - I always use Maven or Ant. This way I know what I am getting and don't have to fight with Eclipse.

          As long as Eclipse places the JAR files mentioned in the Java Build Path into your WAR's WEB-INF/lib directory, it will not work. You could manually remove those JARs from the WAR before starting JBoss AS and see how that works.

          • 17. Re: URGENT - Problem when deploying on jboss portal
            piergiorgiolucidi

            You can try to make a script with Ant or using Maven to allow Eclipse to build the right artifact you need (JAR,WAR or EAR).

            1 2 Previous Next