0

My Goal

I have a Dynamic Web project (PROJECT X) containing some JSF composites

- under META-INF > resources > web > compositeX.xhtml

I would like that another Dynamic Web project (PROJECT A) to be able to use the JSF composite of project X.


What i have done

I was following this solution to do so. (Packaging Facelets files (templates, includes, composites) in a JAR)

I have referenced my project X inside project A.

- Right click project A > Properties > Deployment Assembly > add project X ...

The project is now added and when i run my project A on the server (JBOSS WILDFLY 14), i checked what was deployed on the server and COULDNT see any composite under WEB-INF/resources.


My Problem

1) I have seen in my eclipse that when i reference project X in project A it will automatically import it as a WAR rather than a JAR, i have read on other post from users that their dynamic web project referenced was imported as a JAR file. What should be the format of an imported web project a JAR or WAR ?

2) I tried as well to JAR it manually and add the JAR to the java build path and deployment assembly of the project A but still it says "Unknown composite component". I can see in the JAR (project X) a folder META-INF/resources/web/compositeX.xhtml, so the composite is really here but it is not accessible from my project A even after referencing the JAR. What am i missing ?


Solution (after a while of research)


REFERENCE PROJECT

  • in the referenced project build the project with MAVEN POM as a JAR.
  • in the main java ee project, setup the MAVEN POM to build the project as WAR and add referenced project as a dependency.
  • check both project facet configuration to be web project 4.0, java 1.8, java server face 2.3, jboss maven integration 1.0.
  • check all .xml configuration file in the project beans.xml -> must contains beans_2.0.xsd, faces-config.xml -> must contains web-facesconfig_2_3.xsd, web.xml -> must contains web-app_4_0.xsd.
  • In eclipse under the build path option, check maven dependency is part of the order and exports tab, it should be at the top level and crossed checked.
  • you need to clean then build your referenced project.
  • you need to clean then build your project.
  • if it is still failing try to rerun all the steps multiple times, sometime maven do not include the referenced jar project (reason unknown).
  • ultimately, if still fail, add the referenced project in the deployment assembly and rename the destination from .WAR to .JAR.

CALL THE COMPOSITE

fra
  • 83
  • 1
  • 11
  • There is a lot of info mentioned in the duplicate which might cause errors which you do not address. And btw, Eclipse is not running anything, your container is! – Kukeltje Aug 23 '19 at 07:10
  • Solutions should be in answers not in edits of the question. And in this case most likely as an addutional answer in the duplicate if you think your answer is fundamentally different – Kukeltje Aug 27 '19 at 06:31
  • @kukeltje, Then let me do so, i will edit my answer and remove it from my original post to transfer it in my second post. – fra Aug 28 '19 at 19:05

0 Answers0