java beans and GRDDL


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


aseeladAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

VenabiliCommented:
Had you verified that C:\Program Files\sges-v3\glassfish\lib\install\applications\jaxr-ra\net\sf\saxon\trans\CompilerInfo.class  is there and is readable?

Basically the error is telling you that the check for this file fails in the permissions check.
0
aseeladAuthor Commented:

i can not find the rest of this :

net\sf\saxon\trans\CompilerInfo.class

how can i find it ? do i have to install something ?
0
VenabiliCommented:
That's the Saxon parser - you might be having it into a jar file (saxon.jar or something like this). If you do not have it, try http://saxon.sourceforge.net/saxon6.5.4/ - if it is there, can you make sure that the jar file is readable

Haven't used GRDDL so I am not sure what it expects but you do need to have Saxon from what it looks like.
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

aseeladAuthor Commented:

i find it in the project library ...how i check if its readable ?
0
VenabiliCommented:
If it is there, it should be fine.

OK - had been looking around - do you have any multiprocesses? Or does it happen with just one file as well? I am thinking about something like here: http://tech.groups.yahoo.com/group/jena-dev/message/42844
0
aseeladAuthor Commented:

no i just have one processes ...the newclass.java was working just fine when i work with it alone without attach it to a jsp page

0
Pramod KumarCommented:
Just put the all your thirdparty JAR to your deployed project folder ../WEB-INF/lib
0
aseeladAuthor Commented:

i do not have a lib folder in WEB-INF should i create one and  but all the library in it ?

thanks
0
Pramod KumarCommented:
yes please. doing this, your project will not look required jar files to glassfish and lookinto your lib folder.
It good to put projected related JARs within the project lib folder (easy to distribute applicaton)
0
aseeladAuthor Commented:


i try it it did not work ..it make the depolyment and the runing so slow
0
Pramod KumarCommented:
are you getting any new error or same old one?
0
Pramod KumarCommented:
If you are getting same old error, that means the jar is corrupted.
Please download a fresh copy(from below url) and put in WEB-INF\lib

http://www.findjar.com/class/net/sf/saxon/trans/CompilerInfo.html
0
aseeladAuthor Commented:
it is the same as the old one...
i try it in tomcat server and this is the error :

02/05/2010 02:40:34 ¿ org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet jsp threw exception
java.lang.SecurityException: (java.io.FilePermission C:\Users\1\Documents\NetBeansProjects\grddl\build\web\WEB-INF\classes\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 org.apache.naming.resources.FileDirContext.file(FileDirContext.java:785)
        at org.apache.naming.resources.FileDirContext.lookup(FileDirContext.java:206)
        at org.apache.naming.resources.ProxyDirContext.lookup(ProxyDirContext.java:299)
        at org.apache.catalina.loader.WebappClassLoader.findResourceInternal(WebappClassLoader.java:2601)
        at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2462)
        at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1010)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1483)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1361)
        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)
        at java.lang.Thread.run(Thread.java:619)

thanks
0
Pramod KumarCommented:
hmm, so it is the case of tomcat security policy.
Please follow below url for setting the security policy:

Configuring Tomcat With A SecurityManager
---------------------------------------------------------
http://tomcat.apache.org/tomcat-6.0-doc/security-manager-howto.html
0
aseeladAuthor Commented:
hay

i tried it and i delete the read permission  and the error is the same

this is the catalina policy :

// Licensed to the Apache Software Foundation (ASF) under one or more
// contributor license agreements.  See the NOTICE file distributed with
// this work for additional information regarding copyright ownership.
// The ASF licenses this file to You under the Apache License, Version 2.0
// (the "License"); you may not use this file except in compliance with
// the License.  You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// ============================================================================
// catalina.corepolicy - Security Policy Permissions for Tomcat 6
//
// This file contains a default set of security policies to be enforced (by the
// JVM) when Catalina is executed with the "-security" option.  In addition
// to the permissions granted here, the following additional permissions are
// granted to the codebase specific to each web application:
//
// * Read access to the document root directory
//
// $Id: catalina.policy 899134 2010-01-14 09:44:28Z rjung $
// ============================================================================


// ========== SYSTEM CODE PERMISSIONS =========================================


// These permissions apply to javac
grant codeBase "file:${java.home}/lib/-" {
        permission java.security.AllPermission;
};

// These permissions apply to all shared system extensions
grant codeBase "file:${java.home}/jre/lib/ext/-" {
        permission java.security.AllPermission;
};

// These permissions apply to javac when ${java.home] points at $JAVA_HOME/jre
grant codeBase "file:${java.home}/../lib/-" {
        permission java.security.AllPermission;
};

// These permissions apply to all shared system extensions when
// ${java.home} points at $JAVA_HOME/jre
grant codeBase "file:${java.home}/lib/ext/-" {
        permission java.security.AllPermission;
};


// ========== CATALINA CODE PERMISSIONS =======================================


// These permissions apply to the daemon code
grant codeBase "file:${catalina.home}/bin/commons-daemon.jar" {
        permission java.security.AllPermission;
};

// These permissions apply to the logging API
grant codeBase "file:${catalina.home}/bin/tomcat-juli.jar" {
        permission java.util.PropertyPermission "java.util.logging.config.class", "read";
        permission java.util.PropertyPermission "java.util.logging.config.file", "read";
        
        permission java.lang.RuntimePermission "shutdownHooks";
        
        permission java.util.PropertyPermission "catalina.base", "read";
        permission java.util.logging.LoggingPermission "control";
        
        permission java.lang.RuntimePermission "getClassLoader";
        permission java.lang.RuntimePermission "setContextClassLoader";
        // To enable per context logging configuration, permit read access to the appropriate file.
        // Be sure that the logging configuration is secure before enabling such access
        // eg for the examples web application:
        
};

