wood burning stoves 2.0*
The moose likes Struts and the fly likes struts2 out of the box problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "struts2 out of the box problem" Watch "struts2 out of the box problem" New topic
Author

struts2 out of the box problem

K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 2242
    
    7

Hello all, I'm starting to use struts2 and found it also need velocity, jython, and spring. Why is that?

I followed the struts2 tutorial and did the hello world example (code for code) but I still get errors. I'm using Sun App Server. My error is something to do with filters in my web.xml listed below.

error:
Exception starting filter struts


web.xml:
<web-app>
<filter>
<filter-name>struts</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>

<filter-mapping>
<filter-name>struts</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>

struts.xml:
<struts>
<package name="tutorial" extends="struts-default">
<action name="HelloWorld" class="tutorial.HelloWorld">
<result>/HelloWorld.jsp</result>
</action>
</package>
</struts>

Some help is appreciated. Thanks


K. Tsang JavaRanch SCJP5 SCJD/OCM-JD OCPJP7 OCPWCD5
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Originally posted by K. Tsang:
I'm starting to use struts2 and found it also need velocity, jython, and spring. Why is that?

Your statement that Struts 2 "needs" these other technologies is not entirely correct. While Struts 2 gives you the option of using velocity templates, you are not required to use them. Struts 2 Scripting support allows you to use Jython to create actions if you want to, but there is no requirement to do so. Struts provides some classes to help you integrate Spring with Struts if you want to, but again there is no requirement for you to use Spring.

Regarding your problem, I suspect it may be related to either missing jar files, or parsing errors in your struts.xml file. Since you haven't shown us a stack trace, there's no way to tell.

Did you start your project by unzipping struts-blank-2.0.11.war or importing it into an IDE? If not, I'd suggest you do so, as this helps you avoid basic configuration errors.
[ May 09, 2008: Message edited by: Merrill Higginson ]

Merrill
Consultant, Sima Solutions
K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 2242
    
    7

Originally posted by Merrill Higginson:


Did you start your project by unzipping struts-blank-2.0.11.war or importing it into an IDE? If not, I'd suggest you do so, as this helps you avoid basic configuration errors.

[ May 09, 2008: Message edited by: Merrill Higginson ]


Hi Merrill, I'm using Sun App Server and I have tried deployng the blank war and it works (without verifier). But with the verifier it has errors. Checking the verifier log it mentioned velocity/jython missing jars.

--------------
FAILED TESTS :
--------------

Test Name : tests.web.WebArchiveClassesLoadable
Test Assertion : All classes in this Web Archive are loadable excluding classes used in JSPs. The test AllJSPsMustBeCompilable takes care of reporting non portable errors in JSP classes. Please refer to J2EE 1.4 Specification Section #8.1.2 for further information.
Test Description : For [ C:\Sun\AppServer\domains\domain1\applications\j2ee-modules\struts2-blank-2.0.11.1 ]

Failed to find following classes:
[
org.apache.velocity.exception.ResourceNotFoundException,
org.apache.velocity.exception.MethodInvocationException,
org.apache.velocity.exception.ParseErrorException,
org.apache.velocity.context.Context,
org.apache.velocity.app.VelocityEngine
]

referenced in the following call stack :

at org.apache.struts2.util.VelocityStrutsUtil
at org.apache.struts2.views.velocity.VelocityManager
at org.apache.struts2.config.BeanSelectionProvider
at org.apache.struts2.dispatcher.Dispatcher
at org.apache.struts2.dispatcher.ActionContextCleanUp
at org.apache.struts2.dispatcher.FilterDispatcher

Failed to find following classes:
[
org.python.core.PyNone,
org.python.core.PySequence,
org.python.core.PyString,
org.python.core.PyInteger,
org.python.core.PyDictionary,
org.python.core.PyJavaInstance,
org.python.core.PyFloat,
org.python.core.PyLong,
org.python.core.PyStringMap,
org.python.core.PyObject,
org.python.core.Py
]

referenced in the following call stack :

at freemarker.ext.jython.JythonWrapper
at freemarker.template.DefaultObjectWrapper
at freemarker.template.WrappingTemplateModel
at freemarker.template.SimpleHash
at freemarker.core.Environment$Namespace
at freemarker.core.Macro$Context
at freemarker.core.Environment
at freemarker.template.TemplateModelException
at freemarker.template.TemplateMethodModel
at freemarker.template.TemplateMethodModelEx
at freemarker.template.GeneralPurposeNothing
at freemarker.template.TemplateModel
at freemarker.template.ObjectWrapper
at org.apache.struts2.views.freemarker.FreemarkerManager
at org.apache.struts2.config.BeanSelectionProvider
at org.apache.struts2.dispatcher.Dispatcher
at org.apache.struts2.dispatcher.ActionContextCleanUp
at org.apache.struts2.dispatcher.FilterDispatcher

