-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hello everyone,
We used ZK 7.0.1 and java 7. Users can upload file on ZK web pages. Our development and test environment OK. But prod environment has following exception;
We checked file size but independent of file size this exception occur each time.
Probably ZK8 fix it. Is ZK8 compatible with Java 7 ? Thanks for help.
2019-02-14 11:33:11,557 ERROR (AuUploader.java:233) - Failed to upload java.lang.NullPointerException
at org.zkoss.zk.au.http.AuUploader.service(AuUploader.java:115) at org.zkoss.zk.au.http.DHtmlUpdateServlet.doGet(DHtmlUpdateServlet.java:459) at org.zkoss.zk.au.http.DHtmlUpdateServlet.doPost(DHtmlUpdateServlet.java:494) at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227) at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125 at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:301) at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60) at com.i2i.prm.webapp.base.RequestLoggingFilter.doFilter(RequestLoggingFilter.java:36) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60) at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3748) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3714) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120) at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2283) at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2182) at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1499) at weblogic.work.ExecuteThread.execute(ExecuteThread.java:263) at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
Hi Armagan,
Thanks for the updated info. Do you have source access for the AuUploader class? (should be available trough maven / in the download page) I'd recommend putting a breakpoint at org.zkoss.zk.au.http.AuUploader.service(AuUploader.java:115) and check for the variable that is returning a null value.
If this is a production / dev scenario, it might be that your prod server is behind a reverse proxy or a gateway which rewrites the requests and removes the wid / sid from the parameter strings. Without those, the uploader wouldn't find the upload id, which could cause a NPE when receiving the file. Not sure without confirming on your side though, so remote debugging is the easiest road to get more info.
Hi again MDuchemin,
Sorry for late response.
We have no grant for prod server, therefore i cant do remote debug.
But belong to AuUploader.class line (line 115 Object sinfo = size.get(key);) following;
{
if ("uploadInfo".equals(request.getParameter("cmd")))
{
uuid = XMLs.encodeText(request.getParameter("wid"));
sid = XMLs.encodeText(request.getParameter("sid"));
desktop = ((WebAppCtrl)sess.getWebApp()).getDesktopCache(sess).getDesktop(XMLs.encodeText(request.getParameter("dtid")));
Map<String, Integer> percent = Generics.cast((Map)desktop.getAttribute("org.zkoss.zk.upload.percent"));
Map<String, Object> size = Generics.cast((Map)desktop.getAttribute("org.zkoss.zk.upload.size"));
String key = uuid + '_' + sid;
Object sinfo = size.get(key);
desktop object has no attributes like "org.zkoss.zk.upload.size", therefore size object is null and throw NPE.
As you said; maybe prod server rewrites wid/sid from the parameters string, because other scenario there is no exception like this.
If as you say, so what can we do fix it? Only way is upgrade to ZK8 ?
Thanks for your interest.
Hi armagan,
If you find the reason why the desktop doesn't hold parameters there, you might find a solution. I'd recommend checking the desktop ID in a breakpoint of the main thread, and in this breakpoint. Perhaps the desktop is not retrieved properly due to server configuration (request parameters lost,session expiration policy, load-balancing or session transfer without the Serialization UI settings, etc). If the desktop ID is correct (same between main page and upload thread), then the question becomes why does the default parameter for max size disapear from the desktop attributes.
I'd recommend going back to the same breakpoint in the uploader thread, and going down the stack untill you find a class that lets you see the request. From there, try to get the request headers and parameters, to see if the server has received the expected info (desktop ID, upload data, etc) or if this data is changed or lost.
I'd always recommend trying out the latest versions, as there are always bug fixes and stability improvements, but I don't think there was any bug fix matching that description. Doesn't hurt to try, but I wouldn't necessarily bet on update fixing this issue.
You mentioned that you have a production and a test server, with this code working on test, but not on prod. I'd recommend searching for configuration differences between the 2 instances. If you can, I'd also recommend doing a direct test to the prod webserver directly (no pass-through, no reverse proxy, no gateways...) to see if the server itself is the cause of the lost info, or if this is a factor of the middleware.
Asked: 2019-02-15 22:14:47 +0800
Seen: 20 times
Last updated: May 03 '19
ZK 7.0.3 doAfterCompose is not called for GenericForwardComposer
Power of ZK Calender With Charts 2 and Other Components
ZK7 atlantic theme: vlayout/hlayout spacing
Structuring zul-code without includes?
css zk 7.0.3 with ie9 not work
Change listbox MVVM template with Java or how to let user change column order