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

  • Home
  • SEARCH
  • 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 8184307
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T01:27:34+00:00 2026-06-07T01:27:34+00:00

I’m constructing an application in Google App Engine (using Eclipse) that uses WEKA [1]

  • 0

I’m constructing an application in Google App Engine (using Eclipse) that uses WEKA [1] in one of its parts. This app needs to load ARFF bases, but that’s allright. The directory in which these bases are is in project’s root directory. Following lines are responsible for loading bases:

1. DataSource source;
2. source = new DataSource("bases/iris.arff");
3. Instances trainInstances = source.getDataSet();
4. trainInstances.setClassIndex(trainInstances.numAttributes() - 1);

Above lines are part of the code that is called in a servlet responsible for execution of the application. Servlet runs ok, but ‘source’ variable doesn’t get to read arff file and, so, i get the following exception at line 3:

“java.io.IOException: No source has been specified
at weka.core.converters.ArffLoader.getDataSet(ArffLoader.java:1003)”

According to [2],

It is possible to read from a file which is uploaded as part of your application provided that it is in the following locations: war/WEB-INF // in a location matching the pattern in appengine-web.xml (which by default includes everything)

I’ve followed this two points, but with no sucess. To the second one, my configuration was the following:

<resource-files>
    <include path="/bases/**.arff" />
</resource-files>

Given this long history, I ask to you: Is there anyway to put “bases” directory in some place, or configuring something on GAE xml files, or on Eclipse, that make possible ARFF bases be loaded?


References

[1] http://www.cs.waikato.ac.nz/ml/weka/

[2] https://developers.google.com/appengine/kb/java#readfile

  • 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-07T01:27:37+00:00Added an answer on June 7, 2026 at 1:27 am

    Your problem is more about loading resources in web application environment.
    Some additional resources in stackoverflow about loading resources in web application environment.

    Put your arff file in your source-src directory. When you compile your application, files under this directory copied to web-inf/classes directory.

    See Project Explorer

    You can see where they are copied if you create a war file. See (Export - War)

    After you make sure that your arff file is included in your web archive file (war file). You can use appropriate path to it. Like below. You need to use InputStream constructor not String one.

    InputStream stream = getServletContext().getResourceAsStream("WEB-INF/classes/iris.arff");
    DataSource source = new DataSource(stream);
    

    I have tried this with simple web application project, it works. My code is as below.

    deneme.jsp

    <%
    InputStream stream = getServletContext().getResourceAsStream("WEB-INF/classes/iris.arff");
    String summary = LoadArffFile.loadArffFileAndFindSummary(stream );
    
    out.println(summary);
    
    %>
    

    LoadArffFile.java

    public static String loadArffFileAndFindSummary( InputStream stream)
    {
    
         DataSource source = new  DataSource(stream);
         String summary = null;
        try {
            summary = source.getStructure().toSummaryString();
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
         return summary;
    }
    

    Output in tomcat.

    Relation Name: iris Num Instances: 0 Num Attributes: 5 Name Type Nom Int Real Missing Unique Dist 1 sepallength Num 0% 0% 0% 0 / 0% 0 / 0% 0 2 sepalwidth Num 0% 0% 0% 0 / 0% 0 / 0% 0 3 petallength Num 0% 0% 0% 0 / 0% 0 / 0% 0 4 petalwidth Num 0% 0% 0% 0 / 0% 0 / 0% 0 5 class Nom 0% 0% 0% 0 / 0% 0 / 0% 0 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm making a simple page using Google Maps API 3. My first. One marker
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
We're building an app, our first using Rails 3, and we're having to build
I am using Paperclip to handle profile photo uploads in my app. They upload
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,

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.