Failed to find following classes:
[
org.python.core.PyInteger,
org.python.core.PyObject,
org.python.core.Py
]

referenced in the following call stack :

at freemarker.ext.jython.JythonWrapper$TemplateModelToJythonAdapter
at freemarker.ext.jython.JythonWrapper
at freemarker.template.DefaultObjectWrapper
at freemarker.template.WrappingTemplateModel
at freemarker.template.SimpleHash
at freemarker.core.Environment$Namespace
at freemarker.core.Macro$Context
at freemarker.core.Environment
at freemarker.template.TemplateModelException
at freemarker.template.TemplateMethodModel
at freemarker.template.TemplateMethodModelEx
at freemarker.template.GeneralPurposeNothing
at freemarker.template.TemplateModel
at freemarker.template.ObjectWrapper
at org.apache.struts2.views.freemarker.FreemarkerManager
at org.apache.struts2.config.BeanSelectionProvider
at org.apache.struts2.dispatcher.Dispatcher
at org.apache.struts2.dispatcher.ActionContextCleanUp
at org.apache.struts2.dispatcher.FilterDispatcher

Failed to find following classes:
[
org.python.core.PyObject,
org.python.core.Py,
org.python.core.PyException
]

referenced in the following call stack :

at freemarker.ext.jython.JythonModel
at freemarker.ext.jython.JythonWrapper
at freemarker.template.DefaultObjectWrapper
at freemarker.template.WrappingTemplateModel
at freemarker.template.SimpleHash
at freemarker.core.Environment$Namespace
at freemarker.core.Macro$Context
at freemarker.core.Environment
at freemarker.template.TemplateModelException
at freemarker.template.TemplateMethodModel
at freemarker.template.TemplateMethodModelEx
at freemarker.template.GeneralPurposeNothing
at freemarker.template.TemplateModel
at freemarker.template.ObjectWrapper
at org.apache.struts2.views.freemarker.FreemarkerManager
at org.apache.struts2.config.BeanSelectionProvider
at org.apache.struts2.dispatcher.Dispatcher
at org.apache.struts2.dispatcher.ActionContextCleanUp
at org.apache.struts2.dispatcher.FilterDispatcher

Failed to find following classes:
[
org.python.core.PyClass,
org.python.core.PyObject,
org.python.core.PyException
]

referenced in the following call stack :

at freemarker.ext.jython.JythonHashModel
at freemarker.ext.jython.JythonWrapper
at freemarker.template.DefaultObjectWrapper
at freemarker.template.WrappingTemplateModel
at freemarker.template.SimpleHash
at freemarker.core.Environment$Namespace
at freemarker.core.Macro$Context
at freemarker.core.Environment
at freemarker.template.TemplateModelException
at freemarker.template.TemplateMethodModel
at freemarker.template.TemplateMethodModelEx
at freemarker.template.GeneralPurposeNothing
at freemarker.template.TemplateModel
at freemarker.template.ObjectWrapper
at org.apache.struts2.views.freemarker.FreemarkerManager
at org.apache.struts2.config.BeanSelectionProvider
at org.apache.struts2.dispatcher.Dispatcher
at org.apache.struts2.dispatcher.ActionContextCleanUp
at org.apache.struts2.dispatcher.FilterDispatcher

Failed to find following classes:
[
org.python.core.PyObject
]

referenced in the following call stack :

at freemarker.ext.jython.JythonNumberModel$1
at freemarker.ext.jython.JythonNumberModel
at freemarker.ext.jython.JythonWrapper
at freemarker.template.DefaultObjectWrapper
at freemarker.template.WrappingTemplateModel
at freemarker.template.SimpleHash
at freemarker.core.Environment$Namespace
at freemarker.core.Macro$Context
at freemarker.core.Environment
at freemarker.template.TemplateModelException
at freemarker.template.TemplateMethodModel
at freemarker.template.TemplateMethodModelEx
at freemarker.template.GeneralPurposeNothing
at freemarker.template.TemplateModel
at freemarker.template.ObjectWrapper
at org.apache.struts2.views.freemarker.FreemarkerManager
at org.apache.struts2.config.BeanSelectionProvider
at org.apache.struts2.dispatcher.Dispatcher
at org.apache.struts2.dispatcher.ActionContextCleanUp
at org.apache.struts2.dispatcher.FilterDispatcher

