Jump to content
carcleo

Onde estou errando?

Recommended Posts

carcleo

Onde estou errando?

Bom, instalei o Apache Tomcat aqui:

C:\Program Files\Apache Software Foundation\Tomcat 8.0\

Entrei na pasta

C:\Program Files\Apache Software Foundation\Tomcat 8.0\webapps\ROOT\

e criei uma pasta "jsp" para dizer que dentro dela vou colocar meus projetos.

Daí pra frente a árvore de diretórios do meu projeto ficou assim:

imwsaogotardo.com.br (nome do site)

imwsaogotardo.com.br
                   grava.jsp
                   index.jsp
                   /ebd
                       /dao    
                           /banco
                                 Conexao.java
                           /pessoas      
                                 DAOPessoa.java
                                 DAOProfessor.java
                       /modelos
                           /perguntas
                                 Pergunta.java
                           /pessoas
                                 Pessoa.java
                                 Professor.java
                                 Usuario.java
                           /retornos
                                 Comentario.java
                                 Resposta.java
                                 Retorno.java
                           /salas
                                 Sala.java

O arquivo index.jsp esta assim:

<%@ page import="ebd.dao.pessoas" %>
<%@ page import="ebd.dao.banco" %>
<html>
 <head>
    <title>IMW Muriaé São Gotardo - EBD</title>
 <head>
 <body>
<%@
DAOPessoa pessoa = new DAOPessoa();
outprint(pessoa.buscarTodos());
%>
 </body>
</html>

Eis o erro gerado:

HTTP Status 500 - java.lang.ClassNotFoundException: org.apache.jsp.jsp.imwsaogotardo_com_br.index_jsp

type Exception report

message java.lang.ClassNotFoundException: org.apache.jsp.jsp.imwsaogotardo_com_br.index_jsp

description The server encountered an internal error that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: java.lang.ClassNotFoundException: org.apache.jsp.jsp.imwsaogotardo_com_br.index_jsp
org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:176)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
root cause

java.lang.ClassNotFoundException: org.apache.jsp.jsp.imwsaogotardo_com_br.index_jsp
java.net.URLClassLoader.findClass(Unknown Source)
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:131)
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:62)
org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:171)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
note The full stack trace of the root cause is available in the Apache Tomcat/8.0.22 logs.

Apache Tomcat/8.0.22

Onde estou errando?

Share this post


Link to post
Share on other sites
crislanio_macedo

Quando eu por exemplo faço algum projeto usando eclipse, uma das possíveis soluções é ir em Build Path e ver se o apache está no projeto(bem como os jars do projeto) , depois é bom ir em Path Facets na aba ao lado ver Runtime e adicionar um server (tomcat) e aplicar ao projeto.

Edited by crislanio_macedo

Share this post


Link to post
Share on other sites
carcleo

Pois é. Meu problema é o seguinte.

Eu programo em php.

A IDE que uso é o bloco de notas e o servidor é o Apache Server. Nele, tem uma pasta chamada httpdocs aonde eu coloco as pastas com os sites que faço.

Exemplo:

httpdocs

www.abc.com.br

pastas de abc no estilo,

admin/

img/..

global/

org

arquivos de interface.php

www.bca.com.br

pastas de bcs

www.cba.com.br

pastas de cba

E as pastas dentro de cada site são distribuídas conforme a minha necessidade

Mas parece que o Apache Tomcat não aceita essa ordenação!

No php, se eu tenho um estrutura assim:

site/

global/

base.php

index.php

E nesse index.php preciso importar o código de base.php que esta em outro diretório, basta fazer:

include "global/base.php";

Mas parece que o Tomcat não aceita isso!

Share this post


Link to post
Share on other sites
HappyHippyHippo

https://tomcat.apache.org/tomcat-7.0-doc/appdev/deployment.html#Standard_Directory_Layout

Standard Directory Layout

To facilitate creation of a Web Application Archive file in the required format, it is convenient to arrange the "executable" files of your web application (that is, the files that Tomcat actually uses when executing your app) in the same organization as required by the WAR format itself. To do this, you will end up with the following contents in your application's "document root" directory:

*.html, *.jsp, etc. - The HTML and JSP pages, along with other files that must be visible to the client browser (such as Javascript, stylesheet files, and images) for your application. In larger applications you may choose to divide these files into a subdirectory hierarchy, but for smaller apps, it is generally much simpler to maintain only a single directory for these files.

/WEB-INF/web.xml - The Web Application Deployment Descriptor for your application. This is an XML file describing the servlets and other components that make up your application, along with any initialization parameters and container-managed security constraints that you want the server to enforce for you. This file is discussed in more detail in the following subsection.

/WEB-INF/classes/ - This directory contains any Java class files (and associated resources) required for your application, including both servlet and non-servlet classes, that are not combined into JAR files. If your classes are organized into Java packages, you must reflect this in the directory hierarchy under /WEB-INF/classes/. For example, a Java class named com.mycompany.mypackage.MyServlet would need to be stored in a file named /WEB-INF/classes/com/mycompany/mypackage/MyServlet.class.

/WEB-INF/lib/ - This directory contains JAR files that contain Java class files (and associated resources) required for your application, such as third party class libraries or JDBC drivers.

When you install an application into Tomcat (or any other 2.2 or later Servlet container), the classes in the WEB-INF/classes/ directory, as well as all classes in JAR files found in the WEB-INF/lib/ directory, are made visible to other classes within your particular web application. Thus, if you include all of the required library classes in one of these places (be sure to check licenses for redistribution rights for any third party libraries you utilize), you will simplify the installation of your web application -- no adjustment to the system class path (or installation of global library files in your server) will be necessary.

Much of this information was extracted from Chapter 9 of the Servlet API Specification, version 2.3, which you should consult for more details.


IRC : sim, é algo que ainda existe >> #p@p

Share this post


Link to post
Share on other sites
carcleo

HappyHippyHippo,

Tenho .java no projeto. Ok!

Mas não estou IDE's. Nem Eclipse, Nem NetBeans.

Nesse caso, quem compilará os .java em .class? E para qual pacote esses .class irão? Seria o Tomcat em tempo de execução quem compilaria os .java?

Estou usando notepad++ para adquirir mais conhecimento!

Edited by carcleo

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.