Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Struts Tiles Problem - Can't get definitions factory from context.

148 views
Skip to first unread message

spi...@excite.com

unread,
Mar 10, 2005, 12:11:05 PM3/10/05
to
This is a common error, as I have found from searching for a solution.
Unfortunately, I haven't been able to find anything that helped me fix
my problem. I'm running struts 1.2 on windows XP with Tomcat 5.5.7.

I've been working on this for a while, but haven't gotten anywhere. I
chopped it down to a minimum. index.jsp works fine unless there is a
tile reference, in which case it throws the exception.

I do have the tiles.jar file in my WEB-INF/lib folder. The taglib
location on the webpages is correct. The location of the
struts-tile-defs.xml file is correct in the plugin.

Here is what I have so far..

----> PLUGIN from struts-config.xml

<plug-in className="org.apache.struts.tiles.TilesPlugin" >
<set-property property="definitions-config"
value="/WEB-INF/configs/struts-tile-defs.xml" />
<set-property property="definitions-debug" value="2" />
<set-property property="definitions-parser-details" value="2" />
<set-property property="definitions-parser-validate" value="true"
/>
<set-property property="moduleAware" value="true" />
</plug-in>

----> JSP Page index.jsp...

<%@ page language="java"%>
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tlds/struts-tiles.tld" prefix="tiles" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html:html locale="true">
<head>
<html:base />
<tiles:insert definition="page.default" />
</html:html>


----> struts-tile-defs.xml file entry for page.default

<definition name="page.default"
path="/WEB-INF/pages/layouts/defaultlayout.jsp" />

----> defaultlayout.jsp

<%@ page language="java"%>
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html:html locale="true">
<table border="0" width="80%">
Start Page
</table>
</html:html>

----> The Exception..

javax.servlet.ServletException: Can't get definitions factory from
context.
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:846)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:779)
org.apache.jsp.WEB_002dINF.pages.index_jsp._jspService(org.apache.jsp.WEB_002dINF.pages.index_jsp:86)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

root cause
javax.servlet.jsp.JspException: Can't get definitions factory from
context.
org.apache.struts.taglib.tiles.InsertTag.processDefinitionName(InsertTag.java:583)
org.apache.struts.taglib.tiles.InsertTag.createTagHandler(InsertTag.java:487)
org.apache.struts.taglib.tiles.InsertTag.doStartTag(InsertTag.java:451)
org.apache.jsp.WEB_002dINF.pages.index_jsp._jspx_meth_tiles_insert_0(org.apache.jsp.WEB_002dINF.pages.index_jsp:162)
org.apache.jsp.WEB_002dINF.pages.index_jsp._jspx_meth_html_html_0(org.apache.jsp.WEB_002dINF.pages.index_jsp:123)
org.apache.jsp.WEB_002dINF.pages.index_jsp._jspService(org.apache.jsp.WEB_002dINF.pages.index_jsp:77)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

Wendy Smoak

unread,
Mar 10, 2005, 2:44:27 PM3/10/05
to
<spi...@excite.com> wrote in message

> I've been working on this for a while, but haven't gotten anywhere. I
> chopped it down to a minimum. index.jsp works fine unless there is a
> tile reference, in which case it throws the exception.
>
> I do have the tiles.jar file in my WEB-INF/lib folder. The taglib
> location on the webpages is correct. The location of the
> struts-tile-defs.xml file is correct in the plugin.

What does the log file say when you start your webapp? Mine has:

12:35:42,050 - DEBUG org.apache.struts.tiles.xmlDefinition.I18nFactorySet -
Factory initialized from file '/WEB-INF/tiles-defs.xml'.
12:35:42,050 - INFO org.apache.struts.tiles.TilesPlugin - Tiles definition
factory loaded for module ''.
(Plus other lines listing all the tiles defs and their contents.)

--
Wendy


spi...@excite.com

unread,
Mar 10, 2005, 4:37:58 PM3/10/05
to
When I reload the app, I get the following exceptions in my error
logs... (posting abbreviated thread dump)

