error: object X is not a member of package Y


I have a project composed of 3 modules, one big pure java module with no scala-artifact but dependency on one of the two other mixed scala-java modules. When trying to build, in one class in the pure java module, I get the above error:

error: object sleepycat is not a member of package com
import com.sleepycat.db.EnvironmentConfig;

The affected "object" is the third import of the same package Y. When rewriting import com.sleepycat.db. EnvironmentConfig is found with no problem.

When checking that error with different google searches, it appears to occur mostly with intelliJ and the scala plugin. I'm running latest version of intelliJ (11.1.2) and nightly build of scala plugin version  0.5.796 (same error with regular version). I  frequently try to invalidate caches.

One problem might be, that the java module was imported from a checkout maven project, into which I copied some non-maven classes. Not sure wheter this matters.

When I select javac  in settings:scala_compiler:Join compilation, the error disappears in the java module, but in the one of the scala module this error appears:

error: value getEnvironmentConfig is not a member of

Actually it's quite some time that I'm having similar problems of incoherences regarding packages and member visibility during import. It drives me nuts to the point that I retried eclipse!  I could not find something conclusive on this forum, similar problems seem to be fixed.

Any ideas?

thanks for some input...


Comment actions Permalink

To clarify the issue we need to reporduce the problem somehow.

Can you isolate the problem so that it can be observed in a small number of sample source files? Alternatively we can use your original project code if it's open.

The problem seems to lay within joint compilation of Scala and Java sources, and the primary cause of the misbehavior may be the Scalac itself.

Comment actions Permalink

BTW, what version of Scala are you using?

Comment actions Permalink

I am having the same issue right now. It seams that if java libraries are imported and a particular package is empty, it "confuses" scala compiler. For example, if your package structure is, then "com.domain" package usually has no classes and this causes a problem.

In particular, I am experiencing this problem when running tests for the project and one of the files needs to be re-compiled due to changes. "Run All Tests" performs a "Make " first and that's where the problem surfaces.


Please sign in to leave a comment.