Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7944863
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T00:40:44+00:00 2026-06-04T00:40:44+00:00

I am now developing a java web application. I use some library (.jar) file

  • 0

I am now developing a java web application. I use some library (.jar) file and create some java under source package (.java). In my .java file, I make some codes for reading an external file and also the jar file that I used will read external file too called from my .java file.

I don’t get any problem when running as java application, but I got an error when creating an object in my servlet. An error messages say that my .java file and the .jar file could not find my needed external files. I add my external files directly in my project folder.

To overcome this, I tried :
1.Add my external files into my lib folder. And I still failed.
2.Using project properties to add on packaging (right click on project then select compile and select packaging). I add all of them there. And I still failed.
All the error that I got after doing the point 2 is :

WARNING: StandardWrapperValve[analyzer]: PWC1382: Allocate exception for servlet analyzerjava.lang.NullPointerException
at alphabeta.Alpha.loadAlpha(Alpha.java:36)
at alphabeta.AlphaBeta.loadCorpus(AlphaBeta.java:111)
at alphabeta.AlphaBeta.<init>(AlphaBeta.java:93)
at alphabeta.Analyzer.init(Analyzer.java:28)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1444)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:1071)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:189)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98)
at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:91)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:330)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:174)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:725)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
at java.lang.Thread.run(Thread.java:722)

And also when I deploy my project, the glassfish log show me this :

WARNING: Illegal character in path at index 14: file:/D:/Grade 4/Noble 2/Finish II/AlphaBeta/AlphaBetaSystem/build/web/WEB-INF/lib/alphagamma.jar java.net.URISyntaxException: Illegal character in path at index 14: file:/D:/Grade 4/Noble 2/Finish II/AlphaBeta/AlphaBetaSystem/build/web/WEB-INF/lib/alpahgamma.jar
at java.net.URI$Parser.fail(URI.java:2829)
at java.net.URI$Parser.checkChars(URI.java:3002)
at java.net.URI$Parser.parseHierarchical(URI.java:3086)
at java.net.URI$Parser.parse(URI.java:3034)
at java.net.URI.<init>(URI.java:595)
at java.net.URL.toURI(URL.java:936)

Here is my code for reading an external file. I implement this on java source code that will be called in servlet when I create its object.

 public void loadPaper() throws FileNotFoundException, IOException {
    File[] corpus = new File(getDirectory()).listFiles();
    System.out.println(corpus.length);
    for (int iPaper = 0; iPaper < corpus.length; ++iPaper) {
        File paper = corpus[iPaper];
        BufferedReader input = new BufferedReader(new FileReader(paper));
        StringBuilder contents = new StringBuilder();
        String line;
        while ((line = input.readLine()) != null) {
            contents.append(line).append("\n");
        }
        String[] rawContent = contents.toString().split("\n\n");
        Paper cPaper = new Paper(iPaper, rawContent[0], rawContent[1], rawContent[rawContent.length - 1]);
        contents = new StringBuilder();
        for (int iContent = 2; iContent < rawContent.length - 1; ++iContent) {
            contents.append(rawContent[iContent]).append("\n\n");
        }
        cPaper.setText(rawContent[0] + "\n\n" + contents.toString());
        this.getCorpusCollection().add(cPaper);
        input.close();
    }
}

The directory is a property for this class. I set it when I want to create its object.
Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T00:40:46+00:00Added an answer on June 4, 2026 at 12:40 am

    Finally I could figure it. Okay, the trick that I use is: I tried to save my a file from java class where the class that want to read the data. At there, I print the absolute path to find out, where the server save the external path as relative path to my application.
    Based on that information, I put all my external file there and well my aplication goes well.

    Thank you for the help.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing a java web Application and I use Tomcat connection pooling, here
We are developing web based java application. Richfaces used as library.And we have datatable
I'm now developing an app on iOS. With some reason, I want to use
We're developing a data heavy modular web application stack with java but have little
I am developing a Java web services application that is (mostly) to be used
I am developing a web application in Java, in which I want to send
I'm developing an application in java which can take textual information from different web
While developing a web based java application I am a bit confused about the
I am developing a web application on JAVA EE 6 with SEAM 3, using
I have been developing a java application. Now I have decided to convert this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.