Failed to find following classes:
[
org.python.core.PyObject
]

referenced in the following call stack :

at freemarker.ext.jython.JythonSequenceModel$1
at freemarker.ext.jython.JythonSequenceModel
at freemarker.ext.jython.JythonWrapper
at freemarker.template.DefaultObjectWrapper
at freemarker.template.WrappingTemplateModel
at freemarker.template.SimpleHash
at freemarker.core.Environment$Namespace
at freemarker.core.Macro$Context
at freemarker.core.Environment
at freemarker.template.TemplateModelException
at freemarker.template.TemplateMethodModel
at freemarker.template.TemplateMethodModelEx
at freemarker.template.GeneralPurposeNothing
at freemarker.template.TemplateModel
at freemarker.template.ObjectWrapper
at org.apache.struts2.views.freemarker.FreemarkerManager
at org.apache.struts2.config.BeanSelectionProvider
at org.apache.struts2.dispatcher.Dispatcher
at org.apache.struts2.dispatcher.ActionContextCleanUp
at org.apache.struts2.dispatcher.FilterDispatcher

Failed to find following classes:
[
org.python.core.PyObject
]

referenced in the following call stack :

at freemarker.ext.jython.JythonHashModel$1
at freemarker.ext.jython.JythonHashModel
at freemarker.ext.jython.JythonWrapper
at freemarker.template.DefaultObjectWrapper
at freemarker.template.WrappingTemplateModel
at freemarker.template.SimpleHash
at freemarker.core.Environment$Namespace
at freemarker.core.Macro$Context
at freemarker.core.Environment
at freemarker.template.TemplateModelException
at freemarker.template.TemplateMethodModel
at freemarker.template.TemplateMethodModelEx
at freemarker.template.GeneralPurposeNothing
at freemarker.template.TemplateModel
at freemarker.template.ObjectWrapper
at org.apache.struts2.views.freemarker.FreemarkerManager
at org.apache.struts2.config.BeanSelectionProvider
at org.apache.struts2.dispatcher.Dispatcher
at org.apache.struts2.dispatcher.ActionContextCleanUp
at org.apache.struts2.dispatcher.FilterDispatcher

Failed to find following classes:
[
javax.portlet.PortletConfig,
javax.portlet.ActionResponse,
javax.portlet.PortletContext,
javax.portlet.ActionRequest,
javax.portlet.PortletRequest,
javax.portlet.RenderRequest,
javax.portlet.PortletResponse,
javax.portlet.RenderResponse
]

referenced in the following call stack :

at org.apache.struts2.portlet.context.PortletActionContext
at org.apache.struts2.components.URL
at org.apache.struts2.views.jsp.URLTag
at example.HelloWorld.jsp

Failed to find following classes:
[
org.apache.velocity.app.Velocity,
org.apache.velocity.VelocityContext,
org.apache.velocity.tools.view.servlet.ServletToolboxManager,
org.apache.velocity.tools.view.ToolboxManager,
org.apache.velocity.tools.view.context.ChainedContext,
org.apache.velocity.context.Context,
org.apache.velocity.app.VelocityEngine
]

referenced in the following call stack :

at org.apache.struts2.views.velocity.VelocityManager
at org.apache.struts2.config.BeanSelectionProvider
at org.apache.struts2.dispatcher.Dispatcher
at org.apache.struts2.dispatcher.ActionContextCleanUp
at org.apache.struts2.dispatcher.FilterDispatcher

Failed to find following classes:
[
org.python.core.PyObject
]

referenced in the following call stack :

at freemarker.ext.jython.JythonModel$1
at freemarker.ext.jython.JythonModel
at freemarker.ext.jython.JythonWrapper
at freemarker.template.DefaultObjectWrapper
at freemarker.template.WrappingTemplateModel
at freemarker.template.SimpleHash
at freemarker.core.Environment$Namespace
at freemarker.core.Macro$Context
at freemarker.core.Environment
at freemarker.template.TemplateModelException
at freemarker.template.TemplateMethodModel
at freemarker.template.TemplateMethodModelEx
at freemarker.template.GeneralPurposeNothing
at freemarker.template.TemplateModel
at freemarker.template.ObjectWrapper
at org.apache.struts2.views.freemarker.FreemarkerManager
at org.apache.struts2.config.BeanSelectionProvider
at org.apache.struts2.dispatcher.Dispatcher
at org.apache.struts2.dispatcher.ActionContextCleanUp
at org.apache.struts2.dispatcher.FilterDispatcher

