[opencms-dev] Create respurce problem. Please help.
Ivan Jelenic
ivan.jelenic at nbs.yu
Thu Jan 22 10:21:01 CET 2004
Hi,
I am using a small web-based form for uploading PDF file and storing them VFS. Everything works fine except createResource method. This is a code:
//obradi PDF
System.out.println("Pocetak obrade PDF file-a!!!");
Enumeration files = cms.getRequestContext().getRequest().getFileNames();
//Upis PDF fajlova u CMS
while (files.hasMoreElements()) {
String fileName = (String) files.nextElement();
fileName = fileName.toUpperCase();
System.out.println("Ime: " + fileName);
if (fileName.endsWith(".PDF")) {
System.out.println("Usao i if (PDF)");
byte[] filecontent = (byte[]) cms.getRequestContext().getRequest().getFile(fileName);
//Prijava admin user-a
try {
cms.loginUser("Admin","opencms");
System.out.println("Uspesno logovanje Admin-a");
Hashtable props = new Hashtable();
props.put("Title",request.getParameter("Page"));
props.put("Description",request.getParameter("Description"));
props.put("Keywords",request.getParameter("Keywords"));
props.put("NavText",request.getParameter("NavText"));
System.out.println("Setovani Properties za file-ove");
CmsResource cmsres = null;
System.out.println("Kreiranje PDF file-a u CMS-u!!");
pathVFS = request.getParameter("Path");
try{
//cms.lockResource(pathVFS);
cms.getRequestContext().setCurrentProject(3); //switch to offline
System.out.println("Na putanji: " + pathVFS);
cmsres = cms.createResource(pathVFS, fileName, "binary", props, filecontent);
System.out.println("PDF file je uspesno kreiran u CMS-u !!");
}catch(CmsException e){
System.out.println("Neuspesno kreiranje !!!");
out.println("Neuspesno kreiranje PDF!!!");
e.printStackTrace();
}
} catch(CmsException e){
System.out.println("Neuspesno logovanje !!!");
}
}
VFS path is OK.
I've got this error message:
javax.servlet.ServletException: Resource loader error in file '/intranet/jsp/Webhouse.jsp'
Root cause:
org.apache.jasper.JasperException
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:358)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:284)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:742)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:630)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:542)
at com.opencms.flex.cache.CmsFlexRequestDispatcher.include(CmsFlexRequestDispatcher.java:158)
......
............
Log file says this:
2004-01-22 09:56:45 ApplicationDispatcher[/opencms] Servlet.service() for servlet jsp threw exception
java.lang.NullPointerException
at java.io.FilterOutputStream.write(FilterOutputStream.java:80)
at yu.nbs.opencms.test.ResponseForm.storePDF(ResponseForm.java:102)
at yu.nbs.opencms.test.ResponseForm.proccessData(ResponseForm.java:37)
at org.apache.jsp.WEB_002dINF.jsp.online.intranet.jsp.Webhouse_jsp_jsp._jspService(Webhouse_jsp_jsp.java:117)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:284)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:742)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:630)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:542)
at com.opencms.flex.cache.CmsFlexRequestDispatcher.include(CmsFlexRequestDispatcher.java:158)
at com.opencms.flex.CmsJspLoader.service(CmsJspLoader.java:972)
at com.opencms.flex.cache.CmsFlexRequestDispatcher.include(CmsFlexRequestDispatcher.java:256)
at com.opencms.flex.CmsJspLoader.load(CmsJspLoader.java:577)
at com.opencms.flex.CmsJspLoader.initlaunch(CmsJspLoader.java:239)
at com.opencms.core.OpenCms.showResource(OpenCms.java:961)
at com.opencms.core.OpenCmsHttpServlet.doGet(OpenCmsHttpServlet.java:310)
at com.opencms.core.OpenCmsHttpServlet.doPost(OpenCmsHttpServlet.java:331)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:284)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:245)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:199)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:195)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:164)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:156)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:211)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:309)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:387)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:673)
at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:615)
at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:786)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:677)
at java.lang.Thread.run(Thread.java:534) Please, help. Best regards, Ivan.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20040122/188a89bb/attachment.htm>
More information about the opencms-dev
mailing list