No suitable driver found for jdbc:oracle:thin:@localhost:1521/xe: javax.faces.FacesException

Olá galera, eu aqui de novo… Dessa vez preciso de uma ajuda referente a comunicação do Oracle com o Java… Pesquisei algumas soluções aqui no forum, como por exemplo colocar o Class.forName, porém sem sucesso. Lembrando que estou sincronizando Java com Maven, JBoss e Oracle.
Se alguem puder me ajudar, ficarei mto agradecido.
Abaixo segue o erro que aparece no log do JBoss, as classes do java e os .xml e .html

JBoss:

WARNING [javax.enterprise.resource.webcontainer.jsf.lifecycle] (http--127.0.0.1-8088-1) #{clientMB.guardarClient()}: java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@//localhost:1521/xe: javax.faces.FacesException: #{clientMB.guardarClient()}: java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@//localhost:1521/xe
        at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:118) [jsf-impl-2.1.7-jbossorg-2.jar:]
        at javax.faces.component.UICommand.broadcast(UICommand.java:315) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
        at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
        at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
        at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81) [jsf-impl-2.1.7-jbossorg-2.jar:]
        at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) [jsf-impl-2.1.7-jbossorg-2.jar:]
        at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) [jsf-impl-2.1.7-jbossorg-2.jar:]
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.13.Final.jar:]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.13.Final.jar:]
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.13.Final.jar:]
        at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.13.Final.jar:]
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.13.Final.jar:]
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.13.Final.jar:]
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.13.Final.jar:]
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.13.Final.jar:]
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.13.Final.jar:]
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.13.Final.jar:]
        at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_79]
Caused by: javax.faces.el.EvaluationException: java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@//localhost:1521/xe
        at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:102) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
        at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102) [jsf-impl-2.1.7-jbossorg-2.jar:]
        ... 20 more
Caused by: java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@//localhost:1521/xe
        at java.sql.DriverManager.getConnection(DriverManager.java:596) [rt.jar:1.7.0_79]
        at java.sql.DriverManager.getConnection(DriverManager.java:215) [rt.jar:1.7.0_79]
        at br.net.bcfsolutions.utils.Database.getConnection(Database.java:10) [classes:]
        at br.net.bcfsolutions.mb.ClientMB.guardarClient(ClientMB.java:35) [classes:]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_79]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_79]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_79]
        at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_79]
        at org.apache.el.parser.AstValue.invoke(AstValue.java:262) [jbossweb-7.0.13.Final.jar:]
        at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:278) [jbossweb-7.0.13.Final.jar:]
        at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105) [jsf-impl-2.1.7-jbossorg-2.jar:]
        at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
        ... 21 more

Pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" 
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>br.net.bcfsolutions</groupId>
	<artifactId>ProjetoWeb</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<packaging>war</packaging>
	<name>ProjetoWeb</name>

	<dependencies>
		<dependency>
			<groupId>com.sun.faces</groupId>
			<artifactId>jsf-api</artifactId>
			<version>2.2.2</version>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>com.sun.faces</groupId>
			<artifactId>jsf-impl</artifactId>
			<version>2.2.2</version>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>org.primefaces</groupId>
			<artifactId>primefaces</artifactId>
			<version>5.0</version>
		</dependency>

		<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-core</artifactId>
			<version>4.0.1.Final</version>
		</dependency>
	</dependencies>

	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.5.1</version>
				<configuration>
					<source>1.4</source>
					<target>1.4</target>
				</configuration>
			</plugin>
		</plugins>
	</build>
</project>

Web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app 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_3_0.xsd"
	version="3.0">
	<display-name>ProjetoWeb</display-name>

	<servlet>
		<servlet-name>Faces Servlet</servlet-name>
		<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
		<load-on-startup>1</load-on-startup>
	</servlet>
	<servlet-mapping>
		<servlet-name>Faces Servlet</servlet-name>
		<url-pattern>*.jsf</url-pattern>
	</servlet-mapping>
	<welcome-file-list>
		<welcome-file>index.xhtml</welcome-file>
	</welcome-file-list>
	<session-config>
		<session-timeout>30</session-timeout>
	</session-config>

