How to resolve IllegalStateException and ParserConfigurationException for finding location in android studio by using apache OpenNLP









up vote
0
down vote

favorite












 package com.example.dell.apacheopennlp;
import android.os.StrictMode;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;
import java.io.IOException;
import java.io.InputStream;
import opennlp.tools.namefind.NameFinderME;
import opennlp.tools.namefind.TokenNameFinderModel;
import opennlp.tools.tokenize.TokenizerME;
import opennlp.tools.tokenize.TokenizerModel;
import opennlp.tools.util.Span;
public class apacheOpenNLP extends AppCompatActivity
TokenNameFinderModel locationModel = null;
@Override
protected void onCreate(Bundle savedInstanceState)
super.onCreate (savedInstanceState);
setContentView (R.layout.activity_apache_open_nlp);
final TextView txt = (TextView) findViewById (R.id.txtView);
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);

InputStream inputStream = null;
TokenizerModel tokenModel = null;
try
inputStream = getAssets ( ).open ("en-token.bin");
tokenModel = new TokenizerModel (inputStream);
inputStream.close ( );
catch (IOException e)
e.printStackTrace ( );
txt.setText (e.toString ( ) + " inside catch of token");


if (tokenModel != null)
TokenizerME tokenizer = new TokenizerME (tokenModel);
String paragraph = "Tutorialspoint is located in Hyderabad";
String tokens = tokenizer.tokenize (paragraph);
InputStream locationInputStream = null;

try
locationInputStream = getAssets ( ).open ("en-ner-location.bin");
locationModel = new TokenNameFinderModel (locationInputStream);

catch (IOException e)
e.printStackTrace ( );
txt.setText (e.toString ( ) + " inside catch of location");

Thread thread = new Thread(new Runnable()

@Override
public void run()
try
NameFinderME nameFinder = null;
if (locationModel != null)
txt.setText ("Location model is not empty");
nameFinder = new NameFinderME (locationModel);

//after this line..its goes in the catch and the app crashes
Span nameSpans = nameFinder.find (tokens);
String result = null;
for (Span s : nameSpans)
result += s.toString ( );
txt.setText (result);
// txt.setText ("Location model is not empty");*/

else
txt.setText ("Location model is empty");

catch (Exception e)
txt.setText(e.toString ()+"++++++");
e.printStackTrace();


);

thread.start();








I am using the apache openNLP to find the location in a sentence and i am getting errors when it passes at nameFinder = new NameFinderME(locationModel);
I have tried other examples when it uses NameFinderME, it did not work also. Can somebody figure out the issue.



W/System.err: java.lang.IllegalStateException: javax.xml.parsers.ParserConfigurationException: http://javax.xml.XMLConstants/feature/secure-processing
at opennlp.tools.util.XmlUtil.createDocumentBuilder(XmlUtil.java:42)
at opennlp.tools.util.featuregen.GeneratorFactory.createDOM(GeneratorFactory.java:557)
at opennlp.tools.util.featuregen.GeneratorFactory.create(GeneratorFactory.java:590)
at opennlp.tools.namefind.TokenNameFinderFactory.createFeatureGenerators(TokenNameFinderFactory.java:189)
at opennlp.tools.namefind.TokenNameFinderFactory.createContextGenerator(TokenNameFinderFactory.java:150)
at opennlp.tools.namefind.NameFinderME.(NameFinderME.java:83)
at com.example.dell.apacheopennlp.apacheOpenNLP$1.run(apacheOpenNLP.java:60)
at java.lang.Thread.run(Thread.java:764)



W/System.err: Caused by: javax.xml.parsers.ParserConfigurationException: http://javax.xml.XMLConstants/feature/secure-processing
at org.apache.harmony.xml.parsers.DocumentBuilderFactoryImpl.setFeature(DocumentBuilderFactoryImpl.java:101)










