Struts2 file upload - No mapping found for dependency - file-upload

I'm using Struts 2.3.20.1 with Commons File Upload 1.3.1 and Commons IO 2.4 to upload a (CSV) file. When i try to do uploading, there is this error in server log:
ERROR [io.undertow.request] (default task-24) UT005023: Exception
handling request to /private/createDatasetFromCSV:
java.lang.RuntimeException: java.lang.RuntimeException:
java.lang.RuntimeException:
com.opensymphony.xwork2.inject.DependencyException:
com.opensymphony.xwork2.inject.ContainerImpl$MissingDependencyException:
No mapping found for dependency [type=java.lang.String,
name='struts.multipart.bufferSize'] in public void
org.apache.struts2.dispatcher.multipart.JakartaStreamMultiPartRequest.setBufferSize(java.lang.String).
I've followed the official guidelines here, creating an Action class, using the JSP form tags and so on.
In struts.xml, for file upload section, I have:
<constant name="struts.multipart.maxSize" value="209715200" />
<constant name="struts.multipart.parser" value="jakarta-stream" />

The version of Struts should be updated due to WW-4466.
With WW-3025 there was a new config constant introduced: struts.multipart.bufferSize
Currently it is set as required and hence applications must specify it. The default value is always overridden.
-> should be required = false
Fix Version/s: 2.3.24

Related

EclipseLink Moxy with Java11

I asked this questions already here:
https://www.eclipse.org/forums/index.php/t/1098133/
Now, after 3 weeks, i hope to have luck to reach a response here in stackoverflow.
I have a RCP applcation using MOXy to parse complex XML, the annotated classes are generated by XJC, and the package contains a ObjectFactory and a jaxb.properties pointing to MOXy.
The problem: The application works with Java8, but starting the application with Java11, i get this exception:
java.lang.RuntimeException: javax.xml.bind.JAXBException
- with linked exception:
[Exception [EclipseLink-50000] (Eclipse Persistence Services - 2.7.4.v20190115-ad5b7c6b2a): org.eclipse.persistence.exceptions.JAXBException
Exception Description: The context path mypackage contains no ObjectFactory or jaxb.index, no external metadata was found in properties Map, and sessions.xml was found or was invalid.
Internal Exception: Exception [EclipseLink-7095] (Eclipse Persistence Services - 2.7.4.v20190115-ad5b7c6b2a): org.eclipse.persistence.exceptions.ValidationException
Exception Description: The sessions.xml resource [sessions.xml] was not found on the resource path. Check that the resource name/path and classloader passed to the SessionManager.getSession are correct. The sessions.xml should be included in the root of the application's deployed jar, if the sessions.xml is deployed in a sub-directory in the application's jar ensure that the correct resource path using "/" not "\" is used.]
My target platform contains:
org.eclipse.persistence.moxy_2.7.4....jar
jaxb-osgi-2.3.2.jar
jakarta.activation.jar
jakarta.xml.bind-api.jar
I use Multi-Release: true to be able to handle Java8 vs. Java9+.
In the main MANIFEST.FM i require org.eclipse.persistence.moxy.
In the versions/9/OSGI-INF/MANIFEST.FM I add the import packages: com.sun.xml.bind.v2, javax.xml.bind
To start the application in the Eclipse run configuration dialog, i switch the JRE Java8 vs Java11, and in the plugins tab, i remove (J8) or add (J11) com.sun.xml.bind.jaxb-osgi (jaxb-osgi.jar) to make it startable.
Can someone help?
regards
Frank

Netbeans 8.2 : GlassFish 5 Server, deploy, null false - The module has not been deployed

I'm a new Java WebEnt student, and I'm having issues deploying some basic Entity Classes and JSF Pages.
I loaded up some things without any edit to the files, and when trying to deploy. I get the "\nbproject\build-imp.xml:1045 The module has not been deployed" message. I checked the GlassFish server and here is the beginning log:
java.io.IOException: org.xml.sax.SAXParseException; lineNumber: 10;
columnNumber: 18; Deployment descriptor file META-INF/persistence.xml in
archive [classes]. cvc-complex-type.2.4.d: Invalid content was found
starting with element 'properties'. No child element is expected at this point.
The rest of the log is pasted below
https://pastebin.com/7rXsyRit
EDIT
Pastebin to include the XML files in WEB-INF and persistence.xml
https://pastebin.com/6kRJyA54
Thanks for the help/advice
Yes the issue was <properties/> after I had removed that and tried to deploy, I had gotten that error which following the instructions in this link had resolved.

Where do i put JSTL taglibs after downloading them

kept getting this error when i run my web application :
HTTP Status 500 - The absolute uri: http://java.sun.com/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application
type Exception report
message The absolute uri: http://java.sun.com/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application
description The server encountered an internal error that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:56)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:445)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:117)
org.apache.jasper.compiler.TagLibraryInfoImpl.generateTLDLocation(TagLibraryInfoImpl.java:311)
org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:152)
org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:410)
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:475)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1427)
org.apache.jasper.compiler.Parser.parse(Parser.java:138)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:242)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:102)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:198)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:373)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:646)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
myPackage.Register.processRequest(Register.java:63)
myPackage.Register.doGet(Register.java:81)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.42 logs.
Apache Tomcat/7.0.42
and when i did some search i found that i need to download JSTL taglibs, i downloaded it but i don't know what to do with the files now, is there a specific folder i should put them so that my code runs fine?
From eclipse:
1.
Right Click --> properties --> Java Build Path --> Libraries -- > Add external jars
this will add jar to your eclipse biuld path
Right Click --> Deployment Assembly--> Java Build Path entries --> add JSTL jar
this will add the jar to WAR file when deploying it to the server.