</web-app>

index.html:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui">

<h:head>
	<title>Projeto teste</title>
</h:head>
<f:view>
	<h:body>
		<h1>Cadastro de Usuário</h1>
		<h:form>
			Nome:  <p:inputText id="inputNome" type="text" value="#{clientMB.nome}" />
			<br />
			Email: <p:inputText id="inputEmail" type="text" value="#{clientMB.email}" />
			<br />
			<br />
			<p:commandButton 
				action="#{clientMB.guardarClient()}"
				value="Criar usuário">
			</p:commandButton>
			<br />
			<br />
			Vesion 1.02.10
		</h:form>
	</h:body>
</f:view>
</html>

Database.java:

package br.net.bcfsolutions.utils;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class Database {
	
	public static Connection getConnection() throws SQLException {
		
		String url = "jdbc:oracle:thin:@//localhost:1521/xe";
		String login = "Admin";
		String pass = "123456";
		
		try{
			Class.forName("oracle.jdbc.driver.oracledrviver");
			return DriverManager.getConnection(url, login, pass);
		}catch(ClassNotFoundException e){
			throw new SQLException(e.getMessage());
		}
		/*
		   return DriverManager.getConnection("jdbc:oracle:thin:@//localhost:1521/xe", "Admin", "123456");
		 */
	}
}

ClientMB.java:

package br.net.bcfsolutions.mb;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;

import javax.faces.bean.ManagedBean;

import br.net.bcfsolutions.utils.Database;

@ManagedBean (name = "clientMB")
public class ClientMB{
	
	private String nome;
	private String email;
	
	public String getNome() {
		return nome;
	}

