ClassNotFoundException StrutsPrepareAndExecuteFilter in struts2 [duplicate] - struts2

This question already has answers here:
java.lang.ClassNotFoundException: org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter when starting Simple Struts2 Application
(3 answers)
Closed 6 years ago.
I got this error when starting the app.
SEVERE: Exception starting filter struts2 java.lang.ClassNotFoundException:
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
and the server gave this error twice in a row.
I have struts2-core-2.3.15.2.jar in WEB-INF/lib and imported into build path. I do not understand why StrutsPrepareAndExecuteFilter cannot be found.
The application can get started. thats no problem. the problem is because of this error, struts2 cannot redirect the action.
I use tomcat 7 and struts2 2.3.16. It's Tomcat 7, the servelet-api is not 3.0 I guess. I tried to put servelet-api-3.0 in tomcat/lib but it's not compatible.
What's the problem?
Jars used:

The following minimum jars should be on your classpath:
asm-3.3.jar
asm-commons-3.3.jar
asm-tree-3.3.jar
commons-fileupload-1.3.jar
commons-io-2.2.jar
commons-lang3-3.1.jar
commons-logging-1.1.3.jar
freemarker-2.3.19.jar
javassist-3.11.0.GA.jar
log4j-1.2.17.jar
ognl-3.0.6.jar
struts2-core-2.3.16.jar
xwork-core-2.3.16.jar
You can also follow How To Create A Struts 2 Web Application.

the runtime problem was solved eventually by replacing the json jars package.. i think its the versions problems. it is a whole package. i dont remember the link now..
so it seems its better get the jar files from one source but not pick different version.. and these 6 jars should be included together. of course, be careful with the versions. i dont know mine. but it works.
commons-lang.jar
commons-logging.jar
commons-beanutils.jar
commons-collections.jar
json-lib-2.2.2-jdk15.jar
ezmorph.jar
BUT this problem is still there... I have this error, but the app can run
java.lang.ClassNotFoundException:
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter

If you use Intellij IDEA, the reason maybe you did not add struts-xxx.xxx.jar file to artifacts.To solve this problem you just need open Project structure >> problems >> add struts x.x.x to artifacts(righit click on the problem option)
It works for me ,may it helps you.

If you are using external JRE, it may not work.
Instead use the internal JRE (which is inside JDK)
In the project
Go to Build path
-->Configure Build path
-->Libraries
-->Add Libraries
-->Installed JRRs
--> Give path of "JDK"(and not external JRE)
-->Finish.
Refresh the project and it would work.

Related

Customising org.primefaces.component.messages.MessagesRenderer [duplicate]

This question already has answers here:
Overriding JSF Primefaces Message Tag
(2 answers)
Closed 6 years ago.
Background
We have an on-line application using JSF2.0 (One that comes with Web-sphere application server v8.5.5) + PrimeFaces 5.0
Requirement
For a particular requirement, we have to customise org.primefaces.component.messages.MessagesRenderer. We noticed that there is no clean way to customise org.primefaces.component.messages.MessagesRenderer .
As a work around we created a class org.primefaces.component.messages.MessagesRenderer in Web Source folder. This class ends up in WebInf/classes
Issue
Upon initial deployment prime-faces.jar loaded the version of org.primefaces.component.messages.MessagesRenderer in WebInf/classes and every thing worked as expected.
Upon further investigation it became apparent that the war class loading behaviour is inconsistent. We couldn't guarantee which version of org.primefaces.component.messages.MessagesRenderer is loaded by the Prime Faces frame work. At times the application loads the version of org.primefaces.component.messages.MessagesRenderer from WebInf/classes other times it loads the version from WebInf/lib/primefaces-5.0.jar
The Servlet3.0 clearly states
The Web application class loader must load classes from the WEB-INF/classes
Directory first, and then from library JARs in the WEB-INF/lib directory.
So not sure why we are experiencing this inconsistent behaviour.
What was tried & suggested
We tried referencing the
org.primefaces.component.messages.MessagesRenderer in servlet startup
listener.
One of my colleagues suggested to remove org.primefaces.component.messages.MessagesRenderer in primefaces jar
file. This would resolve the issue, but customising third party library is against our company policy.
Summary
In conclusion what we are really looking is for a way to customise org.primefaces.component.messages.MessagesRenderer in prime-faces without patching the primefaces jar file.
Just found an solution for this issue
Adding the following snippet of code in applications faces-config.xml allows me to override the MessageRenderer in primefaces
<renderer>
<component-family>org.primefaces.component</component-family>
<renderer-type>org.primefaces.component.MessageRenderer</renderer-type>
<renderer-class>my.CustomRenderer</renderer-class>
</renderer>

BUILD FAILED : a module is not authorized to depend on itself: com.vaadin.external.atmosphere#atmosphere-compat-jbossweb;2.0.1-vaadin1

