You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stanbol.apache.org by "Alessandro Adamou (JIRA)" <ji...@apache.org> on 2012/06/05 14:53:22 UTC

[jira] [Created] (STANBOL-655) Rule adapter class loading fails during RESTful refactoring

Alessandro Adamou created STANBOL-655:
-----------------------------------------

             Summary: Rule adapter class loading fails during RESTful refactoring
                 Key: STANBOL-655
                 URL: https://issues.apache.org/jira/browse/STANBOL-655
             Project: Stanbol
          Issue Type: Bug
          Components: Rules
    Affects Versions: 0.9.0-incubating
            Reporter: Alessandro Adamou
            Priority: Critical


When trying to perform stateful refactoring on a stored recipe, I get a NullPointerException caused from a ClassNotFoundException earlier in the ClerezzaAdapter code.

Appatrently the classloader selected by Thread.currentThread().getContextClassLoader(); does not appear to work.

curl -X POST -H "Accept: application/rdf+xml" -F input=@[ontology-filename] -F recipe=[recipeid] [refactor-endpoint]

the recipe:
-----
etcware = <http://www.etcware.it/vocabulary/> . 
skos = <http://www.w3.org/2004/02/skos/core#> . 
inv1[ has(skos:broader, ?x, ?y) . has(skos:broader, ?y, ?x) -> is(etcware:InvalidConcept, ?x) . is(etcware:InvalidConcept, ?y) ]
-----
the ontology:
-----
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix resource: <http://dbpedia.org/resource/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .

resource:Detroit rdf:type owl:NamedIndividual ;
                       skos:broader resource:Metro_Detroit .

resource:Metro_Detroit rdf:type owl:NamedIndividual ;
                       skos:broader resource:Detroit .
-----

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (STANBOL-655) Rule adapter class loading fails during RESTful refactoring

Posted by "Alessandro Adamou (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/STANBOL-655?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alessandro Adamou updated STANBOL-655:
--------------------------------------

    Priority: Major  (was: Critical)

Since the Class.forName() method seems to work, I am downgrading this to Major. 

Another way can be using

Class<AdaptableAtom> clerezzaAtomClass = null;
                if(componentContext != null){
                    // in OSGi environments
                    clerezzaAtomClass = componentContext.getBundleContext().getBundle().loadClass(canonicalName);
                }
                else{
                    // in non-OSGi environments
                    clerezzaAtomClass = (Class<AdaptableAtom>) Thread.currentThread().getContextClassLoader().loadClass(canonicalName);
                }

Depending on which method is best, once chosen we can close the ticket
                
> Rule adapter class loading fails during RESTful refactoring
> -----------------------------------------------------------
>
>                 Key: STANBOL-655
>                 URL: https://issues.apache.org/jira/browse/STANBOL-655
>             Project: Stanbol
>          Issue Type: Bug
>          Components: Rules
>    Affects Versions: 0.9.0-incubating
>            Reporter: Alessandro Adamou
>
> When trying to perform stateful refactoring on a stored recipe, I get a NullPointerException caused from a ClassNotFoundException earlier in the ClerezzaAdapter code.
> Appatrently the classloader selected by Thread.currentThread().getContextClassLoader(); does not appear to work.
> curl -X POST -H "Accept: application/rdf+xml" -F input=@[ontology-filename] -F recipe=[recipeid] [refactor-endpoint]
> the recipe:
> -----
> etcware = <http://www.etcware.it/vocabulary/> . 
> skos = <http://www.w3.org/2004/02/skos/core#> . 
> inv1[ has(skos:broader, ?x, ?y) . has(skos:broader, ?y, ?x) -> is(etcware:InvalidConcept, ?x) . is(etcware:InvalidConcept, ?y) ]
> -----
> the ontology:
> -----
> @prefix owl: <http://www.w3.org/2002/07/owl#> .
> @prefix skos: <http://www.w3.org/2004/02/skos/core#> .
> @prefix resource: <http://dbpedia.org/resource/> .
> @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
> resource:Detroit rdf:type owl:NamedIndividual ;
>                        skos:broader resource:Metro_Detroit .
> resource:Metro_Detroit rdf:type owl:NamedIndividual ;
>                        skos:broader resource:Detroit .
> -----

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Comment Edited] (STANBOL-655) Rule adapter class loading fails during RESTful refactoring

Posted by "Alessandro Adamou (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/STANBOL-655?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13397383#comment-13397383 ] 

Alessandro Adamou edited comment on STANBOL-655 at 6/20/12 9:38 AM:
--------------------------------------------------------------------

Since the Class.forName() method seems to work, I am downgrading this to Major. 

Another way can be using