	public void setNome(String nome) {
		this.nome = nome;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	
	public void guardarClient() throws SQLException{
		Connection conn = Database.getConnection();
		Statement st = conn.createStatement();
		
		boolean resultado = st.execute("insert into USUARIOS (id, nome, email) "
				                     + "values ((select max(ID) id from USUARIOS)+1,'" + this.getNome() + "','" + this.getEmail() + "')");
		if(resultado == false){
			System.out.println("Usuário inserido com sucesso!!!");
		} else {
			System.out.println("Usuário inválido!!!");
		}

		st.close();
		conn.close();
	}
}

Subindo o topico… UP

E a dependência do oracle ?

Voce diz sobre o ojdbc6?

Eu ja adicionei ele a pasta WEB-INF… porém ainda não funciona…

Mas se vc usa maven, porque tá deixando lá ?
No site da oracle têm instruções de como usar.
E escrevendo oracle dr viver fica difícil a classe ser instanciada, no próprio site eles fornecem outra forma de se fazer isso
https://docs.oracle.com/cd/E11882_01/appdev.112/e13995/oracle/jdbc/OracleDriver.html
Olha o nome da classe e olha como vc escreveu

Então… Eu estava seguindo um tutorial, por isso deixei como esta atualmente… Não sei dizer oque acontece de errado para que ele não funcione.

Quando rodo o programa, no JBoss aparece as mensagens abaixo…

Um detalhe é que esta aparecendo 2 Warning…

Classpath Dependency Validator Message
Classpath entry /ProjetoWeb/src/main/webapp/WEB-INF/ojdbc6.jar will not be exported or published. ClassNotFoundExceptions may result.

Java Build Path Problems
Build path specifies execution environment JavaSE-1.7. There are no JREs intalled in the workspacee that are strictly compatible with this environment.

Detalhe… Eu tenho instalado o Java SE Development Kit 7 (64-bits) e o Java SE Develo… 8 (64-bits)

Erro JBoss

11:53:32,102 ERROR [stderr] (http--127.0.0.1-8088-1) java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@//localhost:1521/xe
11:53:32,106 ERROR [stderr] (http--127.0.0.1-8088-1)    at java.sql.DriverManager.getConnection(DriverManager.java:596)
11:53:32,107 ERROR [stderr] (http--127.0.0.1-8088-1)    at java.sql.DriverManager.getConnection(DriverManager.java:215)
11:53:32,108 ERROR [stderr] (http--127.0.0.1-8088-1)    at br.net.bcfsolutions.utils.Database.getConnection(Database.java:13)
11:53:32,109 ERROR [stderr] (http--127.0.0.1-8088-1)    at br.net.bcfsolutions.mb.ClientMB.guardarClient(ClientMB.java:38)
11:53:32,110 ERROR [stderr] (http--127.0.0.1-8088-1)    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
11:53:32,111 ERROR [stderr] (http--127.0.0.1-8088-1)    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
11:53:32,113 ERROR [stderr] (http--127.0.0.1-8088-1)    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
11:53:32,114 ERROR [stderr] (http--127.0.0.1-8088-1)    at java.lang.reflect.Method.invoke(Method.java:606)
11:53:32,116 ERROR [stderr] (http--127.0.0.1-8088-1)    at org.apache.el.parser.AstValue.invoke(AstValue.java:262)
11:53:32,117 ERROR [stderr] (http--127.0.0.1-8088-1)    at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:278)
11:53:32,119 ERROR [stderr] (http--127.0.0.1-8088-1)    at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
11:53:32,121 ERROR [stderr] (http--127.0.0.1-8088-1)    at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
11:53:32,123 ERROR [stderr] (http--127.0.0.1-8088-1)    at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
11:53:32,124 ERROR [stderr] (http--127.0.0.1-8088-1)    at javax.faces.component.UICommand.broadcast(UICommand.java:315)
11:53:32,126 ERROR [stderr] (http--127.0.0.1-8088-1)    at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)
11:53:32,129 ERROR [stderr] (http--127.0.0.1-8088-1)    at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259)
11:53:32,130 ERROR [stderr] (http--127.0.0.1-8088-1)    at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
11:53:32,131 ERROR [stderr] (http--127.0.0.1-8088-1)    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
11:53:32,132 ERROR [stderr] (http--127.0.0.1-8088-1)    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
11:53:32,133 ERROR [stderr] (http--127.0.0.1-8088-1)    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
11:53:32,134 ERROR [stderr] (http--127.0.0.1-8088-1)    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
11:53:32,135 ERROR [stderr] (http--127.0.0.1-8088-1)    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
11:53:32,138 ERROR [stderr] (http--127.0.0.1-8088-1)    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
11:53:32,139 ERROR [stderr] (http--127.0.0.1-8088-1)    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
11:53:32,140 ERROR [stderr] (http--127.0.0.1-8088-1)    at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)
11:53:32,141 ERROR [stderr] (http--127.0.0.1-8088-1)    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
11:53:32,142 ERROR [stderr] (http--127.0.0.1-8088-1)    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
11:53:32,145 ERROR [stderr] (http--127.0.0.1-8088-1)    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
11:53:32,148 ERROR [stderr] (http--127.0.0.1-8088-1)    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)
11:53:32,149 ERROR [stderr] (http--127.0.0.1-8088-1)    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
11:53:32,150 ERROR [stderr] (http--127.0.0.1-8088-1)    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671)
11:53:32,151 ERROR [stderr] (http--127.0.0.1-8088-1)    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)
11:53:32,152 ERROR [stderr] (http--127.0.0.1-8088-1)    at java.lang.Thread.run(Thread.java:745)

Subindo… rss up

Novamente, compare:
O teu: jdbc:oracle:thin:@//localhost:1521/xe
O certo: jdbc:oracle:thin:@localhost:1521/xe
O que está diferente?

Obrigado por me responder… Essa alteração eu já fiz, porém não deu certo… Vou postar aqui algumas partes que atualizei no código (desde a primeira postagem até hoje eu alterei algumas coisas para ver se funcionava)…

E, como pode ver no Database.java (abaixo), tem o endereço indicado por você. Porém, ainda assim continua dando um erro no log do JBoss (também abaixo) e aparece 2 Warning no Projeto.

os Warning são:

