Ghada Ibrahim 0 Newbie Poster

Hello .. i need ur help i have this problem ..

i have this in a jsp page :

<jsp:useBean id="rdf" class="test_rdfa.NewClass">
     </jsp:useBean>

String id=(String)session.getAttribute("id");
String url= request.getParameter("wburl");

rdf.readGrddl(url,id);

and this is the NewClass.java:

import com.hp.hpl.jena.grddl.GRDDLReader;
import com.hp.hpl.jena.rdf.model.*;
import java.io.*;
public class NewClass {

    Model model = null;
    GRDDLReader grddlreader = new GRDDLReader();
  
public void readGrddl(String url,String sname)
{
    model = ModelFactory.createDefaultModel();
    grddlreader.setProperty("grddl.rdfa",true);
    //the url of the website
    grddlreader.read(model,url);

    try{
      FileOutputStream fout=new FileOutputStream("C:/Users/1/Desktop/a/"+sname+".rdf");
      model.write(fout);
      }catch(IOException e){
        System.out.println("Exception caught"+e.getMessage());
      }
}
}

and every time i get this exception :

WARNING: StandardWrapperValve[jsp]: PWC1406: Servlet.service() for servlet jsp threw exception
com.hp.hpl.jena.grddl.GRDDLSecurityException: java.lang.SecurityException: (java.io.FilePermission C:\Program Files\sges-v3\glassfish\lib\install\applications\jaxr-ra\net\sf\saxon\trans\CompilerInfo.class read)
at com.hp.hpl.jena.grddl.impl.GRDDL.transformerFor(GRDDL.java:490)
at com.hp.hpl.jena.grddl.impl.GRDDL.transformWith(GRDDL.java:291)
at com.hp.hpl.jena.grddl.impl.GRDDL.applyTransforms(GRDDL.java:284)
at com.hp.hpl.jena.grddl.impl.GRDDL.go(GRDDL.java:201)
at com.hp.hpl.jena.grddl.GRDDLReader.read(GRDDLReader.java:47)
at test_rdfa.NewClass.readGrddl(NewClass.java:17)
at org.apache.jsp.text_jsp._jspService(text_jsp.java from :84)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:109)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:406)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:483)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:373)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:332)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:233)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.SecurityException: (java.io.FilePermission C:\Program Files\sges-v3\glassfish\lib\install\applications\jaxr-ra\net\sf\saxon\trans\CompilerInfo.class read)
at com.hp.hpl.jena.grddl.impl.SecManager.checkPerm(SecManager.java:262)
at com.hp.hpl.jena.grddl.impl.SecManager.checkPerm(SecManager.java:131)
at com.hp.hpl.jena.grddl.impl.SecManager.checkPermission(SecManager.java:123)
at java.lang.SecurityManager.checkRead(SecurityManager.java:871)
at java.io.File.exists(File.java:731)
at java.io.Win32FileSystem.canonicalize(Win32FileSystem.java:402)
at java.io.File.getCanonicalPath(File.java:559)
at sun.security.provider.PolicyFile.canonPath(PolicyFile.java:1844)
at java.io.FilePermission$1.run(FilePermission.java:186)
at java.io.FilePermission$1.run(FilePermission.java:183)
at java.security.AccessController.doPrivileged(Native Method)
at java.io.FilePermission.init(FilePermission.java:183)
at java.io.FilePermission.<init>(FilePermission.java:249)
at java.lang.SecurityManager.checkRead(SecurityManager.java:871)
at java.io.File.exists(File.java:731)
at com.sun.enterprise.loader.ASURLClassLoader$2.run(ASURLClassLoader.java:593)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.enterprise.loader.ASURLClassLoader.loadClassData0(ASURLClassLoader.java:574)
at com.sun.enterprise.loader.ASURLClassLoader.findClassData(ASURLClassLoader.java:728)
at com.sun.enterprise.loader.ASURLClassLoader.findClass(ASURLClassLoader.java:626)
at org.glassfish.internal.api.ConnectorClassFinder.findClass(ConnectorClassFinder.java:76)
at org.glassfish.internal.api.DelegatingClassLoader.findClass(DelegatingClassLoader.java:182)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1405)
at net.sf.saxon.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:132)
at net.sf.saxon.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:88)
at com.hp.hpl.jena.grddl.impl.GRDDL$4.run(GRDDL.java:470)
at com.hp.hpl.jena.grddl.impl.GRDDL$2.run(GRDDL.java:358)
... 1 more

Thank you ..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.