Source not found error after downloading ObjectDB 2.3.7_04

#1


Code snippet:

Properties prop = new Properties();

prop.setProperty("javax.jdo.PersistenceManagerFactoryClass","com.objectdb.jdo.PMF");

prop.setProperty("javax.jdo.option.ConnectionUR","local.odb");

PersistenceManagerFactory pmf = JDOHelper.getPersistenceManagerFactory(prop);
PersistenceManager pm = pmf.getPersistenceManager();

I am getting an error Source attachment does not contain source for File PMF.class.

I had added the zip file jdo_2.2.zip as source.

Please help need to complete assg in 2 days

#2

You have to provide more details. What kind of error is it? Compilation? Debugging? Runtime?

If it is an exception - provide a full stack trace.

If it is a compilation error or an IDE error - provide a full error message and a screen shot of the IDE.

ObjectDB Support
#3

When I am trying to debug code snippet mentioned above in Eclipse it asks me to provide source code at debug time. I provided the zip file mentioned above. But them it throws an error that source not found. 

Basically the PMF.class is compiled from PMF.java and in the source file I am not able to find any PMF.java class.

 

For setup I downloaded the ObjectDB zip file. Placed it in source code of my existing project. I added the Objectdb.jar file in build path. There were no compile time errors. I debugged following code

import java.util.Properties;

import javax.jdo.JDOHelper;
import javax.jdo.PersistenceManager;
import javax.jdo.PersistenceManagerFactory;

public class Main {

    /**
     * @param args
     */
    public static void main(String[] args) {
 
        Employee emp = new Employee("ALEX",0, "ABC.CORP");
 
        Properties prop = new Properties();
        prop.setProperty("javax.jdo.PersistenceManagerFactoryClass","com.objectdb.jdo.PMF");
        prop.setProperty("javax.jdo.option.ConnectionUR","local.odb");

        PersistenceManagerFactory pmf = JDOHelper.getPersistenceManagerFactory(prop);
        PersistenceManager pm = pmf.getPersistenceManager(); / <===
        try {
            pm.makePersistent(emp);
        }
        finally {
            pm.close();
        }
    }
}

When I reach above statement in RED it asks me to mention the source path so I added file

objectdb-2.3.7_04\objectdb-2.3.7_04\src\jdo_2.2.zip as source code.

But then it throws Source not found error.

Please tell me if I am doing correct setup.

#4

ObjectDB is not open source so the source code of PMF is not available.

But usually there is no reason for you to debug the PMF class (which is not your code). This error is not expected if you execute the line with Step Over (F6) rather than with Step Into (F5).

ObjectDB Support

Reply