Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Strange Compile Error

 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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/EpcDispatchHelper.java:102: 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 ]
 
Dale Seng
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

--Dale--
 
Mike Rainville
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeroen,

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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic