<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-2">
<META content="MSHTML 6.00.2800.1264" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>
<DIV><FONT face=Arial size=2>Hi,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>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:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> //obradi
PDF<BR> System.out.println("Pocetak obrade PDF
file-a!!!");<BR> <BR> Enumeration files =
cms.getRequestContext().getRequest().getFileNames();<BR> //Upis PDF
fajlova u CMS<BR> <BR> while (files.hasMoreElements())
{<BR> String fileName = (String)
files.nextElement();<BR> fileName =
fileName.toUpperCase();<BR> System.out.println("Ime: " +
fileName);<BR> if (fileName.endsWith(".PDF"))
{<BR> System.out.println("Usao i if
(PDF)");<BR> byte[] filecontent = (byte[])
cms.getRequestContext().getRequest().getFile(fileName);<BR> //Prijava
admin user-a<BR> try
{<BR> cms.loginUser("Admin","opencms");<BR> System.out.println("Uspesno
logovanje Admin-a");<BR> Hashtable props = new
Hashtable();<BR> props.put("Title",request.getParameter("Page"));<BR> props.put("Description",request.getParameter("Description"));<BR> props.put("Keywords",request.getParameter("Keywords"));<BR> props.put("NavText",request.getParameter("NavText"));<BR> System.out.println("Setovani
Properties za file-ove");<BR> CmsResource cmsres =
null;<BR> System.out.println("Kreiranje PDF file-a
u CMS-u!!");<BR> pathVFS =
request.getParameter("Path");<BR> try{<BR> //cms.lockResource(pathVFS);<BR> cms.getRequestContext().setCurrentProject(3);
//switch to offline
<BR> System.out.println("Na putanji: " +
pathVFS);<BR> cmsres =
cms.createResource(pathVFS, fileName, "binary", props,
filecontent);<BR> System.out.println("PDF
file je uspesno kreiran u CMS-u !!");
<BR> }catch(CmsException
e){<BR> System.out.println("Neuspesno
kreiranje !!!");<BR> out.println("Neuspesno
kreiranje
PDF!!!");<BR> e.printStackTrace();<BR> }<BR> }
catch(CmsException
e){<BR> System.out.println("Neuspesno logovanje
!!!");<BR> }<BR> }</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>VFS path is OK.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I've got this error message:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>javax.servlet.ServletException: Resource loader
error in file '/intranet/jsp/Webhouse.jsp'</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>Root
cause:<BR>org.apache.jasper.JasperException<BR> at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:358)<BR> at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)<BR> at
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)<BR> at
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)<BR> at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:284)<BR> at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)<BR> at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:742)<BR> at
org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:630)<BR> at
org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:542)<BR> at
com.opencms.flex.cache.CmsFlexRequestDispatcher.include(CmsFlexRequestDispatcher.java:158)<BR>......</FONT></DIV>
<DIV><FONT face=Arial size=2>............</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Log file says this:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><!--StartFragment --><PRE>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)</PRE><PRE> </PRE><PRE>Please, help.</PRE><PRE> </PRE><PRE>Best regards, Ivan.</PRE></DIV></FONT></DIV></BODY></HTML>