Mar 10, 2005 3:27:03 PM org.apache.catalina.core.ApplicationContext log
INFO: HTMLManager: restart: Reloading web application at '/registrar'
Mar 10, 2005 3:27:03 PM org.apache.catalina.core.StandardContext reload
INFO: Reloading this Context has started
Mar 10, 2005 3:27:04 PM org.apache.struts.util.PropertyMessageResources
<init>
INFO: Initializing, config='org.apache.struts.util.LocalStrings',
returnNull=true
Mar 10, 2005 3:27:04 PM org.apache.struts.util.PropertyMessageResources
<init>
INFO: Initializing, config='org.apache.struts.action.ActionResources',
returnNull=true
Mar 10, 2005 3:27:04 PM org.apache.struts.action.ActionServlet
handleConfigException
SEVERE: Parsing error processing resource path
java.net.UnknownHostException: struts.apache.org
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177)
at java.net.Socket.connect(Socket.java:507)
at java.net.Socket.connect(Socket.java:457)
at sun.net.NetworkClient.doConnect(NetworkClient.java:157)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:365)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:477)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:214)
at sun.net.www.http.HttpClient.New(HttpClient.java:287)
at sun.net.www.http.HttpClient.New(HttpClient.java:299)
.....


Mar 10, 2005 3:27:04 PM org.apache.catalina.core.ApplicationContext log
INFO: Marking servlet action as unavailable
Mar 10, 2005 3:27:04 PM org.apache.catalina.core.ApplicationContext log
SEVERE: Servlet /registrar threw load() exception
javax.servlet.UnavailableException: Parsing error processing resource
path
at
org.apache.struts.action.ActionServlet.handleConfigException(ActionServlet.java:1035)
at
org.apache.struts.action.ActionServlet.parseModuleConfigFile(ActionServlet.java:1012)
at
org.apache.struts.action.ActionServlet.initModuleConfig(ActionServlet.java:955)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:470)
at javax.servlet.GenericServlet.init(GenericServlet.java:211)
.....

Mar 10, 2005 3:27:04 PM org.apache.catalina.core.ApplicationContext log
INFO: HTMLManager: list: Listing contexts for virtual host 'localhost'


When I hit the page, I get the error I posted in the first post.. This
error shows in the browser as well as in the logs...

Wendy Smoak

unread,
Mar 10, 2005, 5:24:53 PM3/10/05
to
<spi...@excite.com> wrote:

> Mar 10, 2005 3:27:04 PM org.apache.struts.action.ActionServlet
> handleConfigException
> SEVERE: Parsing error processing resource path
> java.net.UnknownHostException: struts.apache.org

...
>
org.apache.struts.action.ActionServlet.parseModuleConfigFile(ActionServlet.j
ava:1012)

Are you using modules? Looks like there's a problem parsing that config
file.

--
Wendy


spi...@excite.com

unread,
Mar 11, 2005, 5:25:25 PM3/11/05
to
I don't think I'm using modules. Not sure what modules are...

I am thinking that this has to do with the ActionServlet method trying
to parse down either the struts-config.xml file or the
struts-tiles-defs.xml file, but so far I haven't been able to find any
problems with them. I am using MyEclipse to code and it sees no
problems with either xml file.

cch...@m7.com

unread,
Mar 15, 2005, 9:30:09 PM3/15/05
to
First, let me begin by noting that I work for M7. We develop NitroX.
The Struts version has very nice support for Tiles including design
time edits/views. One nice feature about NitroX is it's ability to
detect inconsistencies/errors that span the web app - at design time.
This includes the struts-config.xml, web.xml, java, jsp, tlds, etc.

Since you're already using eclipse, you can download the trial (get the
light version that doesn't include eclipse) have it point your eclipse
environment (or make a copy if it if you're worried) and see if NitroX
can automatically find the errors or provide some hints to the problem.

You can see some of the tiles support here:
http://www.m7.com/tiles.htm

You can download here: www.m7.com/free
I'd recommend the free JSP Editor since it includes trial capabilities
for the Struts IDE and JSP IDE. Remember to get the Express edition so
you don't download eclipse as well.

good luck.

0 new messages