1- Classpath Dependency Validator Message
Classpath entry /ProjetoWeb/src/main/webapp/WEB-INF/ojdbc6.jar will not be exported or published. Runtime ClassNotFoundExceptions may result.

2- Java Build Path Problems
Build path specifies execution environment JavaSE-1.7. There are no JREs installed in the workspace that are strictly compatible with this environment

Outra observação é que tenho instalado na máquina o Java SE Kit 7 e 8, ambos 64 bits

JBoss

17:18:03,860 ERROR [stderr] (http--127.0.0.1-8088-1) java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@localhost:1521/XE
17:18:03,862 ERROR [stderr] (http--127.0.0.1-8088-1)    at java.sql.DriverManager.getConnection(DriverManager.java:596)
17:18:03,863 ERROR [stderr] (http--127.0.0.1-8088-1)    at java.sql.DriverManager.getConnection(DriverManager.java:215)
17:18:03,864 ERROR [stderr] (http--127.0.0.1-8088-1)    at br.net.bcfsolutions.utils.Database.getConnection(Database.java:12)
17:18:03,865 ERROR [stderr] (http--127.0.0.1-8088-1)    at br.net.bcfsolutions.mb.ClientMB.guardarClient(ClientMB.java:38)
17:18:03,866 ERROR [stderr] (http--127.0.0.1-8088-1)    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
17:18:03,867 ERROR [stderr] (http--127.0.0.1-8088-1)    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
17:18:03,868 ERROR [stderr] (http--127.0.0.1-8088-1)    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
17:18:03,873 ERROR [stderr] (http--127.0.0.1-8088-1)    at java.lang.reflect.Method.invoke(Method.java:606)
17:18:03,873 ERROR [stderr] (http--127.0.0.1-8088-1)    at org.apache.el.parser.AstValue.invoke(AstValue.java:262)
17:18:03,874 ERROR [stderr] (http--127.0.0.1-8088-1)    at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:278)
17:18:03,875 ERROR [stderr] (http--127.0.0.1-8088-1)    at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
17:18:03,876 ERROR [stderr] (http--127.0.0.1-8088-1)    at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
17:18:03,877 ERROR [stderr] (http--127.0.0.1-8088-1)    at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
17:18:03,878 ERROR [stderr] (http--127.0.0.1-8088-1)    at javax.faces.component.UICommand.broadcast(UICommand.java:315)
17:18:03,879 ERROR [stderr] (http--127.0.0.1-8088-1)    at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)
17:18:03,879 ERROR [stderr] (http--127.0.0.1-8088-1)    at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259)
17:18:03,882 ERROR [stderr] (http--127.0.0.1-8088-1)    at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
17:18:03,883 ERROR [stderr] (http--127.0.0.1-8088-1)    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
17:18:03,884 ERROR [stderr] (http--127.0.0.1-8088-1)    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
17:18:03,885 ERROR [stderr] (http--127.0.0.1-8088-1)    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
17:18:03,887 ERROR [stderr] (http--127.0.0.1-8088-1)    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
17:18:03,888 ERROR [stderr] (http--127.0.0.1-8088-1)    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
17:18:03,889 ERROR [stderr] (http--127.0.0.1-8088-1)    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
17:18:03,891 ERROR [stderr] (http--127.0.0.1-8088-1)    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
17:18:03,893 ERROR [stderr] (http--127.0.0.1-8088-1)    at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)
17:18:03,894 ERROR [stderr] (http--127.0.0.1-8088-1)    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
17:18:03,895 ERROR [stderr] (http--127.0.0.1-8088-1)    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
17:18:03,896 ERROR [stderr] (http--127.0.0.1-8088-1)    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
17:18:03,897 ERROR [stderr] (http--127.0.0.1-8088-1)    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)
17:18:03,898 ERROR [stderr] (http--127.0.0.1-8088-1)    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
17:18:03,899 ERROR [stderr] (http--127.0.0.1-8088-1)    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671)
17:18:03,900 ERROR [stderr] (http--127.0.0.1-8088-1)    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)
17:18:03,904 ERROR [stderr] (http--127.0.0.1-8088-1)    at java.lang.Thread.run(Thread.java:745)

Pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" 
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>br.net.bcfsolutions</groupId>
	<artifactId>ProjetoWeb</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<packaging>war</packaging>
	<name>ProjetoWeb</name>

	<dependencies>
		<dependency>
			<groupId>com.sun.faces</groupId>
			<artifactId>jsf-api</artifactId>
			<version>2.2.2</version>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>com.sun.faces</groupId>
			<artifactId>jsf-impl</artifactId>
			<version>2.2.2</version>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>org.primefaces</groupId>
			<artifactId>primefaces</artifactId>
			<version>5.0</version>
		</dependency>

		<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-core</artifactId>
			<version>4.0.1.Final</version>
		</dependency>
	</dependencies>

	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.5.1</version>
				<configuration>
					<source>1.7</source>
					<target>1.7</target>
				</configuration>
			</plugin>
		</plugins>
	</build>
</project>

Web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app 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_3_0.xsd"
	version="3.0">
	<display-name>ProjetoWeb</display-name>

	<servlet>
		<servlet-name>Faces Servlet</servlet-name>
		<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
		<load-on-startup>1</load-on-startup>
	</servlet>
	<servlet-mapping>
		<servlet-name>Faces Servlet</servlet-name>
		<url-pattern>*.jsf</url-pattern>
	</servlet-mapping>
	<welcome-file-list>
		<welcome-file>index.xhtml</welcome-file>
	</welcome-file-list>
	<session-config>
		<session-timeout>30</session-timeout>
	</session-config>

</web-app>

index.xml

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui">

<h:head>
	<title>Projeto teste</title>
</h:head>
<f:view>
	<h:body>
		<h1>Cadastro de Usuário</h1>
		<h:form>
			Nome:  <p:inputText id="inputNome" type="text" value="#{clientMB.name}" size="50"/>
			<br />
			Email: <p:inputText id="inputEmail" type="text" value="#{clientMB.email}" size="50" />
			<br />
			<br /> 
			<p:commandButton 
				action="#{clientMB.guardarClient()}"
				value="Criar usuário">
			</p:commandButton>
			<br />
			<br />
			Vesion 1.02.16
		</h:form>
	</h:body>
</f:view>
</html>

Database.java

package br.net.bcfsolutions.utils;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class Database {

	public static Connection getConnection() throws SQLException {
		return DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521/XE", "BCF", "bcf4ever");
	}

}

ClientMB.java

package br.net.bcfsolutions.mb;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

import javax.faces.bean.ManagedBean;

import br.net.bcfsolutions.utils.Database;

@ManagedBean (name = "clientMB")
public class ClientMB{
	
	private String name;
	private String email;
	
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	
	public void guardarClient() throws SQLException{
		
		try{
			Connection conn = Database.getConnection();
			Statement st = conn.createStatement();
			
			ResultSet rs = st.executeQuery("insert into USUARIOS (id, nome, email) "
			                             + "values ((select max(ID) id from USUARIOS)+1,'" + this.getName() + "','" + this.getEmail() + "')");
			
			rs.close();
			st.close();
			conn.close();
			
		} catch(Exception ex){
			ex.printStackTrace();	
		}
		
	}

}

E cadê o driver do oracle no pom.xml?

Desculpa minha ignorância. Mas eu estou começando ainda nessa área de programar…

Eu procurei na internet sobre o driver do Oracle para o pom.xml… Eu achei esse abaixo:

       <dependency>
		<groupId>com.oracle.jdbc</groupId>
		<artifactId>ojdbc6</artifactId>
		<version>11.2.0</version>
	</dependency>

Junto com o mesmo, estava dizendo para executar o seguinte comando na pasta onde se encontra o pom.xml…

E:\WORK\EclipseL_Work\ro>mvn install:install-file -Dfile=C:\Users\xxxx\Downloads\lib\ojdbc6.jar -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0 -Dpackaging=jar

e assim fiz de acordo com o tutorial… Adicionei o driver após o comando dar sucesso… Porém ele aparece dois errors…