Class<AdaptableAtom> clerezzaAtomClass = null;
   if(componentContext != null) {   // in OSGi environments
      clerezzaAtomClass = componentContext.getBundleContext().getBundle().loadClass(canonicalName);
   } else {   // in non-OSGi environments
      clerezzaAtomClass = (Class<AdaptableAtom>) Thread.currentThread().getContextClassLoader().loadClass(canonicalName);
   }

Depending on which method is best, once chosen we can close the ticket
                
      was (Author: alessandro.adamou):
    Since the Class.forName() method seems to work, I am downgrading this to Major. 

Another way can be using

Class<AdaptableAtom> clerezzaAtomClass = null;
                if(componentContext != null){
                    // in OSGi environments
                    clerezzaAtomClass = componentContext.getBundleContext().getBundle().loadClass(canonicalName);
                }
                else{
                    // in non-OSGi environments
                    clerezzaAtomClass = (Class<AdaptableAtom>) Thread.currentThread().getContextClassLoader().loadClass(canonicalName);
                }

Depending on which method is best, once chosen we can close the ticket
                  
> Rule adapter class loading fails during RESTful refactoring
> -----------------------------------------------------------
>
>                 Key: STANBOL-655
>                 URL: https://issues.apache.org/jira/browse/STANBOL-655
>             Project: Stanbol
>          Issue Type: Bug
>          Components: Rules
>    Affects Versions: 0.9.0-incubating
>            Reporter: Alessandro Adamou
>
> When trying to perform stateful refactoring on a stored recipe, I get a NullPointerException caused from a ClassNotFoundException earlier in the ClerezzaAdapter code.
> Appatrently the classloader selected by Thread.currentThread().getContextClassLoader(); does not appear to work.
> curl -X POST -H "Accept: application/rdf+xml" -F input=@[ontology-filename] -F recipe=[recipeid] [refactor-endpoint]
> the recipe:
> -----
> etcware = <http://www.etcware.it/vocabulary/> . 
> skos = <http://www.w3.org/2004/02/skos/core#> . 
> inv1[ has(skos:broader, ?x, ?y) . has(skos:broader, ?y, ?x) -> is(etcware:InvalidConcept, ?x) . is(etcware:InvalidConcept, ?y) ]
> -----
> the ontology:
> -----
> @prefix owl: <http://www.w3.org/2002/07/owl#> .
> @prefix skos: <http://www.w3.org/2004/02/skos/core#> .
> @prefix resource: <http://dbpedia.org/resource/> .
> @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
> resource:Detroit rdf:type owl:NamedIndividual ;
>                        skos:broader resource:Metro_Detroit .
> resource:Metro_Detroit rdf:type owl:NamedIndividual ;
>                        skos:broader resource:Detroit .
> -----

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (STANBOL-655) Rule adapter class loading fails during RESTful refactoring

Posted by "Alessandro Adamou (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/STANBOL-655?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13289387#comment-13289387 ] 

Alessandro Adamou commented on STANBOL-655:
-------------------------------------------

It works on my installation if I replace 

Thread.currentThread().getContextClassLoader().loadClass(canonicalName);

with

Class.forName(canonicalName);

in the Rule adapter classes
                
> Rule adapter class loading fails during RESTful refactoring
> -----------------------------------------------------------
>
>                 Key: STANBOL-655
>                 URL: https://issues.apache.org/jira/browse/STANBOL-655
>             Project: Stanbol
>          Issue Type: Bug
>          Components: Rules
>    Affects Versions: 0.9.0-incubating
>            Reporter: Alessandro Adamou
>            Priority: Critical
>
> When trying to perform stateful refactoring on a stored recipe, I get a NullPointerException caused from a ClassNotFoundException earlier in the ClerezzaAdapter code.
> Appatrently the classloader selected by Thread.currentThread().getContextClassLoader(); does not appear to work.
> curl -X POST -H "Accept: application/rdf+xml" -F input=@[ontology-filename] -F recipe=[recipeid] [refactor-endpoint]
> the recipe:
> -----
> etcware = <http://www.etcware.it/vocabulary/> . 
> skos = <http://www.w3.org/2004/02/skos/core#> . 
> inv1[ has(skos:broader, ?x, ?y) . has(skos:broader, ?y, ?x) -> is(etcware:InvalidConcept, ?x) . is(etcware:InvalidConcept, ?y) ]
> -----
> the ontology:
> -----
> @prefix owl: <http://www.w3.org/2002/07/owl#> .
> @prefix skos: <http://www.w3.org/2004/02/skos/core#> .
> @prefix resource: <http://dbpedia.org/resource/> .
> @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
> resource:Detroit rdf:type owl:NamedIndividual ;
>                        skos:broader resource:Metro_Detroit .
> resource:Metro_Detroit rdf:type owl:NamedIndividual ;
>                        skos:broader resource:Detroit .
> -----

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira