{"action":"created","issue":{"url":"https://api.github.com/repos/kermitt2/grobid/issues/91","repository_url":"https://api.github.com/repos/kermitt2/grobid","labels_url":"https://api.github.com/repos/kermitt2/grobid/issues/91/labels{/name}","comments_url":"https://api.github.com/repos/kermitt2/grobid/issues/91/comments","events_url":"https://api.github.com/repos/kermitt2/grobid/issues/91/events","html_url":"https://github.com/kermitt2/grobid/issues/91","id":139660229,"number":91,"title":"org.apache.naming.java.javaURLContextFactory in code example","user":{"login":"jjbenitez26","id":17551769,"avatar_url":"https://avatars.githubusercontent.com/u/17551769?v=3","gravatar_id":"","url":"https://api.github.com/users/jjbenitez26","html_url":"https://github.com/jjbenitez26","followers_url":"https://api.github.com/users/jjbenitez26/followers","following_url":"https://api.github.com/users/jjbenitez26/following{/other_user}","gists_url":"https://api.github.com/users/jjbenitez26/gists{/gist_id}","starred_url":"https://api.github.com/users/jjbenitez26/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jjbenitez26/subscriptions","organizations_url":"https://api.github.com/users/jjbenitez26/orgs","repos_url":"https://api.github.com/users/jjbenitez26/repos","events_url":"https://api.github.com/users/jjbenitez26/events{/privacy}","received_events_url":"https://api.github.com/users/jjbenitez26/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2016-03-09T18:23:12Z","updated_at":"2016-03-11T22:20:04Z","closed_at":null,"body":"I'm trying to use de GROBID JAVA API using the example in http://grobid.readthedocs.org/en/latest/Grobid-java-library/\r\nI'm install GROBID, compile de core, and add grobid-core-0.4.0-SNAPSHOT.jar to my libraries in a NetBeans project.\r\nMy code is:\r\n```\r\npackage grobid;\r\nimport java.util.logging.Level;\r\nimport java.util.logging.Logger;\r\nimport org.grobid.core.*;\r\nimport org.grobid.core.data.BiblioItem;\r\nimport org.grobid.core.engines.Engine;\r\nimport org.grobid.core.factory.GrobidFactory;\r\nimport org.grobid.core.mock.MockContext;\r\nimport org.grobid.core.utilities.GrobidProperties;\r\n\r\n/**\r\n *\r\n * @author jose\r\n */\r\npublic class GROBID {\r\n\r\n    /**\r\n     * @param args the command line arguments\r\n     */\r\n    public static void main(String[] args) {\r\n        // TODO code application logic here\r\n        \r\n        String pdfPath = \"/home/jose/plantilla_Informatica_2015 (ok).pdf\";\r\n        String pathGHome = \"/home/jose/GROBID_COMPILED/grobid-home\";\r\n        String pathGProp = \"/home/jose/GROBID_COMPILED/grobid-home/config/grobid.properties\";\r\n        \r\n        try {\r\n            MockContext.setInitialContext(pathGHome, pathGProp);\r\n            GrobidProperties.getInstance();\r\n            \r\n            Engine engine = GrobidFactory.getInstance().createEngine();\r\n            BiblioItem bi = new BiblioItem();\r\n            \r\n            String doc = engine.processHeader(pdfPath, false, bi);\r\n            System.out.println(doc);\r\n            \r\n        } catch (Exception ex) {\r\n            Logger.getLogger(GROBID.class.getName()).log(Level.SEVERE, null, ex);\r\n        }\r\n        finally{\r\n            try{\r\n                MockContext.destroyInitialContext();\r\n            }\r\n            catch(Exception ex){\r\n                Logger.getLogger(GROBID.class.getName()).log(Level.SEVERE, null, ex);\r\n            }\r\n        }\r\n        \r\n    }\r\n    \r\n}\r\n```\r\n\r\nWhen i run the proyect I get the following error:\r\n```\r\nGRAVE: null\r\njavax.naming.NoInitialContextException: Cannot instantiate class: org.apache.naming.java.javaURLContextFactory [Root exception is java.lang.ClassNotFoundException: org.apache.naming.java.javaURLContextFactory]\r\n\tat javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:674)\r\n\tat javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:307)\r\n\tat javax.naming.InitialContext.init(InitialContext.java:242)\r\n\tat javax.naming.InitialContext.<init>(InitialContext.java:192)\r\n\tat org.grobid.core.mock.MockContext.setInitialContext(MockContext.java:36)\r\n\tat org.grobid.core.mock.MockContext.setInitialContext(MockContext.java:76)\r\n\tat grobid.GROBID.main(GROBID.java:33)\r\nCaused by: java.lang.ClassNotFoundException: org.apache.naming.java.javaURLContextFactory\r\n\tat java.net.URLClassLoader$1.run(URLClassLoader.java:366)\r\n\tat java.net.URLClassLoader$1.run(URLClassLoader.java:355)\r\n\tat java.security.AccessController.doPrivileged(Native Method)\r\n\tat java.net.URLClassLoader.findClass(URLClassLoader.java:354)\r\n\tat java.lang.ClassLoader.loadClass(ClassLoader.java:425)\r\n\tat sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)\r\n\tat java.lang.ClassLoader.loadClass(ClassLoader.java:358)\r\n\tat java.lang.Class.forName0(Native Method)\r\n\tat java.lang.Class.forName(Class.java:278)\r\n\tat com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:72)\r\n\tat com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:61)\r\n\tat javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:671)\r\n\t... 6 more\r\n```\r\nAny help?\r\nThanks in advance."},"comment":{"url":"https://api.github.com/repos/kermitt2/grobid/issues/comments/195575549","html_url":"https://github.com/kermitt2/grobid/issues/91#issuecomment-195575549","issue_url":"https://api.github.com/repos/kermitt2/grobid/issues/91","id":195575549,"user":{"login":"jjbenitez26","id":17551769,"avatar_url":"https://avatars.githubusercontent.com/u/17551769?v=3","gravatar_id":"","url":"https://api.github.com/users/jjbenitez26","html_url":"https://github.com/jjbenitez26","followers_url":"https://api.github.com/users/jjbenitez26/followers","following_url":"https://api.github.com/users/jjbenitez26/following{/other_user}","gists_url":"https://api.github.com/users/jjbenitez26/gists{/gist_id}","starred_url":"https://api.github.com/users/jjbenitez26/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jjbenitez26/subscriptions","organizations_url":"https://api.github.com/users/jjbenitez26/orgs","repos_url":"https://api.github.com/users/jjbenitez26/repos","events_url":"https://api.github.com/users/jjbenitez26/events{/privacy}","received_events_url":"https://api.github.com/users/jjbenitez26/received_events","type":"User","site_admin":false},"created_at":"2016-03-11T22:20:04Z","updated_at":"2016-03-11T22:20:04Z","body":"it could be this error:\r\n```\r\nERROR errors.GrailsExceptionResolver  - OperationNotSupportedException occurred when processing request: [GET] /GROB/grobid\r\nContext is read only.\r\n```\r\nhere:\r\n```\r\nString pdfPath = \"/home/jose/plantilla_Informatica_2015 (ok).pdf\"\r\n        String pathGHome = \"/media/jose/Datos/DOCUMENTS/Datos/Gobid/GROBID_COMPILED/grobid-home\"\r\n        String pathGProp = \"/media/jose/Datos/DOCUMENTS/Datos/Gobid/GROBID_COMPILED/grobid-home/config/grobid.properties\"\r\n\r\n        MockContext.setInitialContext(pathGHome, pathGProp)\r\n        GrobidProperties.getInstance()\r\n\r\n        Engine engine = GrobidFactory.getInstance().createEngine()\r\n        BiblioItem bi = new BiblioItem()\r\n\r\n        String doc = engine.processHeader(pdfPath, false, bi)\r\n        println(doc)\r\n\r\n        MockContext.destroyInitialContext()\r\n```\r\n"}}