// These permissions apply to the server startup code
grant codeBase "file:${catalina.home}/bin/bootstrap.jar" {
        permission java.security.AllPermission;
};

// These permissions apply to the servlet API classes
// and those that are shared across all class loaders
// located in the "lib" directory
grant codeBase "file:${catalina.home}/lib/-" {
        permission java.security.AllPermission;
};


// ========== WEB APPLICATION PERMISSIONS =====================================


// These permissions are granted by default to all web applications
// In addition, a web application will be given a read FilePermission
// and JndiPermission for all files and directories in its document root.
grant { 
    // Required for JNDI lookup of named JDBC DataSource's and
    // javamail named MimePart DataSource used to send mail
    permission java.util.PropertyPermission "java.home", "read";
    permission java.util.PropertyPermission "java.naming.*", "read";
    permission java.util.PropertyPermission "javax.sql.*", "read";

    // OS Specific properties to allow read access
    permission java.util.PropertyPermission "os.name", "read";
    permission java.util.PropertyPermission "os.version", "read";
    permission java.util.PropertyPermission "os.arch", "read";
    permission java.util.PropertyPermission "file.separator", "read";
    permission java.util.PropertyPermission "path.separator", "read";
    permission java.util.PropertyPermission "line.separator", "read";

    // JVM properties to allow read access
    permission java.util.PropertyPermission "java.version", "read";
    permission java.util.PropertyPermission "java.vendor", "read";
    permission java.util.PropertyPermission "java.vendor.url", "read";
    permission java.util.PropertyPermission "java.class.version", "read";
    permission java.util.PropertyPermission "java.specification.version", "read";
    permission java.util.PropertyPermission "java.specification.vendor", "read";
    permission java.util.PropertyPermission "java.specification.name", "read";

    permission java.util.PropertyPermission "java.vm.specification.version", "read";
    permission java.util.PropertyPermission "java.vm.specification.vendor", "read";
    permission java.util.PropertyPermission "java.vm.specification.name", "read";
    permission java.util.PropertyPermission "java.vm.version", "read";
    permission java.util.PropertyPermission "java.vm.vendor", "read";
    permission java.util.PropertyPermission "java.vm.name", "read";

    // Required for OpenJMX
    permission java.lang.RuntimePermission "getAttribute";

    // Allow read of JAXP compliant XML parser debug
    permission java.util.PropertyPermission "jaxp.debug", "read";

    // Precompiled JSPs need access to these packages.
    permission java.lang.RuntimePermission "accessClassInPackage.org.apache.jasper.el";
    permission java.lang.RuntimePermission "accessClassInPackage.org.apache.jasper.runtime";
    permission java.lang.RuntimePermission "accessClassInPackage.org.apache.jasper.runtime.*";
    
    // Precompiled JSPs need access to these system properties.
    permission java.util.PropertyPermission "org.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER", "read";
    permission java.util.PropertyPermission "org.apache.el.parser.COERCE_TO_ZERO", "read";
};


// You can assign additional permissions to particular web applications by
// adding additional "grant" entries here, based on the code base for that
// application, /WEB-INF/classes/, or /WEB-INF/lib/ jar files.
//
// Different permissions can be granted to JSP pages, classes loaded from
// the /WEB-INF/classes/ directory, all jar files in the /WEB-INF/lib/
// directory, or even to individual jar files in the /WEB-INF/lib/ directory.
//
// For instance, assume that the standard "examples" application
// included a JDBC driver that needed to establish a network connection to the
// corresponding database and used the scrape taglib to get the weather from
// the NOAA web server.  You might create a "grant" entries like this:
//
// The permissions granted to the context root directory apply to JSP pages.
// grant codeBase "file:${catalina.home}/webapps/examples/-" {
//      permission java.net.SocketPermission "dbhost.mycompany.com:5432", "connect";
//      permission java.net.SocketPermission "*.noaa.gov:80", "connect";
// };
//
// The permissions granted to the context WEB-INF/classes directory
// grant codeBase "file:${catalina.home}/webapps/examples/WEB-INF/classes/-" {
// };
//
// The permission granted to your JDBC driver
// grant codeBase "jar:file:${catalina.home}/webapps/examples/WEB-INF/lib/driver.jar!/-" {
//      permission java.net.SocketPermission "dbhost.mycompany.com:5432", "connect";
// };
// The permission granted to the scrape taglib
// grant codeBase "jar:file:${catalina.home}/webapps/examples/WEB-INF/lib/scrape.jar!/-" {
//      permission java.net.SocketPermission "*.noaa.gov:80", "connect";
// };

Open in new window

0
aseeladAuthor Commented:
back to glass fish ...
how can i change the write file permission in jdk java that is connected to netbeanse ?

i think the error came from that file

thank you
0
VenabiliCommented:
>how can i change the write file permission in jdk java that is connected to netbeanse ?

What? The question makes no sense. Which permissions do you want to change?
0
aseeladAuthor Commented:

java.io.FilePermission  i want to make it ok to write to the file ..


thank you...
0
Pramod KumarCommented:
sorry! ignore my previous post for(jetty)
Here is the linke for glassfish security policy

http://blogs.sun.com/monzillo/entry/policy_files_the_securitymanager_and
http://docs.sun.com/app/docs/doc/820-7695/beabx?l=en&n=1&a=view
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java EE

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.