Error in transporting an application from development worklight to Worklight Server Consumer Edition

I am using IBM Worklight environment. I have created a small application "SampleHybridProject" using Worklight Developer studio and tested it successfully.
Now when I am trying to deploy it on the Worklight Server Consumer Edition, and hitting the following URL: http://mymachine.com:9080/SampleHybridProject/console
I am getting this error in my browser:
Error 404: com.ibm.ws.webcontainer.servlet.exception.NoTargetForURIException: No target servlet configured for uri: /SampleHybridProject/console
I am using Worklight Edition 5.0.6. The Worklight Server is default "WAS with Liberty profile".
Here are the properties that I changed in worklight.properties file.
publicWorkLightHostname=localhost
publicWorkLightProtocol=http
publicWorkLightPort=9080
publicWorkLightContext=/SampleHybridProject
wl.db.type=MYSQL
wl.db.url=jdbc:mysql://mysqlinstalledonmypc:3306/WRKLGHT
wl.db.username=root
wl.db.password=admin
Here are the changes that I made in application-descriptor.xml:
<worklightServerRootURL>http://${local.IPAddress}:9080/SampleHybridProject</worklightServerRootURL>
Can you tell me what I am doing wrong or what I need to do?
I have found the problem and solved it. The problem is I was having this error in console.log file:
Error creating bean with name 'txManager' defined in URL [jar:file:/C:/ProgramData/IBM/Worklight/WAS85liberty-server/wlp/usr/shared/resou‌​rces/lib/worklight-jee-library.jar!/conf/core.xml]: Invocation of init method failed; nested exception is java.lang.LinkageError: loader constraint violation: loader (instance of com/ibm/ws/classloading/internal/UnifiedClassLoader) previously initiated loading for a different type with name "javax/sql/DataSource"
This was because I had a jar in the server/lib folder of my project which was causing this problem. I removed the jar from server/lib folder and redeployed the .war file. Now the console is getting loaded.
Are you getting any deployment errors in your liberty logs? A 404 on the context root generally means either the WAR was not found, or the context root defaults to something other than 'SampleHybridProject'. If the WAR appears to be loading correctly, it will output where it is listening on similar to:
[AUDIT ] CWWKT0016I: Web application available (default_host): http://[hostname]:port/SampleHybridProject/*
If it says the context root is anything other than SampleHybridProject, you can set it in the tag in liberty's server.xml:
<application id="SampleHybridProject" name="SampleHybridProject"
location="SampleHybridProject.war" type="war"
context-root="SampleHybridProject">
...
</application>

Drools Guvnor on Glassfish error

I'm trying to deploy Guvnor (guvnor-5.5.0.Final-tomcat-6.0) to a fresh
glassfish server ( 3.1.2.2 build 5) and am getting the error below.
I did try the other WARs without any luck and I get the same error on
OSX and windows.
Error occurred during deployment: Exception while loading the app :
java.lang.IllegalStateException: ContainerBase.addChild: start:
org.apache.catalina.LifecycleException:
java.lang.NoClassDefFoundError: org/apache/AnnotationProcessor. Please
see server.log for more details
Are there any work-around for this ?
Add the jasper-xxx.jar to your lib. It should work. If you deploy in tomcat, it should be in catalina.jar.
Unfortunately JBOSS 7 doesn't use tomcat instead it uses JBossWeb. That's why you have this problem.
Take the guvnor-5.5.0.Final-jboss-as-7.0.war binary war file
add dom4j-1.6.1.jar
remove javassit*.jars
add resteasy-jaxb-provider-2.2.3.GA.jar
add resteasy-jaxrs-2.2.3.GA.jar
Add the a glassfish-web.xml file to WEB-INF https://github.com/snowch/glassfish-guvnor/blob/master/src/main/webapp/WEB-INF/glassfish-web.xml
Replace WEB-INF/web.xml with this https://github.com/snowch/glassfish-guvnor/blob/master/src/main/webapp/WEB-INF/web.xml
Repackage the binary war file and deploy to glassfish