Salve Salve!
Estou com problemas ao me conectar ao meu banco de dados MySQL. Pretendo usar o Realm para fazer a autenticação.
Estou usando o NetBeans e estou recebendo o seguinte erro:
Distribuição incremental do http://localhost:8084/MegaByte completada
Reimplantando http://localhost:8084/MegaByte incrementalmente
Deploy em andamento…
deploy?config=file:/C:/Users/Jean/AppData/Local/Temp/context48462.xml&path=/MegaByte
FAIL - Failed to deploy application at context path /MegaByte
Segue abaixo as minhas XML, Alguém poderia me ajudar nesse problemão? Já li e re-li mas não encontrei nenhum erro.
context.xml:
<?xml version="1.0" encoding="UTF-8"?>
<Context path="/MegaByte">
<Resource auth="Container" driverClassName="sun.jdbc.odbc.JdbcOdbcDriver" maxActive="100" maxIdle="30" maxWait="10000" name="MegaByte/DB" password="root" type="javax.sql.DataSource" url="jdbc:mysql://localhost/megabyte" username="root"/>
<Realm
className="org.apache.catalina.realm.JDBCRealm"
driverName="sun.jdbc.odbc.JdbcOdbcDriver"
connectionURL="jdbc:mysql://localhost/megabyte"
userNameCol="login"
userCredCol="senha"
roleNameCol="role"
userTable="usuario"
userRoleTable="usuario"
/>
</Context>
web.xml :
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<!-- Welcome file list -->
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<!-- Configuração da sessão -->
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<!-- Banco de Dados -->
<resource-ref>
<description>DB Connection</description>
<res-ref-name>MegaByte/DB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<!-- Servlets -->
<servlet>
<servlet-name>usuarioCtrl</servlet-name>
<servlet-class>servlets.ServletUsuario</servlet-class>
</servlet>
<!-- Mapeamento das Servlets -->
<servlet-mapping>
<servlet-name>usuarioCtrl</servlet-name>
<url-pattern>/admin/usuarioCtrl.do</url-pattern>
</servlet-mapping>
<!-- Configs. Realm -->
<security-constraint>
<web-resource-collection>
<web-resource-name>Administrador</web-resource-name>
<url-pattern>/admin/index.jsp</url-pattern>
<url-pattern>/admin/login.jsp</url-pattern>
<url-pattern>/admin/logininvalido.jsp</url-pattern>
<url-pattern>/admin/erro403.jsp</url-pattern>
<url-pattern>/admin/listUsuarios.jsp</url-pattern>
<url-pattern>/admin/listProdutos.jsp</url-pattern>
<url-pattern>/admin/mensagem.jsp</url-pattern>
<url-pattern>/admin/novoProduto.jsp</url-pattern>
<url-pattern>/admin/novoUsuario.jsp</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>1</role-name>
</auth-constraint>
</security-constraint>
<!-- Role -->
<security-role>
<role-name>1</role-name>
</security-role>
<!-- Configs. Login -->
<login-config>
<auth-method>FORM</auth-method>
<form-login-config>
<form-login-page>/admin/login.jsp</form-login-page>
<form-error-page>/admin/logininvalido.jsp</form-error-page>
</form-login-config>
</login-config>
<!-- Páginas de Erro -->
<error-page>
<error-code>403</error-code>
<location>/admin/erro403.jsp</location>
</error-page>
</web-app>
Obrigado!