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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T08:22:24+00:00 2026-05-30T08:22:24+00:00

So mongoDB is running on 27017 and my collection name is test. try {

  • 0

So mongoDB is running on 27017 and my collection name is test.

  try {
            // - Connection to base
            String mongoURI = "mongodb://localhost:27017/test";
            MongoDbConnection connection = null;

        Map<String, Object> parameters = new HashMap<String, Object>();
        try {
line35      connection = new MongoDbConnection(mongoURI, null, null);
                parameters.put(MongoDbDataSource.CONNECTION, connection);
                JasperDesign jasperDesign = JRXmlLoader.load("/home/gocoffee.jrxml");
                JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);
                File jasperFile;
                jasperFile = new File("/home/MongoDbReport.jasper");
                JasperCompileManager.compileReportToFile("/home/gocoffee.jrxml", "MongoDbReport.jasper");
                JasperFillManager.fillReportToFile("/home/MongoDbReport.jasper", parameters);               
                JasperExportManager.exportReportToPdfFile("/home/MongoDbReport.jrprint");
            }

And I have this error, I don’t understand why :

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Logger
    at com.jaspersoft.mongodb.MongoDbConnection.<init>(MongoDbConnection.java:62)
    at Generate.main(Generate.java:35)
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Logger
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)

The MongoURI seems fine and i think i don’t have any login or password

  • 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-05-30T08:22:26+00:00Added an answer on May 30, 2026 at 8:22 am

    I agree with @AdamC: you need log4j. But I would say that it’s not a matter of “installing” it; you just need to add a log4j.jar file to your project classpath. Your code looks fine.

    EDIT: moving info from my comment into the answer.

    In addition to adding log4j.jar to the classpath, you also need a file called log4j.properties to configure log4j. You can create your own, or you can grab the copy from the MongoDB connector source on jasperforge. Look for src/main/resources/log4j.properties.

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

Sidebar

Related Questions

I am running some unit test that persist documents into the MongoDb database. For
I have mongodb running and using morphia. Having a Collection of BatchData Documents and
I am trying to setup mongodb to test out its speed and am running
I'm running this code: $db = new Mongo(mongodb://user:pw@flame.mongohq.com:27081/dbname); $collection = $db->foobar; $collection->insert($content); I'm trying
I need to connect to a MongoDB instance from my EJB3 application, running on
I am using MongoDB v1.4 and the mongodb-csharp driver and I try to group
I've recently installed mongodb on my CentOS 6 VM running on Vagrant. I added
I am having performance issues with MongoDB. Running on: MongoDB 2.0.1 Windows 2008 R2
I'm running a simple python script sending data to a mongodb #!/usr/bin/env python import
I have a large collection (~2.7 million documents) in mongodb, and there are a

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.