my project is VaadinFramework based project.I was run build.xml file through jenkins.
i struck with error like this.
/build.xml:28: impossible to resolve dependencies:
java.lang.IllegalArgumentException: a module is not authorized to depend on itself: com.vaadin.external.atmosphere#atmosphere-compat-jbossweb;2.0.1-vaadin1,
if you know the answer please help me out
the above three addons i was added in ivy.xml file.my problem was salved.
Becouse my project is vaadin based project.so it using vaadin dependencies in compile and runtime.
anyhow im also looking otherways to soughtout this problem inspite of addons.

InvientCharts Vaadin not working

I am working with Vaadin 6 and want to use InvientCharts because it is free.
After compiling the widgetset, all vaadins component instead of invientCharts are working. The error which appears as text on my app is the following:
After trying everything, including setting up a complete new project, I followed this tutorial: http://www.nightswatch.de/?x=entry:entry120125-234412
But it is still not working and shows the same error.
Has anyone an idea what is going on here?
Thanks in advance!
When you receive the message that the widgetset does not contain implementation of XY,
then usually you have forgotten to compile it with the additional jar files or you did not specify the new widgetset.
The nightswatch example is incomplete, you need to compile the widgetset.
Simplest would be to use the maven build script to build all dependencies and compile stuff as needed (or use eclipse for this)

vaadin 7: Widgetset does not contain implementation

I am trying my hands on vaadin and would like to use gantt chat add-on in my vaading 7 project.
https://vaadin.com/directory#addon/vaadin-gantt-diagram:vaadin
since this is not compatible with vaadin 7, I am trying to fix some code from the add-on to make it compatible with vaadin 7.
I checked out source code of vaadin-6.8 from repository and vaadin-gantt (add-on) from available downloads.
I changed the code a bit in vaadin-6.8 and built. I am using this customized vaadin-6.8 jar inside vaadin-gantt add-on. Now I am able to build vaadin-gantt add-on by using customized vaadin-6.8 jar. I want to use this add-on inside vaadin-7 project.
compiling went through, but i am getting below message on console while displaying gantt chart
"Widgetset does not contain implementation for ru.bazon.vaadin.ganttdiagram.canvas.GanttDiagramCanvas. Check its component connector's #Connect mapping, widgetsets GWT module description file and re-compile your widgetset. In case you have downloaded a vaadin add-on package, you might want to refer to add-on instructions."
I compiled the gantt widgetset using eclipse plugin and could see the below entry in my projects *.gwt.xml file
I would like to make use of gannt chart add-on for vaadin-7. I didn't find any other add-on for vaadin-7 apart from this which is not compatible with vaadin 7.
any pointers?
Regards,
Azhar
Please make sure You have added #Widgetset("path of *.gwt.xml") on your main UI class.I have solved by adding this
I just had this error as well and it was caused by missing source files in the addon jar. Both .java and .class files must be present in the addon jar file as GWT compiles from sources. But most likely the addons form vaadin directory should include also the sources. And ofcourse don't forget to compile the widgetset and themes after importing your addon to your project.
Just leaving this here in case someone has the same case as I had. Our project is in Vaadin 8, and we already had #Widgetset("com.company.OurWidgetSet") as annotation on our UI-extending class.
However, I still received the same error as OP when accessing a pop-up of a separated component. Although we did try to migrate this component of ours to Vaadin 8 in the past, due to lack of time to do this properly, it was still mostly using Vaadin7 imports and functionality.
Because of this I had to add the following to our OurWidgetSet.gwt.xml file (within the <module>-tag) in our main project, to fix the functionality of the used component:
<inherits name="com.vaadin.v7.Vaadin7WidgetSet" />
just had the same issue as well, another thing to make sure if you use vaadin is the web.xml inside the WEB-INF folder of deployed resources.
Make sure the widgetset is also specified there:
<init-param>
<description>AWidgetSet</description>
<param-name>widgetset</param-name>
<param-value>com.example.a.widgetset.AWidgetset</param-value>
</init-param>
When using Java Config with Annotation #VaadinServletConfiguration an additional Solution is to add this as Annotation-Parameter widgetset:
#VaadinServletConfiguration(ui = MyUI.class, productionMode = true, heartbeatInterval = 500, closeIdleSessions = true, widgetset = "com.myapp.MyWidgetset")

Grails compilation errors with xml-apis - SAXParserException

My lib directory only has 1 jar. xml-apis 2.8.1. When I remove it, everything compiles. This is the error I get:
java.lang.LinkageError: Class org/xml/sax/SAXParseException violates loader constraints
Any idea what's going on?
The xml-apis classes are included in the JRE. This issue is also known as being part of the "jar hell" problem, and - in the JVM space - typically occurs with XML libraries being included multiple times in the classpath, i.e. from the JRE rt.jar, by the application server or as a dependency of third-party libraries. This leads to LinkageError exceptions as the one provided above.
This is one example that describes how to solve this issue in Grails 1.3.7.

Resources