Hỏi đáp
Chia sẻ kiến thức, cùng nhau phát triển
Tình hình em gặp lỗi này khi deploy ứng dụng lên server Jboss , local thì thì chạy hoàn toàn bình thường, không rõ là phải set quyền hay cấu hình thế nào để server chạy được. Em cám ơn team
Code :
InputStream inputstream = fileUpload.getInputstream();
XSSFWorkbook workbook = new XSSFWorkbook(inputstream);
checkExcelError(workbook);
if (listDisplayImportNoError != null && listDisplayImportNoError.size() > 0) {
endableEffectImport();
} else {
disableEffectImport();
effectLoadListPrice = false;
}
if (errorImport > 0) {
String k = new Long(new Date().getTime()).toString() + ".xlsx";
FileOutputStream out = new FileOutputStream(k); // <-----line 760
workbook.write(out);
// downloadExcelFile(f);
out.flush();
out.close();
checkFileExcelExport = new DefaultStreamedContent(new FileInputStream(k),
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"price-import-file-template-checked.xlsx");
effectCheckFile = false;
} else {
effectCheckFile = true;
}
Error:
2017-09-19 17:39:51,463 ERROR [stderr] (default task-36) java.io.FileNotFoundException: 1505817591462.xlsx (Permission denied)
2017-09-19 17:39:51,463 ERROR [stderr] (default task-36) at java.io.FileOutputStream.open0(Native Method)
2017-09-19 17:39:51,463 ERROR [stderr] (default task-36) at java.io.FileOutputStream.open(FileOutputStream.java:270)
2017-09-19 17:39:51,463 ERROR [stderr] (default task-36) at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
2017-09-19 17:39:51,463 ERROR [stderr] (default task-36) at java.io.FileOutputStream.<init>(FileOutputStream.java:101)
2017-09-19 17:39:51,463 ERROR [stderr] (default task-36) at com.ftu.rating.controller.PriceController.readFileExcel(PriceController.java:760)
2017-09-19 17:39:51,463 ERROR [stderr] (default task-36) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2017-09-19 17:39:51,463 ERROR [stderr] (default task-36) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
2017-09-19 17:39:51,463 ERROR [stderr] (default task-36) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2017-09-19 17:39:51,463 ERROR [stderr] (default task-36) at java.lang.reflect.Method.invoke(Method.java:498)
2017-09-19 17:39:51,463 ERROR [stderr] (default task-36) at javax.el.ELUtil.invokeMethod(ELUtil.java:300)
2017-09-19 17:39:51,463 ERROR [stderr] (default task-36) at javax.el.BeanELResolver.invoke(BeanELResolver.java:415)
2017-09-19 17:39:51,463 ERROR [stderr] (default task-36) at javax.el.CompositeELResolver.invoke(CompositeELResolver.java:256)
2017-09-19 17:39:51,463 ERROR [stderr] (default task-36) at com.sun.el.parser.AstValue.invoke(AstValue.java:285)
2017-09-19 17:39:51,464 ERROR [stderr] (default task-36) at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:304)
2017-09-19 17:39:51,464 ERROR [stderr] (default task-36) at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:40)
2017-09-19 17:39:51,464 ERROR [stderr] (default task-36) at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50)
2017-09-19 17:39:51,464 ERROR [stderr] (default task-36) at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:40)
2017-09-19 17:39:51,464 ERROR [stderr] (default task-36) at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50)
2017-09-19 17:39:51,464 ERROR [stderr] (default task-36) at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
2017-09-19 17:39:51,464 ERROR [stderr] (default task-36) at javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:147)
2017-09-19 17:39:51,464 ERROR [stderr] (default task-36) at javax.faces.event.ActionEvent.processListener(ActionEvent.java:88)
2017-09-19 17:39:51,464 ERROR [stderr] (default task-36) at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:814)
2017-09-19 17:39:51,464 ERROR [stderr] (default task-36) at javax.faces.component.UICommand.broadcast(UICommand.java:300)
2017-09-19 17:39:51,464 ERROR [stderr] (default task-36) at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:790)
2017-09-19 17:39:51,464 ERROR [stderr] (default task-36) at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1282)
2017-09-19 17:39:51,464 ERROR [stderr] (default task-36) at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
2017-09-19 17:39:51,464 ERROR [stderr] (default task-36) at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
2017-09-19 17:39:51,464 ERROR [stderr] (default task-36) at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
2017-09-19 17:39:51,464 ERROR [stderr] (default task-36) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:658)
2017-09-19 17:39:51,464 ERROR [stderr] (default task-36) at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
2017-09-19 17:39:51,464 ERROR [stderr] (default task-36) at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129)
2017-09-19 17:39:51,464 ERROR [stderr] (default task-36) at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:100)
2017-09-19 17:39:51,464 ERROR [stderr] (default task-36) at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
2017-09-19 17:39:51,464 ERROR [stderr] (default task-36) at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
2017-09-19 17:39:51,465 ERROR [stderr] (default task-36) at com.ftu.hibernate.SessionFilter.doFilter(SessionFilter.java:71)
2017-09-19 17:39:51,465 ERROR [stderr] (default task-36) at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
2017-09-19 17:39:51,465 ERROR [stderr] (default task-36) at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
2017-09-19 17:39:51,465 ERROR [stderr] (default task-36) at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)
2017-09-19 17:39:51,465 ERROR [stderr] (default task-36) at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
2017-09-19 17:39:51,465 ERROR [stderr] (default task-36) at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
2017-09-19 17:39:51,465 ERROR [stderr] (default task-36) at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
2017-09-19 17:39:51,465 ERROR [stderr] (default task-36) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
2017-09-19 17:39:51,465 ERROR [stderr] (default task-36) at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
2017-09-19 17:39:51,465 ERROR [stderr] (default task-36) at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
2017-09-19 17:39:51,465 ERROR [stderr] (default task-36) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
2017-09-19 17:39:51,465 ERROR [stderr] (default task-36) at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
2017-09-19 17:39:51,465 ERROR [stderr] (default task-36) at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
2017-09-19 17:39:51,465 ERROR [stderr] (default task-36) at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
2017-09-19 17:39:51,465 ERROR [stderr] (default task-36) at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
2017-09-19 17:39:51,465 ERROR [stderr] (default task-36) at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
2017-09-19 17:39:51,465 ERROR [stderr] (default task-36) at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
2017-09-19 17:39:51,465 ERROR [stderr] (default task-36) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
2017-09-19 17:39:51,465 ERROR [stderr] (default task-36) at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
2017-09-19 17:39:51,465 ERROR [stderr] (default task-36) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
2017-09-19 17:39:51,466 ERROR [stderr] (default task-36) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
2017-09-19 17:39:51,466 ERROR [stderr] (default task-36) at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:285)
2017-09-19 17:39:51,466 ERROR [stderr] (default task-36) at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:264)
2017-09-19 17:39:51,466 ERROR [stderr] (default task-36) at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
2017-09-19 17:39:51,466 ERROR [stderr] (default task-36) at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:175)
2017-09-19 17:39:51,466 ERROR [stderr] (default task-36) at io.undertow.server.Connectors.executeRootHandler(Connectors.java:202)
2017-09-19 17:39:51,466 ERROR [stderr] (default task-36) at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:802)
2017-09-19 17:39:51,466 ERROR [stderr] (default task-36) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
2017-09-19 17:39:51,466 ERROR [stderr] (default task-36) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
2017-09-19 17:39:51,466 ERROR [stderr] (default task-36) at java.lang.Thread.run(Thread.java:745)
Hiện tại e đã set quyền 777 cho cả ứng dụng và thư mục chứa ứng dụng, nhưng vẫn không được. Không rõ là server jboss phải cấu hình thế nào nữa không :(
https://docs.jboss.org/jbossweb/2.1.x/security-manager-howto.html
https://developer.jboss.org/thread/213623?_sscc=t
IIS thì thế này
You need to grant access to the
IIS_USRS
group (for the AppPool) and theIUSR
user (for anonymous access / static content).Hình như phía server bạn phải cấp quyền cho cái folder chứa file đó để app của bạn được truy cập đó