File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Strange Compile Error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Strange Compile Error" Watch "Strange Compile Error" New topic

Strange Compile Error

Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
I'm running into a compile error that's giving me fits, and hoping someone can help:

I'm using Ant to compile a J2EE project consisting of an EJB project and a web project. The ant script compiles the EJB project just fine, but fails on the Web Project.

Here's the message I get:

[javac] /home/mhiggin1/build/WebEPC/source/com/ejgallo/eai/epc/servlets/ cannot resolve symbol
[javac] symbol : method getEpcFacadeLocalHome ()
[javac] location: class com.ejgallo.eai.epc.EpcInterfaceCache
[javac] EpcFacadeLocalHome epcFacadeHome = EpcInterfaceCache.getEpcFacadeLocalHome();

What I understand of "cannot resolve symbol" with a method is that the compiler can't find a method of that name, or with that signature.

The class EpcInterfaceCache referenced by the message is in the EJB project. The classpath for the web project does include the EJB project.

Here is portion of the EpcInterfaceCache class:

The method signature seems to match. If it couldn't find the class in the classpath, I'd get a ClassDefNotFound error, right?

Anyone got any ideas as to what might be happening?

I'm using IBM's WSAD 5.1 as my IDE, and it compiles just fine in the IDE.
[ March 17, 2005: Message edited by: Merrill Higginson ]

Consultant, Sima Solutions
Dale Seng
Ranch Hand

Joined: Mar 22, 2004
Posts: 275
Would it be possible that there is more than a single copy of this class? Perhaps one in a jar file or something? Maybe that other one doesn't have the same signature.

Mike Rainville
Ranch Hand

Joined: May 29, 2004
Posts: 36
If the variable is just being returned by the method call, I would expect this line to be first in the method or you might try adding the type declaration where you assign its value.

EpcFacadeLocalHome myEpcFacadeLocalHome = null;
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Thanks Dale and Mike for your respones. Dale's response sent me in the right direction. The Ant script checks out the projects from CVS before compiling, and as it turns out, the CVS repository had some old .class files in the WEB-INF/classes directory. The problem, then, is that the compiler was finding an older version of the class without the getEpcFacadeLocalHome() method.

Thanks again for your help!
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
If you have the code you shouldn't put the compiled classes into CVS. Better to check out the code and compile that, then keep the latest compiled version outside of CVS.

Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864

I agree wholeheartedly that classes don't belong in cvs. The compile problem I encountered is a good example of why they shouldn't be included. I always try to remember to put the WEB-INF/classes directory in the .cvsignore file. In this case it was a project created by someone else that I needed to create and ant compile and deployment script for.
[ March 18, 2005: Message edited by: Merrill Higginson ]
I agree. Here's the link:
subject: Strange Compile Error
It's not a secret anymore!