share|improve this question



























    up vote
    0
    down vote

    favorite












     package com.example.dell.apacheopennlp;
    import android.os.StrictMode;
    import android.support.v7.app.AppCompatActivity;
    import android.os.Bundle;
    import android.widget.TextView;
    import java.io.IOException;
    import java.io.InputStream;
    import opennlp.tools.namefind.NameFinderME;
    import opennlp.tools.namefind.TokenNameFinderModel;
    import opennlp.tools.tokenize.TokenizerME;
    import opennlp.tools.tokenize.TokenizerModel;
    import opennlp.tools.util.Span;
    public class apacheOpenNLP extends AppCompatActivity
    TokenNameFinderModel locationModel = null;
    @Override
    protected void onCreate(Bundle savedInstanceState)
    super.onCreate (savedInstanceState);
    setContentView (R.layout.activity_apache_open_nlp);
    final TextView txt = (TextView) findViewById (R.id.txtView);
    StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
    StrictMode.setThreadPolicy(policy);

    InputStream inputStream = null;
    TokenizerModel tokenModel = null;
    try
    inputStream = getAssets ( ).open ("en-token.bin");
    tokenModel = new TokenizerModel (inputStream);
    inputStream.close ( );
    catch (IOException e)
    e.printStackTrace ( );
    txt.setText (e.toString ( ) + " inside catch of token");


    if (tokenModel != null)
    TokenizerME tokenizer = new TokenizerME (tokenModel);
    String paragraph = "Tutorialspoint is located in Hyderabad";
    String tokens = tokenizer.tokenize (paragraph);
    InputStream locationInputStream = null;

    try
    locationInputStream = getAssets ( ).open ("en-ner-location.bin");
    locationModel = new TokenNameFinderModel (locationInputStream);

    catch (IOException e)
    e.printStackTrace ( );
    txt.setText (e.toString ( ) + " inside catch of location");

    Thread thread = new Thread(new Runnable()

    @Override
    public void run()
    try
    NameFinderME nameFinder = null;
    if (locationModel != null)
    txt.setText ("Location model is not empty");
    nameFinder = new NameFinderME (locationModel);

    //after this line..its goes in the catch and the app crashes
    Span nameSpans = nameFinder.find (tokens);
    String result = null;
    for (Span s : nameSpans)
    result += s.toString ( );
    txt.setText (result);
    // txt.setText ("Location model is not empty");*/

    else
    txt.setText ("Location model is empty");

    catch (Exception e)
    txt.setText(e.toString ()+"++++++");
    e.printStackTrace();


    );

    thread.start();








    I am using the apache openNLP to find the location in a sentence and i am getting errors when it passes at nameFinder = new NameFinderME(locationModel);
    I have tried other examples when it uses NameFinderME, it did not work also. Can somebody figure out the issue.



    W/System.err: java.lang.IllegalStateException: javax.xml.parsers.ParserConfigurationException: http://javax.xml.XMLConstants/feature/secure-processing
    at opennlp.tools.util.XmlUtil.createDocumentBuilder(XmlUtil.java:42)
    at opennlp.tools.util.featuregen.GeneratorFactory.createDOM(GeneratorFactory.java:557)
    at opennlp.tools.util.featuregen.GeneratorFactory.create(GeneratorFactory.java:590)
    at opennlp.tools.namefind.TokenNameFinderFactory.createFeatureGenerators(TokenNameFinderFactory.java:189)
    at opennlp.tools.namefind.TokenNameFinderFactory.createContextGenerator(TokenNameFinderFactory.java:150)
    at opennlp.tools.namefind.NameFinderME.(NameFinderME.java:83)
    at com.example.dell.apacheopennlp.apacheOpenNLP$1.run(apacheOpenNLP.java:60)
    at java.lang.Thread.run(Thread.java:764)



    W/System.err: Caused by: javax.xml.parsers.ParserConfigurationException: http://javax.xml.XMLConstants/feature/secure-processing
    at org.apache.harmony.xml.parsers.DocumentBuilderFactoryImpl.setFeature(DocumentBuilderFactoryImpl.java:101)










    share|improve this question

























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











       package com.example.dell.apacheopennlp;
      import android.os.StrictMode;
      import android.support.v7.app.AppCompatActivity;
      import android.os.Bundle;
      import android.widget.TextView;
      import java.io.IOException;
      import java.io.InputStream;
      import opennlp.tools.namefind.NameFinderME;
      import opennlp.tools.namefind.TokenNameFinderModel;
      import opennlp.tools.tokenize.TokenizerME;
      import opennlp.tools.tokenize.TokenizerModel;
      import opennlp.tools.util.Span;
      public class apacheOpenNLP extends AppCompatActivity
      TokenNameFinderModel locationModel = null;
      @Override
      protected void onCreate(Bundle savedInstanceState)
      super.onCreate (savedInstanceState);
      setContentView (R.layout.activity_apache_open_nlp);
      final TextView txt = (TextView) findViewById (R.id.txtView);
      StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
      StrictMode.setThreadPolicy(policy);

      InputStream inputStream = null;
      TokenizerModel tokenModel = null;
      try
      inputStream = getAssets ( ).open ("en-token.bin");
      tokenModel = new TokenizerModel (inputStream);
      inputStream.close ( );
      catch (IOException e)
      e.printStackTrace ( );
      txt.setText (e.toString ( ) + " inside catch of token");


      if (tokenModel != null)
      TokenizerME tokenizer = new TokenizerME (tokenModel);
      String paragraph = "Tutorialspoint is located in Hyderabad";
      String tokens = tokenizer.tokenize (paragraph);
      InputStream locationInputStream = null;

      try
      locationInputStream = getAssets ( ).open ("en-ner-location.bin");
      locationModel = new TokenNameFinderModel (locationInputStream);

      catch (IOException e)
      e.printStackTrace ( );
      txt.setText (e.toString ( ) + " inside catch of location");

      Thread thread = new Thread(new Runnable()

      @Override
      public void run()
      try
      NameFinderME nameFinder = null;
      if (locationModel != null)
      txt.setText ("Location model is not empty");
      nameFinder = new NameFinderME (locationModel);

      //after this line..its goes in the catch and the app crashes
      Span nameSpans = nameFinder.find (tokens);
      String result = null;
      for (Span s : nameSpans)
      result += s.toString ( );
      txt.setText (result);
      // txt.setText ("Location model is not empty");*/

      else
      txt.setText ("Location model is empty");

      catch (Exception e)
      txt.setText(e.toString ()+"++++++");
      e.printStackTrace();


      );

      thread.start();








      I am using the apache openNLP to find the location in a sentence and i am getting errors when it passes at nameFinder = new NameFinderME(locationModel);
      I have tried other examples when it uses NameFinderME, it did not work also. Can somebody figure out the issue.



      W/System.err: java.lang.IllegalStateException: javax.xml.parsers.ParserConfigurationException: http://javax.xml.XMLConstants/feature/secure-processing
      at opennlp.tools.util.XmlUtil.createDocumentBuilder(XmlUtil.java:42)
      at opennlp.tools.util.featuregen.GeneratorFactory.createDOM(GeneratorFactory.java:557)
      at opennlp.tools.util.featuregen.GeneratorFactory.create(GeneratorFactory.java:590)
      at opennlp.tools.namefind.TokenNameFinderFactory.createFeatureGenerators(TokenNameFinderFactory.java:189)
      at opennlp.tools.namefind.TokenNameFinderFactory.createContextGenerator(TokenNameFinderFactory.java:150)
      at opennlp.tools.namefind.NameFinderME.(NameFinderME.java:83)
      at com.example.dell.apacheopennlp.apacheOpenNLP$1.run(apacheOpenNLP.java:60)
      at java.lang.Thread.run(Thread.java:764)



      W/System.err: Caused by: javax.xml.parsers.ParserConfigurationException: http://javax.xml.XMLConstants/feature/secure-processing
      at org.apache.harmony.xml.parsers.DocumentBuilderFactoryImpl.setFeature(DocumentBuilderFactoryImpl.java:101)










      share|improve this question















       package com.example.dell.apacheopennlp;
      import android.os.StrictMode;
      import android.support.v7.app.AppCompatActivity;
      import android.os.Bundle;
      import android.widget.TextView;
      import java.io.IOException;
      import java.io.InputStream;
      import opennlp.tools.namefind.NameFinderME;
      import opennlp.tools.namefind.TokenNameFinderModel;
      import opennlp.tools.tokenize.TokenizerME;
      import opennlp.tools.tokenize.TokenizerModel;
      import opennlp.tools.util.Span;
      public class apacheOpenNLP extends AppCompatActivity
      TokenNameFinderModel locationModel = null;
      @Override
      protected void onCreate(Bundle savedInstanceState)
      super.onCreate (savedInstanceState);
      setContentView (R.layout.activity_apache_open_nlp);
      final TextView txt = (TextView) findViewById (R.id.txtView);
      StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
      StrictMode.setThreadPolicy(policy);

      InputStream inputStream = null;
      TokenizerModel tokenModel = null;
      try
      inputStream = getAssets ( ).open ("en-token.bin");
      tokenModel = new TokenizerModel (inputStream);
      inputStream.close ( );
      catch (IOException e)
      e.printStackTrace ( );
      txt.setText (e.toString ( ) + " inside catch of token");


      if (tokenModel != null)
      TokenizerME tokenizer = new TokenizerME (tokenModel);
      String paragraph = "Tutorialspoint is located in Hyderabad";
      String tokens = tokenizer.tokenize (paragraph);
      InputStream locationInputStream = null;

      try
      locationInputStream = getAssets ( ).open ("en-ner-location.bin");
      locationModel = new TokenNameFinderModel (locationInputStream);

      catch (IOException e)
      e.printStackTrace ( );
      txt.setText (e.toString ( ) + " inside catch of location");

      Thread thread = new Thread(new Runnable()

      @Override
      public void run()
      try
      NameFinderME nameFinder = null;
      if (locationModel != null)
      txt.setText ("Location model is not empty");
      nameFinder = new NameFinderME (locationModel);

      //after this line..its goes in the catch and the app crashes
      Span nameSpans = nameFinder.find (tokens);
      String result = null;
      for (Span s : nameSpans)
      result += s.toString ( );
      txt.setText (result);
      // txt.setText ("Location model is not empty");*/

      else
      txt.setText ("Location model is empty");

      catch (Exception e)
      txt.setText(e.toString ()+"++++++");
      e.printStackTrace();


      );

      thread.start();








      I am using the apache openNLP to find the location in a sentence and i am getting errors when it passes at nameFinder = new NameFinderME(locationModel);
      I have tried other examples when it uses NameFinderME, it did not work also. Can somebody figure out the issue.



      W/System.err: java.lang.IllegalStateException: javax.xml.parsers.ParserConfigurationException: http://javax.xml.XMLConstants/feature/secure-processing
      at opennlp.tools.util.XmlUtil.createDocumentBuilder(XmlUtil.java:42)
      at opennlp.tools.util.featuregen.GeneratorFactory.createDOM(GeneratorFactory.java:557)
      at opennlp.tools.util.featuregen.GeneratorFactory.create(GeneratorFactory.java:590)
      at opennlp.tools.namefind.TokenNameFinderFactory.createFeatureGenerators(TokenNameFinderFactory.java:189)
      at opennlp.tools.namefind.TokenNameFinderFactory.createContextGenerator(TokenNameFinderFactory.java:150)
      at opennlp.tools.namefind.NameFinderME.(NameFinderME.java:83)
      at com.example.dell.apacheopennlp.apacheOpenNLP$1.run(apacheOpenNLP.java:60)
      at java.lang.Thread.run(Thread.java:764)



      W/System.err: Caused by: javax.xml.parsers.ParserConfigurationException: http://javax.xml.XMLConstants/feature/secure-processing
      at org.apache.harmony.xml.parsers.DocumentBuilderFactoryImpl.setFeature(DocumentBuilderFactoryImpl.java:101)







      android-studio opennlp bin






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 17 at 18:34

























      asked Nov 12 at 6:20









      Mushira

      33




      33






















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          0
          down vote













          In case you are using a more recent version of Apache OpenNLP you can directly pass the URL which is returned by getResource to the TokenizerModel constructor.



          TokenizerModel tokenModel = 
          new TokenizerModel(apacheOpenNLP.class.getResource("en-token.bin"));


          You should not load the model each time you invoke the tokenizer, the model should be reused for multiple invocations.






          share|improve this answer




















          • I have done the changes but i am still getting the same error: java.lang.NullPointerException.
            – Mushira
            Nov 13 at 5:24










          • Joern ..can you please help me.. I have been able to locate the bin files by placing both en-token.bin and en-ner-location.bin in the asset folder..Then I get the bin file by using getAssets ( ).open ("en-ner-location.bin"); but when it comes at nameFinder = new NameFinderME (model); I got the error of: java.lang.IllegalStateException:java.xml.parsers.ParserConfigurationException ..
            – Mushira
            Nov 15 at 13:30











          • We never tested OpenNLP on Android, please provide the exception with stack trace and also tell which Android version you are trying to run it on.
            – Joern
            Nov 16 at 17:16










          • I'm using Android studio with version is 3.1.4. I have updated the code at the top. Please help its urgent
            – Mushira
            Nov 17 at 18:16










          • Is there any other way to get location from a sentence?
            – Mushira
            Nov 17 at 20:08

















          up vote
          0
          down vote













          Can you try to change the nameFinder to be declared as TokenNameFinder interface type?



          Just try to replace



          NameFinderME nameFinder = null


          with



          TokenNameFinder nameFinder = null


          Rest all should be same.






          share|improve this answer






















          • I have made the changes but unfortunately I am getting the same error. IW/System.err: Caused by: javax.xml.parsers.ParserConfigurationException: javax.xml.XMLConstants/feature/secure-processing at org.apache.harmony.xml.parsers.DocumentBuilderFactoryImpl.setFeature
            – Mushira
            Dec 5 at 14:58











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53256823%2fhow-to-resolve-illegalstateexception-and-parserconfigurationexception-for-findin%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          0
          down vote













          In case you are using a more recent version of Apache OpenNLP you can directly pass the URL which is returned by getResource to the TokenizerModel constructor.



          TokenizerModel tokenModel = 
          new TokenizerModel(apacheOpenNLP.class.getResource("en-token.bin"));


          You should not load the model each time you invoke the tokenizer, the model should be reused for multiple invocations.






          share|improve this answer




















          • I have done the changes but i am still getting the same error: java.lang.NullPointerException.
            – Mushira
            Nov 13 at 5:24










          • Joern ..can you please help me.. I have been able to locate the bin files by placing both en-token.bin and en-ner-location.bin in the asset folder..Then I get the bin file by using getAssets ( ).open ("en-ner-location.bin"); but when it comes at nameFinder = new NameFinderME (model); I got the error of: java.lang.IllegalStateException:java.xml.parsers.ParserConfigurationException ..
            – Mushira
            Nov 15 at 13:30











          • We never tested OpenNLP on Android, please provide the exception with stack trace and also tell which Android version you are trying to run it on.
            – Joern
            Nov 16 at 17:16










          • I'm using Android studio with version is 3.1.4. I have updated the code at the top. Please help its urgent
            – Mushira
            Nov 17 at 18:16










          • Is there any other way to get location from a sentence?
            – Mushira
            Nov 17 at 20:08














          up vote
          0
          down vote













          In case you are using a more recent version of Apache OpenNLP you can directly pass the URL which is returned by getResource to the TokenizerModel constructor.



          TokenizerModel tokenModel = 
          new TokenizerModel(apacheOpenNLP.class.getResource("en-token.bin"));


          You should not load the model each time you invoke the tokenizer, the model should be reused for multiple invocations.






          share|improve this answer




















          • I have done the changes but i am still getting the same error: java.lang.NullPointerException.
            – Mushira
            Nov 13 at 5:24










          • Joern ..can you please help me.. I have been able to locate the bin files by placing both en-token.bin and en-ner-location.bin in the asset folder..Then I get the bin file by using getAssets ( ).open ("en-ner-location.bin"); but when it comes at nameFinder = new NameFinderME (model); I got the error of: java.lang.IllegalStateException:java.xml.parsers.ParserConfigurationException ..
            – Mushira
            Nov 15 at 13:30











          • We never tested OpenNLP on Android, please provide the exception with stack trace and also tell which Android version you are trying to run it on.
            – Joern
            Nov 16 at 17:16










          • I'm using Android studio with version is 3.1.4. I have updated the code at the top. Please help its urgent
            – Mushira
            Nov 17 at 18:16










          • Is there any other way to get location from a sentence?
            – Mushira
            Nov 17 at 20:08












          up vote
          0
          down vote










          up vote
          0
          down vote









          In case you are using a more recent version of Apache OpenNLP you can directly pass the URL which is returned by getResource to the TokenizerModel constructor.



          TokenizerModel tokenModel = 
          new TokenizerModel(apacheOpenNLP.class.getResource("en-token.bin"));


          You should not load the model each time you invoke the tokenizer, the model should be reused for multiple invocations.






          share|improve this answer












          In case you are using a more recent version of Apache OpenNLP you can directly pass the URL which is returned by getResource to the TokenizerModel constructor.



          TokenizerModel tokenModel = 
          new TokenizerModel(apacheOpenNLP.class.getResource("en-token.bin"));


          You should not load the model each time you invoke the tokenizer, the model should be reused for multiple invocations.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 12 at 13:50









          Joern

          1412




          1412











          • I have done the changes but i am still getting the same error: java.lang.NullPointerException.
            – Mushira
            Nov 13 at 5:24










          • Joern ..can you please help me.. I have been able to locate the bin files by placing both en-token.bin and en-ner-location.bin in the asset folder..Then I get the bin file by using getAssets ( ).open ("en-ner-location.bin"); but when it comes at nameFinder = new NameFinderME (model); I got the error of: java.lang.IllegalStateException:java.xml.parsers.ParserConfigurationException ..
            – Mushira
            Nov 15 at 13:30











          • We never tested OpenNLP on Android, please provide the exception with stack trace and also tell which Android version you are trying to run it on.
            – Joern
            Nov 16 at 17:16










          • I'm using Android studio with version is 3.1.4. I have updated the code at the top. Please help its urgent
            – Mushira
            Nov 17 at 18:16










          • Is there any other way to get location from a sentence?
            – Mushira
            Nov 17 at 20:08
















          • I have done the changes but i am still getting the same error: java.lang.NullPointerException.
            – Mushira
            Nov 13 at 5:24










          • Joern ..can you please help me.. I have been able to locate the bin files by placing both en-token.bin and en-ner-location.bin in the asset folder..Then I get the bin file by using getAssets ( ).open ("en-ner-location.bin"); but when it comes at nameFinder = new NameFinderME (model); I got the error of: java.lang.IllegalStateException:java.xml.parsers.ParserConfigurationException ..
            – Mushira
            Nov 15 at 13:30











          • We never tested OpenNLP on Android, please provide the exception with stack trace and also tell which Android version you are trying to run it on.
            – Joern
            Nov 16 at 17:16










          • I'm using Android studio with version is 3.1.4. I have updated the code at the top. Please help its urgent
            – Mushira
            Nov 17 at 18:16










          • Is there any other way to get location from a sentence?
            – Mushira
            Nov 17 at 20:08















          I have done the changes but i am still getting the same error: java.lang.NullPointerException.
          – Mushira
          Nov 13 at 5:24




          I have done the changes but i am still getting the same error: java.lang.NullPointerException.
          – Mushira
          Nov 13 at 5:24












          Joern ..can you please help me.. I have been able to locate the bin files by placing both en-token.bin and en-ner-location.bin in the asset folder..Then I get the bin file by using getAssets ( ).open ("en-ner-location.bin"); but when it comes at nameFinder = new NameFinderME (model); I got the error of: java.lang.IllegalStateException:java.xml.parsers.ParserConfigurationException ..
          – Mushira
          Nov 15 at 13:30





          Joern ..can you please help me.. I have been able to locate the bin files by placing both en-token.bin and en-ner-location.bin in the asset folder..Then I get the bin file by using getAssets ( ).open ("en-ner-location.bin"); but when it comes at nameFinder = new NameFinderME (model); I got the error of: java.lang.IllegalStateException:java.xml.parsers.ParserConfigurationException ..
          – Mushira
          Nov 15 at 13:30













          We never tested OpenNLP on Android, please provide the exception with stack trace and also tell which Android version you are trying to run it on.
          – Joern
          Nov 16 at 17:16




          We never tested OpenNLP on Android, please provide the exception with stack trace and also tell which Android version you are trying to run it on.
          – Joern
          Nov 16 at 17:16












          I'm using Android studio with version is 3.1.4. I have updated the code at the top. Please help its urgent
          – Mushira
          Nov 17 at 18:16




          I'm using Android studio with version is 3.1.4. I have updated the code at the top. Please help its urgent
          – Mushira
          Nov 17 at 18:16












          Is there any other way to get location from a sentence?
          – Mushira
          Nov 17 at 20:08




          Is there any other way to get location from a sentence?
          – Mushira
          Nov 17 at 20:08












          up vote
          0
          down vote













          Can you try to change the nameFinder to be declared as TokenNameFinder interface type?



          Just try to replace



          NameFinderME nameFinder = null


          with



          TokenNameFinder nameFinder = null


          Rest all should be same.






          share|improve this answer






















          • I have made the changes but unfortunately I am getting the same error. IW/System.err: Caused by: javax.xml.parsers.ParserConfigurationException: javax.xml.XMLConstants/feature/secure-processing at org.apache.harmony.xml.parsers.DocumentBuilderFactoryImpl.setFeature
            – Mushira
            Dec 5 at 14:58















          up vote
          0
          down vote













          Can you try to change the nameFinder to be declared as TokenNameFinder interface type?



          Just try to replace



          NameFinderME nameFinder = null


          with



          TokenNameFinder nameFinder = null


          Rest all should be same.






          share|improve this answer






















          • I have made the changes but unfortunately I am getting the same error. IW/System.err: Caused by: javax.xml.parsers.ParserConfigurationException: javax.xml.XMLConstants/feature/secure-processing at org.apache.harmony.xml.parsers.DocumentBuilderFactoryImpl.setFeature
            – Mushira
            Dec 5 at 14:58













          up vote
          0
          down vote










          up vote
          0
          down vote









          Can you try to change the nameFinder to be declared as TokenNameFinder interface type?



          Just try to replace



          NameFinderME nameFinder = null


          with



          TokenNameFinder nameFinder = null


          Rest all should be same.






          share|improve this answer














          Can you try to change the nameFinder to be declared as TokenNameFinder interface type?



          Just try to replace



          NameFinderME nameFinder = null


          with



          TokenNameFinder nameFinder = null


          Rest all should be same.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Dec 4 at 11:36

























          answered Dec 4 at 11:31









          Shivam Gandhi

          62




          62











          • I have made the changes but unfortunately I am getting the same error. IW/System.err: Caused by: javax.xml.parsers.ParserConfigurationException: javax.xml.XMLConstants/feature/secure-processing at org.apache.harmony.xml.parsers.DocumentBuilderFactoryImpl.setFeature
            – Mushira
            Dec 5 at 14:58

















          • I have made the changes but unfortunately I am getting the same error. IW/System.err: Caused by: javax.xml.parsers.ParserConfigurationException: javax.xml.XMLConstants/feature/secure-processing at org.apache.harmony.xml.parsers.DocumentBuilderFactoryImpl.setFeature
            – Mushira
            Dec 5 at 14:58
















          I have made the changes but unfortunately I am getting the same error. IW/System.err: Caused by: javax.xml.parsers.ParserConfigurationException: javax.xml.XMLConstants/feature/secure-processing at org.apache.harmony.xml.parsers.DocumentBuilderFactoryImpl.setFeature
          – Mushira
          Dec 5 at 14:58





          I have made the changes but unfortunately I am getting the same error. IW/System.err: Caused by: javax.xml.parsers.ParserConfigurationException: javax.xml.XMLConstants/feature/secure-processing at org.apache.harmony.xml.parsers.DocumentBuilderFactoryImpl.setFeature
          – Mushira
          Dec 5 at 14:58


















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53256823%2fhow-to-resolve-illegalstateexception-and-parserconfigurationexception-for-findin%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Top Tejano songwriter Luis Silva dead of heart attack at 64

          政党

          天津地下鉄3号線