Supposé erreur de CLASSPATH

Fermé
nizar199 Messages postés 1 Date d'inscription vendredi 5 mai 2017 Statut Membre Dernière intervention 5 mai 2017 - 5 mai 2017 à 15:14
bonjour/bonsoir

voila ça fait déjà 2 semaines que je me retrouve avec ce problème
objectif du projet , une connexion a l'annuaire LDAP
-eclipse neon
-jre1.8
-jdk1.8
-apache tomcat 8.5

mon fichier index.xhtml

<?xml version="1.0" encoding="iso-8859-1"?>
<!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:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets" >
<h:head>

<title>Blue Freedom by minimalistic-design.net</title>
<meta http-equiv="Content-Language" content="English" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="style.css" media="screen" /></h:head>

<h:body>

<div id="wrap">

<div id="top" />

<div id="content">

<center><img src="images/1.jpg"></img></center>

<div class="header">
<h:form>
<center>
<h:outputLabel value="nom de l'utilisateur" />
<input type="text" />
<h:outputLabel value="Groupe" />
<h:selectOneMenu style="margin-top: 15px" >
<f:selectItem itemValue="1" itemLabel=" --" />
<f:selectItem itemValue="2" itemLabel="Commerce" />
<f:selectItem itemValue="3" itemLabel="Developpeurs" />
<f:selectItem itemValue="4" itemLabel="Direction" />
<f:selectItem itemValue="5" itemLabel="Gestionnaire Clients" />
<f:selectItem itemValue="6" itemLabel="Ingénieurs" />
<f:selectItem itemValue="7" itemLabel="Serveurs" />
<f:selectItem itemValue="8" itemLabel="Techniciens" />
</h:selectOneMenu>
<br></br>
<h:selectOneMenu style="margin-top: 15px" >
<f:selectItem itemValue="1" itemLabel=" --" />
<f:selectItem itemValue="2" itemLabel="Commerce" />
<f:selectItem itemValue="3" itemLabel="Developpeurs" />
<f:selectItem itemValue="4" itemLabel="Direction" />
<f:selectItem itemValue="5" itemLabel="Gestionnaire Clients" />
<f:selectItem itemValue="6" itemLabel="Ingénieurs" />
<f:selectItem itemValue="7" itemLabel="Serveurs" />
<f:selectItem itemValue="8" itemLabel="Techniciens" />
</h:selectOneMenu>
<br></br>
<h:selectOneMenu style="margin-top: 15px" >
<f:selectItem itemValue="1" itemLabel=" --" />
<f:selectItem itemValue="2" itemLabel="Commerce" />
<f:selectItem itemValue="3" itemLabel="Developpeurs" />
<f:selectItem itemValue="4" itemLabel="Direction" />
<f:selectItem itemValue="5" itemLabel="Gestionnaire Clients" />
<f:selectItem itemValue="6" itemLabel="Ingénieurs" />
<f:selectItem itemValue="7" itemLabel="Serveurs" />
<f:selectItem itemValue="8" itemLabel="Techniciens" />
</h:selectOneMenu>

<br></br>
<h:commandButton value="search" actionListener="#{manip_User_Ldap.connexion_search()}"/>
</center>

</h:form>
</div>

<div class="breadcrumbs"><center> Recherche d'utilisateur LDAP </center>
</div>





<div id="clear" />
</div>

<div id="bottom" />
</div>

<h:button></h:button>

</h:body></html>



mon fichier 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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>LDAP</groupId>
<artifactId>LDAP_connexion</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>LDAP_connexion Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>org.jasypt</groupId>
<artifactId>jasypt</artifactId>
<version>1.9.2</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.4-1200-jdbc41</version>
</dependency>
<dependency>
<groupId>javax.websocket</groupId>
<artifactId>javax.websocket-api</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<!-- CORE JARS -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.1.11</version>
</dependency>

<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.1.11</version>
</dependency>

<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>

<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.0</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>javax.el</groupId>
<artifactId>el-api</artifactId>
<version>2.2</version>
</dependency>

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

<dependency>
<!-- Only bundled with java 1.6+ -->
<groupId>javax.annotation</groupId>
<artifactId>jsr250-api</artifactId>
<version>1.0</version>
</dependency>
<!-- Image Maven Dependency -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.3.1</version>
</dependency>

</dependencies>
<build>
<finalName>LDAP_connexion</finalName>
</build>
</project>


le bean

package Model;




import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.naming.NamingException;

import ldapconnexion.*;