Failed to find following classes:
[
org.python.core.PyFloat,
org.python.core.PyObject,
org.python.core.Py,
org.python.core.PyException
]

referenced in the following call stack :

at freemarker.ext.jython.JythonNumberModel
at freemarker.ext.jython.JythonWrapper
at freemarker.template.DefaultObjectWrapper
at freemarker.template.WrappingTemplateModel
at freemarker.template.SimpleHash
at freemarker.core.Environment$Namespace
at freemarker.core.Macro$Context
at freemarker.core.Environment
at freemarker.template.TemplateModelException
at freemarker.template.TemplateMethodModel
at freemarker.template.TemplateMethodModelEx
at freemarker.template.GeneralPurposeNothing
at freemarker.template.TemplateModel
at freemarker.template.ObjectWrapper
at org.apache.struts2.views.freemarker.FreemarkerManager
at org.apache.struts2.config.BeanSelectionProvider
at org.apache.struts2.dispatcher.Dispatcher
at org.apache.struts2.dispatcher.ActionContextCleanUp
at org.apache.struts2.dispatcher.FilterDispatcher

Failed to find following classes:
[
org.apache.velocity.VelocityContext,
org.apache.velocity.runtime.resource.Resource,
org.apache.velocity.util.introspection.IntrospectionCacheData,
org.apache.velocity.app.event.EventCartridge
]

referenced in the following call stack :

at org.apache.struts2.views.velocity.StrutsVelocityContext
at org.apache.struts2.views.velocity.VelocityManager
at org.apache.struts2.config.BeanSelectionProvider
at org.apache.struts2.dispatcher.Dispatcher
at org.apache.struts2.dispatcher.ActionContextCleanUp
at org.apache.struts2.dispatcher.FilterDispatcher

Failed to find following classes:
[
javax.portlet.WindowState,
javax.portlet.PortletMode,
javax.portlet.RenderRequest,
javax.portlet.RenderResponse,
javax.portlet.PortletURL,
javax.portlet.PortletSecurityException
]

referenced in the following call stack :

at org.apache.struts2.portlet.util.PortletUrlHelper
at org.apache.struts2.components.URL
at org.apache.struts2.views.jsp.URLTag
at example.HelloWorld.jsp

Failed to find following classes:
[
org.python.core.PyObject,
org.python.core.PyException
]

referenced in the following call stack :

at freemarker.ext.jython.JythonSequenceModel
at freemarker.ext.jython.JythonWrapper
at freemarker.template.DefaultObjectWrapper
at freemarker.template.WrappingTemplateModel
at freemarker.template.SimpleHash
at freemarker.core.Environment$Namespace
at freemarker.core.Macro$Context
at freemarker.core.Environment
at freemarker.template.TemplateModelException
at freemarker.template.TemplateMethodModel
at freemarker.template.TemplateMethodModelEx
at freemarker.template.GeneralPurposeNothing
at freemarker.template.TemplateModel
at freemarker.template.ObjectWrapper
at org.apache.struts2.views.freemarker.FreemarkerManager
at org.apache.struts2.config.BeanSelectionProvider
at org.apache.struts2.dispatcher.Dispatcher
at org.apache.struts2.dispatcher.ActionContextCleanUp
at org.apache.struts2.dispatcher.FilterDispatcher


Please either bundle the above mentioned classes in the application or use optional packaging support for them.


----------------------------------
END OF STATIC VERIFICATION RESULTS
----------------------------------


This is why I have doubts.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Using a tool like the Sun verifier isn't very useful with a framework like Struts 2. As I mentioned earlier, there are a lot of "hooks" into other technologies that are entirely optional. The verifier is going to find all these dependencies, but unless you happen to be using them it doesn't really matter.

If you do decide to use the optional technologies such as Spring and Jython, it's up to you to download the necessary jar files from the appropriate website. You can download the Jython jar files from here
.
[ May 10, 2008: Message edited by: Merrill Higginson ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: struts2 out of the box problem
 
Similar Threads
Struts2 integration with Spring Security
Request not able to reach Action class in Struts2
Struts2 with RAD7
Need Help - Struts2 s:select issue - Urgent
Struts2 Action problem Problem