XML Problem
1-
cvc-complex-type.2.4.a: Invalid content was found starting with element ‘dependency’. One of ‘{“http://maven.apache.org/POM/4.0.0”:parent, “http://maven.apache.org/POM/4.0.0”:description, “http://maven.apache.org/POM/4.0.0”:url, “http://maven.apache.org/POM/4.0.0”:prerequisites, “http://maven.apache.org/POM/4.0.0”:issueManagement, “http://maven.apache.org/POM/4.0.0”:ciManagement, “http://maven.apache.org/POM/4.0.0”:inceptionYear, “http://maven.apache.org/POM/4.0.0”:mailingLists, “http://maven.apache.org/POM/4.0.0”:developers, “http://maven.apache.org/POM/4.0.0”:contributors, “http://maven.apache.org/POM/4.0.0”:licenses, “http://maven.apache.org/POM/4.0.0”:scm, “http://maven.apache.org/POM/4.0.0”:organization, “http://maven.apache.org/POM/4.0.0”:build, “http://maven.apache.org/POM/4.0.0”:profiles, “http://maven.apache.org/POM/4.0.0”:modules, “http://maven.apache.org/POM/4.0.0”:repositories, “http://maven.apache.org/POM/4.0.0”:pluginRepositories, “http://maven.apache.org/POM/4.0.0”:reports, “http://maven.apache.org/POM/4.0.0”:reporting, “http://maven.apache.org/POM/4.0.0”:dependencyManagement, “http://maven.apache.org/POM/4.0.0”:distributionManagement, “http://maven.apache.org/POM/4.0.0”:properties}’ is expected. pom.xml /ProjetoWeb line 38 XML Problem

2-
cvc-complex-type.2.3: Element ‘project’ cannot have character [children], because the type’s content type is element-only.

Log do comando executado para instalar o Driver

G:\Desenvolvimento BCF\Eclipse\Teste\ProjetoWeb>mvn install:install-file -Dfile="C:\Program Files\Oracle\ojdbc6.jar" -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0 -Dpackaging=jar
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building ProjetoWeb 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-install-plugin:2.4:install-file (default-cli) @ ProjetoWeb ---
[INFO] Installing C:\Program Files\Oracle\ojdbc6.jar to C:\Users\BCF-NTBK-HP01\.m2\repository\com\oracle\ojdbc6\11.2.0\ojdbc6-11.2.0.jar
[INFO] Installing C:\Users\BCF-NT~1\AppData\Local\Temp\mvninstall8563514022934257763.pom to C:\Users\BCF-NTBK-HP01\.m2\repository\com\oracle\ojdbc6\11.2.0\ojdbc6-11.2.0.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.719 s
[INFO] Finished at: 2016-10-07T09:50:37-03:00
[INFO] Final Memory: 7M/154M
[INFO] ------------------------------------------------------------------------

Posta teu pom novamente, há algo de errado nele.

POM

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>br.net.bcfsolutions</groupId>
	<artifactId>ProjetoWeb</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<packaging>war</packaging>
	<name>ProjetoWeb</name>

	<dependencies>
		<dependency>
			<groupId>com.sun.faces</groupId>
			<artifactId>jsf-api</artifactId>
			<version>2.2.2</version>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>com.sun.faces</groupId>
			<artifactId>jsf-impl</artifactId>
			<version>2.2.2</version>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>org.primefaces</groupId>
			<artifactId>primefaces</artifactId>
			<version>5.0</version>
		</dependency>

		<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-core</artifactId>
			<version>4.0.1.Final</version>
		</dependency>
	</dependencies>

	<dependency>
		<groupId>com.oracle</groupId>
		<artifactId>ojdbc6</artifactId>
		<version>11.2.0</version>
	</dependency>
	
	<repositories>
		<repository>
			<id>codelds</id>
			<url>https://code.lds.org/nexus/content/groups/main-repo</url>
		</repository>
	</repositories>

	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.5.1</version>
				<configuration>
					<source>1.7</source>
					<target>1.7</target>
				</configuration>
			</plugin>
		</plugins>
	</build>
</project>

Desculpa… eu mesmo postando vi que tinha colocado no lugar errado… Arrumei agora…

Porém ainda da erro, mas na linha do “xsi:schemaLocation” (segunda linha)

O erro é:

cvc-complex-type.2.3: Element ‘project’ cannot have character [children], because the type’s content type is element-only. pom.xml

Pom

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>br.net.bcfsolutions</groupId>
	<artifactId>ProjetoWeb</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<packaging>war</packaging>
	<name>ProjetoWeb</name>

	<dependencies>
		<dependency>
			<groupId>com.sun.faces</groupId>
			<artifactId>jsf-api</artifactId>
			<version>2.2.2</version>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>com.sun.faces</groupId>
			<artifactId>jsf-impl</artifactId>
			<version>2.2.2</version>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>org.primefaces</groupId>
			<artifactId>primefaces</artifactId>
			<version>5.0</version>
		</dependency>

		<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-core</artifactId>
			<version>4.0.1.Final</version>
		</dependency>


		<dependency>
			<groupId>com.oracle</groupId>
			<artifactId>ojdbc6</artifactId>
			<version>11.2.0</version>
		</dependency>
	</dependencies>

	
	<repositories>
		<repository>
			<id>codelds</id>
			<url>https://code.lds.org/nexus/content/groups/main-repo</url>
		</repository>
	</repositories>

	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.5.1</version>
				<configuration>
					<source>1.7</source>
					<target>1.7</target>
				</configuration>
			</plugin>
		</plugins>
	</build>
</project>

Como eu imaginei, existe algo errado no pom.xml

Estudar um pouco faz muito bem, seria ótimo dar uma boa lida em tutoriais sobre maven. Posso adiantar que toda e qualquer dependênca (definida pela tag <dependency> deve ficar dentro da tag <dependencies>. Note que a dependência do ojdbc está fora. É o que ocasiona o teu problema atual

Sim sim, foi falta de atenção mesmo… no post seguinte eu corrigi isso…

Isso acho que pode te ajudar http://www.guj.com.br/t/java-sql-sqlexception-no-suitable-driver-found-for-jdbc-mysql-localhost-fj21-resolvido/191736/5

E o problema persiste?

Da erro, mas na linha do “xsi:schemaLocation” (segunda linha)

O erro é:

cvc-complex-type.2.3: Element ‘project’ cannot have character [children], because the type’s content type is element-only. pom.xml

Pom

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>br.net.bcfsolutions</groupId>
	<artifactId>ProjetoWeb</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<packaging>war</packaging>
	<name>ProjetoWeb</name>
    <dependencies>
	<dependency>
		<groupId>com.sun.faces</groupId>
		<artifactId>jsf-api</artifactId>
		<version>2.2.2</version>
		<scope>provided</scope>
	</dependency>

	<dependency>
		<groupId>com.sun.faces</groupId>
		<artifactId>jsf-impl</artifactId>
		<version>2.2.2</version>
		<scope>provided</scope>
	</dependency>

	<dependency>
		<groupId>org.primefaces</groupId>
		<artifactId>primefaces</artifactId>
		<version>5.0</version>
	</dependency>

	<dependency>
		<groupId>org.hibernate</groupId>
		<artifactId>hibernate-core</artifactId>
		<version>4.0.1.Final</version>
	</dependency>


	<dependency>
		<groupId>com.oracle</groupId>
		<artifactId>ojdbc6</artifactId>
		<version>11.2.0</version>
	</dependency>
</dependencies>


<repositories>
	<repository>
		<id>codelds</id>
		<url>https://code.lds.org/nexus/content/groups/main-repo</url>
	</repository>
</repositories>

<build>
	<plugins>
		<plugin>
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-compiler-plugin</artifactId>
			<version>3.5.1</version>
			<configuration>
				<source>1.7</source>
				<target>1.7</target>
			</configuration>
		</plugin>
	</plugins>
</build>
</project>

Troque isto <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
por isto
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
E veja se ocorre o mesmo erro