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 8386199
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:52:12+00:00 2026-06-09T17:52:12+00:00

I have a maven project with 2 modules. There is a crawler module which

  • 0

I have a maven project with 2 modules. There is a crawler module which depends on the core module. Each module has it’s own config.ini file in src/main/resources/ and one single main class per module.

Now I want to start the NewsCrawler like this:

mvn exec:java -Dexec.mainClass="org.aksw.simba.rdflivenews.NewsCrawler"

This works for loading the crawlers own config file but fails to load the config file from core-module:

NewsCrawler.CONFIG = new Config(new Ini(File.class.getResourceAsStream("/newscrawler-config.ini")));
RdfLiveNews.CONFIG = new Config(new Ini(File.class.getResourceAsStream("/rdflivenews-config.ini")));

The second config load fails with a NullPointerException. I checked the jar file and the config file is inside. The strange thing is that same two lines work in the test cases. Also with eclipse I can start the main of the class without any problems.

  • 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-09T17:52:14+00:00Added an answer on June 9, 2026 at 5:52 pm

    Here is a well-functioning source code of your example.

    dezip, then on the command line, go to the directory containing the parent pom then do :

    mvn clean test
    

    Do something like this to know where you are when calling getResourceAsStream() :

    try {
        IniFile = new Ini(File.class.getResourceAsStream("/newscrawler-config.ini"));
    } catch(Exception e) {
        System.out.println("Resource file not found : " + File.class.getResource("."));
    }
    

    Also try to remove / before newscrawler-config.ini. It depends on where you put your files in the hierarchy. getResourceAsStream search the CLASSPATH, not the source path.

    You may also use this.getClass().getResourceAsStream() instead of File.class.getResourceAsStream().

    It could be a solution to copy the src/main/resource to your target/test-classes by configuring resource in your pom.xml :

    <build>
      <resources>
        <resource>
          <filtering>false</filtering>
          <directory>${basedir}/src/main/resource</directory>
        </resource>
      </resources>
      <testResources>
        <testResource>
          <filtering>false</filtering>
          <directory>${basedir}/src/main/resource</directory>
        </testResource>
      </testResources>
    </build>
    

    and call getResourceAsStream() with a quasi-full-path :

    this.class.getResourceAsStream("/com/jeromeradix/stackoverflow/newscrawler/newscrawler-config.ini"));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a project which is build through maven. Each module is built as
I have a multi-module Maven project A. There are two modules: B and C,
We have a rather complicated multi-module Maven project. There are Flex modules, GWT modules,
I have a maven multiple-module project, which is giving me headaches in the assembly:assembly
I have a project in which the maven-enforcer rule fails with a multi-module build
I have parent project parent, which has three modules like: <groupId>com.dummy.bla.bla</groupId> <artifactId>parent</artifactId> <version>1.0-SNAPSHOT</version> <packaging>pom</packaging>
I'm new to Maven. I have a multi-module maven 2 project that has the
I have a huge multi-module project , which is being built using maven. Most
In a maven project I have several modules which only have a persitence.xml for
I have a multi-module maven project. In every module there are unit tests. When

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.