Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Cannot instantiate component with component-type

 
Kaustav Ganguly
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have defined some custom page tag and trying to use it in my application. I am running my server in eclipse and the component class is present in a jar file. While I try to load the page I am getting the exception "SEVERE: JSF1068: Cannot instantiate component with component-type page". Seems that it is not able to load the page component class present inside the jar file.

Interestingly when I extract the component classes and put them directly under the Web Application project in eclipse it works fine.

Please let me know if there is any pointer to the issue.

My web.xml has the following entry

<context-param>
<param-name>javax.faces.FACELETS_LIBRARIES</param-name>
<param-value>/WEB-INF/XYZ-taglib.xml</param-value>
</context-param>

Tag defination is

<tag>
<tag-name>page</tag-name>
<component>
<component-type>page</component-type>
</component>
<attribute>
<name>src</name>
<required>true</required>
</attribute>
<attribute>
<name>localName</name>
<required>false</required>
</attribute>
</tag>

And the tag component class is



The error stack trace is

SEVERE: JSF1068: Cannot instantiate component with component-type page
13:01:11,471 ERROR [XYZRenderingManager] render: handleException(RenderingException)
13:01:11,471 ERROR [XYZRenderingManager] Unhandled exception thrown during rendering
 
Tom Fulton
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, by your description, it's acting like a classpath problem. How have you added the .jar to your project?

If you can extract the class and place it in the project, and it works, that means there isn't anything structurally wrong with the configuration. So I'd suggest trying a couple of different ways of making the .jar visible to both your project and the server (remember, the fact that the project can see it doesn't necessarily make it possible for the server to see it).

Good luck, and let us know what you find.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18164
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The fact that you're running Eclipse is tangental. To work properly, a webapp must be in WAR format, Eclipse or not, and that means that you must have a copy of the JAR in the WAR's WEB-INF/lib directory.

Eclipse normally doesn't automatically do that kind of stuff, which is why tools such as Ant and Maven are commonly used in webapp development. There are Eclipse plugins for both of these tools (Ant is built-in to the standard Java distro).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic