File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes Cannot instantiate component with component-type Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Cannot instantiate component with component-type" Watch "Cannot instantiate component with component-type" New topic
Author

Cannot instantiate component with component-type

Kaustav Ganguly
Greenhorn

Joined: Dec 14, 2009
Posts: 28
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

Joined: Mar 30, 2006
Posts: 95
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

Joined: Jun 25, 2001
Posts: 16305
    
  21

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).


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Cannot instantiate component with component-type