@ManagedBean (name="manip_User_Ldap")
@SessionScoped
public class Manip_User_Ldap {
private String nom;
private String groupe;
private String S_groupe;
private String SS_groupe;
public String getNom() {
return nom;
}
public void setNom(String nom) {
this.nom = nom;
}
public String getGroupe() {
return groupe;
}
public void setGroupe(String groupe) {
this.groupe = groupe;
}
public String getS_groupe() {
return S_groupe;
}
public void setS_groupe(String s_groupe) {
S_groupe = s_groupe;
}
public Manip_User_Ldap(String nom, String groupe, String s_groupe, String sS_groupe) {
super();
this.nom = nom;
this.groupe = groupe;
S_groupe = s_groupe;
SS_groupe = sS_groupe;
}
public Manip_User_Ldap() {
super();
// TODO Auto-generated constructor stub
}
public String getSS_groupe() {
return SS_groupe;
}
public void setSS_groupe(String sS_groupe) {
SS_groupe = sS_groupe;
}

public void connexion_search() {

connexionLDAP connexion = new connexionLDAP();
try {
connexion.connexion();
} catch (NamingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

}


et la classe connexion qui normalement exécuté avec java application la JVM marche tres bien mais une fois je lance ma page xhtml avec tomcat et que je clique sur le bouton qui a comme action bahh cette class j'ai une erreur


package ldapconnexion;

import java.security.Security;
import java.util.Hashtable;



import javax.naming.Context;
import javax.naming.NamingException;
import javax.naming.directory.Attributes;
import javax.naming.directory.DirContext;
import javax.naming.directory.InitialDirContext;




public class connexionLDAP {


public void connexion() throws NamingException{
{
String serverLogin = "CN=dev,CN=Users,DC=ud,DC=inf,DC=int,DC=adelius,DC=fr";
String serverPass = "Adelius123";

Hashtable<String, String> environnement = new Hashtable<String, String>();
environnement.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
environnement.put(Context.PROVIDER_URL, "ldaps://10.255.254.2:636/OU=Utilisateurs,OU=Developpeurs,OU=AMS,OU=Organisation,DC=ud,DC=inf,DC=int,DC=adelius,DC=fr");
environnement.put(Context.SECURITY_PROTOCOL,"SSL");

environnement.put(Context.SECURITY_AUTHENTICATION, "simple");
//environnement.put(Context.SECURITY_AUTHENTICATION, "none");
environnement.put(Context.SECURITY_PRINCIPAL, serverLogin);
environnement.put(Context.SECURITY_CREDENTIALS, serverPass);




Security.setProperty("ssl.SocketFactory.provider",LazySSLSocketFactory.class.getName());



DirContext contexte = new InitialDirContext(environnement);
Attributes attrs = contexte.getAttributes("CN=Michael Houzé");

System.out.println(attrs.get("name"));
System.out.println(attrs.get("displayName"));
System.out.println(attrs.get("sn"));





}
}

public connexionLDAP() {
super();
// TODO Auto-generated constructor stub
}
}




et voici l'exception quand je clique sur mon boutton


javax.naming.CommunicationException: 10.255.254.2:636 [Root exception is java.net.SocketException: java.lang.ClassNotFoundException: ldapconnexion.LazySSLSocketFactory]
at com.sun.jndi.ldap.Connection.<init>(Unknown Source)
at com.sun.jndi.ldap.LdapClient.<init>(Unknown Source)
at com.sun.jndi.ldap.LdapClient.getInstance(Unknown Source)
at com.sun.jndi.ldap.LdapCtx.connect(Unknown Source)
at com.sun.jndi.ldap.LdapCtx.<init>(Unknown Source)
at com.sun.jndi.ldap.LdapCtxFactory.getUsingURL(Unknown Source)
at com.sun.jndi.ldap.LdapCtxFactory.getUsingURLs(Unknown Source)
at com.sun.jndi.ldap.LdapCtxFactory.getLdapCtxInstance(Unknown Source)
at com.sun.jndi.ldap.LdapCtxFactory.getInitialContext(Unknown Source)
at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.init(Unknown Source)
at javax.naming.InitialContext.<init>(Unknown Source)
at javax.naming.directory.InitialDirContext.<init>(Unknown Source)
at ldapconnexion.connexionLDAP.connexion(connexionLDAP.java:42)
at Model.Manip_User_Ldap.connexion_search(Manip_User_Ldap.java:59)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.el.parser.AstValue.invoke(AstValue.java:247)
at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:267)
at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
at javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:147)
at javax.faces.event.ActionEvent.processListener(ActionEvent.java:88)
at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:818)
at javax.faces.component.UICommand.broadcast(UICommand.java:300)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:790)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1282)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:624)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:799)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:861)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1455)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
Caused by: java.net.SocketException: java.lang.ClassNotFoundException: ldapconnexion.LazySSLSocketFactory
at javax.net.ssl.DefaultSSLSocketFactory.throwException(Unknown Source)
at javax.net.ssl.DefaultSSLSocketFactory.createSocket(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.sun.jndi.ldap.Connection.createSocket(Unknown Source)
... 55 more
Caused by: java.lang.ClassNotFoundException: ldapconnexion.LazySSLSocketFactory
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at javax.net.ssl.SSLSocketFactory.getDefault(Unknown Source)
... 60 more