Baffling class not found problem  
Author Message
laredotornado





PostPosted: 2005-5-25 21:55:00 Top

java-programmer, Baffling class not found problem Hello, I'm using Java 1.3 with WebLogic 5.1 on Solaris. I have these
files:

cms/system/CMSException.class
cms/system/Constants.class
cms/system/InitServlet.class
cms/system/Log.class

When I include this line on my JSP page

<%@ page import="cms.system.*" %>

everything compiles fine. As does this line

<%@ page import="cms.*" %>

but when I try

<%@ page import="cms.system.Constants" %>

(r using any of the 4 class names above) I get the error:

Compilation of '/tmp/support/jsp_servlet/_www/__temp.java' failed:
/tmp/support/jsp_servlet/_www/__temp.java:16: Class
cms.system.Constants not found in import.
probably occurred due to an error in /www/temp.jsp line 1:
<%@ page import="cms.system.Constants" %>

How can this be? The perms on the files above are all 775. Can anyone
think of an explanation for why these files can't be found?

Thanks, - Dave

 
John C. Bollinger





PostPosted: 2005-5-25 23:05:00 Top

java-programmer >> Baffling class not found problem email***@***.com wrote:

> Hello, I'm using Java 1.3 with WebLogic 5.1 on Solaris. I have these
> files:
>
> cms/system/CMSException.class
> cms/system/Constants.class
> cms/system/InitServlet.class
> cms/system/Log.class
>
> When I include this line on my JSP page
>
> <%@ page import="cms.system.*" %>
>
> everything compiles fine. As does this line
>
> <%@ page import="cms.*" %>
>
> but when I try
>
> <%@ page import="cms.system.Constants" %>
>
> (r using any of the 4 class names above) I get the error:
>
> Compilation of '/tmp/support/jsp_servlet/_www/__temp.java' failed:
> /tmp/support/jsp_servlet/_www/__temp.java:16: Class
> cms.system.Constants not found in import.
> probably occurred due to an error in /www/temp.jsp line 1:
> <%@ page import="cms.system.Constants" %>
>
> How can this be? The perms on the files above are all 775. Can anyone
> think of an explanation for why these files can't be found?

The classes are not on the relevant classpath. The wildcard imports
work because they don't imply the existence of any particular class.
The specific class imports fail because, as the message tells you, the
class is not found. See my response in your other thread for
information on how to package these classes and where to put them.

--
John Bollinger
email***@***.com
 
laredotornado





PostPosted: 2005-5-26 23:26:00 Top

java-programmer >> Baffling class not found problem I appreciate your response, but the directory right above the
"cms/logic" directory is in the classpath. I assumed this is why the
call

<%@ page import="cms.logic.*" %>

compiles fine. Therefore, shouldn't .class files within the
"cms/logic" directory also be in the classpath (I have verified there
are no case sensitivity issues)? If I try and do an import with
totally bogus directories, I get the error

/tmp/support/jsp_servlet/_temp/__temp.java:16: Package abc.def not
found in import.
probably occurred due to an error in /temp/temp.jsp line 1:
<%@ page import="abc.def.*" %>

 
 
John C. Bollinger





PostPosted: 2005-5-27 0:57:00 Top

java-programmer >> Baffling class not found problem email***@***.com wrote:

> I appreciate your response, but the directory right above the
> "cms/logic" directory is in the classpath.

You apparently have not *read* my response, or at least not read and
understood the post it directed you to in your other thread. You have
not responded to the points therein.

I cannot argue against your assertion that *a* classpath contains the
parent directory of cms/, but either *the classpath relevant to the
compilation* in question does not contain it, or the directory does not
contain the relevant class. The previous response I directed you to
described specifically how to structure the jar containing the class,
and where to place it.

> I assumed this is why the
> call
>
> <%@ page import="cms.logic.*" %>
>
> compiles fine. Therefore, shouldn't .class files within the
> "cms/logic" directory also be in the classpath (I have verified there
> are no case sensitivity issues)? If I try and do an import with
> totally bogus directories, I get the error
>
> /tmp/support/jsp_servlet/_temp/__temp.java:16: Package abc.def not
> found in import.
> probably occurred due to an error in /temp/temp.jsp line 1:
> <%@ page import="abc.def.*" %>

My best guess is that you have one or more appropriate directory
structures somewhere in the webapp classpath (which is completely
distinct from the user classpath) but that none of them contain the
class. The directory that does contain the class is not among those in
the webapp classpath.

<idea>
An alternative, supposing that the directories are correct and the class
file is in the right place, might be that access control prevents the
compiler from reading the class file. WebLogic's user context must have
read access to the class file and to all the directories in the path to it.
</idea>

--
John Bollinger
email***@***.com