• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Subdirectory problem -- Unable to compile the jsp

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have created a website and hosted on linux and tomcat 6 combination. I have a very different problem.

The application could not detect the class files pasted in WEB-INF->classes folder when we access the JSP file which is in subdirectory.

I created a class file with packages structure properly pasted in classes folder. I created a jsp file to just access that class file. The JSP is working fine when I access it from root folder. If i put it in subdirectory, it is throwing errors saying

org.apache.jasper.JasperException: Unable to compile class for JSP:

An error occurred at line: 11 in the jsp file: /Test.jsp
User cannot be resolved to a type
8:
9:
10:
11: <% User use = new User();
12:
13: Items item = new Items();
14:

The User class is properly pasted in classes folder. I also imported the class file. The same is running when I access website/Test.jsp and but not when i access website/abc/Test.jsp

Other .js , .html, .css files in the same subdirectory are successfully accessed.

Please help me in this.

Thanks
Sree
 
Sreenivasa Rao P
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Any suggestions plzzz.

Thanks
Sree
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How are you importing that class? Post the relevant statement from the JSP.
 
Sreenivasa Rao P
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is the import class.

<%@page import="java.sql.*, mysite.db.*" %>

I will give some more info. My website launched on shared tomcat. There are other websites launched in the same tomcat. Would there be any settings changed by service provider?

Is there any change that I could do with context.xml file in META-INF folder of my webstack?

Thanks
Sree
 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
have you tried like this format

File f=new File("....");





 
Sreenivasa Rao P
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Mohan,

I did not understand your post. Can you please elaborate it?

-Sree
 
Mohan rvscas
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sreenivasa,

i have tested your code.

like my formate.

its executing properly.

<%@page contentType="text/html" pageEncoding="UTF-8" import="java.io.*,controller.*"%>

<%

UserBean us=new UserBean();

out.print(us.getPassWord());

%>

Here controller is the package name.

inside controller package UserBean class is appear.

while executing the above code getPassWord() called and its give the result.

just test what you coded...

 
Sreenivasa Rao P
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mohan, thanks for your reply.

Your is working for me also. But when we put the same jsp in subdirectory, the class files are not available and throwing errors.

Same tomcat is hosting many websites. So they might have configured <host> tag in server.xml with my website appBase value. The class files are available for JSP if it is in Root directory, but not available when the same jsp is in subdirectory under root.

I think we can do something using context.xml putting in root/META-INF folder.

What do you say? do you have any other approach? If you aware of context.xml configuration please tell me how to do that?

Once again thanks
-Sree
 
reply
    Bookmark Topic Watch Topic
  • New Topic