Page 2 of 3

Re:Usuario system

PostPosted:Thu Sep 10, 2009 7:01 pm
by raquel
Buenas tardes,

Perdon por la pregunta sin antes indagar más.. estuve buscando y lei que a partir de la versión 3.0 se cambio el nombre de usuario a admin. Cree el usuario en el Ldap y ya se conecta perfectamente...

Gracias...

Re:Usuario system

PostPosted:Mon Sep 14, 2009 6:28 pm
by jllort
Si, pero en la version community este cambio aun no lo tenemos propagado, en la nueva version se llama okmAdmin el usuario administrador, a nosotros esto tambien nos genera confusiones a veces cuando respondemos en los foros. ESpero que saquemos esta versión pronto que ya le tenemos ganas y en realidad ya esta terminada.

Montar el entorno de desarrollo

PostPosted:Wed Sep 16, 2009 9:10 pm
by raquel
Buenas tardes..

Estoy montando el entorno de desarrollo del openkm. He seguido los pasos colocados en la documentación. Pero cuando llego al punto de ejecutar el servidor jboss me da un error y no inicializa correctamente el mismo. Que debo hacer?? o a que se debe ?

Este es el error que me da:
Code: Select all
16:53:35,942 INFO  [Server] Starting JBoss (MX MicroKernel)...
16:53:35,944 INFO  [Server] Release ID: JBoss [Trinity] 4.2.2.GA (build: SVNTag=JBoss_4_2_2_GA date=200710221139)
16:53:35,945 INFO  [Server] Home Dir: /usr/local/jboss-4.2.2.GA
16:53:35,945 INFO  [Server] Home URL: file:/usr/local/jboss-4.2.2.GA/
16:53:35,946 INFO  [Server] Patch URL: null
16:53:35,946 INFO  [Server] Server Name: default
16:53:35,946 INFO  [Server] Server Home Dir: /usr/local/jboss-4.2.2.GA/server/default
16:53:35,947 INFO  [Server] Server Home URL: file:/usr/local/jboss-4.2.2.GA/server/default/
16:53:35,947 INFO  [Server] Server Log Dir: /usr/local/jboss-4.2.2.GA/server/default/log
16:53:35,948 INFO  [Server] Server Temp Dir: /usr/local/jboss-4.2.2.GA/server/default/tmp
16:53:35,948 INFO  [Server] Root Deployment Filename: jboss-service.xml
16:53:36,570 INFO  [ServerInfo] Java version: 1.5.0_18,Sun Microsystems Inc.
16:53:36,571 INFO  [ServerInfo] Java VM: Java HotSpot(TM) Client VM 1.5.0_18-b02,Sun Microsystems Inc.
16:53:36,571 INFO  [ServerInfo] OS-System: Linux 2.6.28-15-generic,i386
16:53:37,218 INFO  [Server] Core system initialized
16:53:43,452 INFO  [WebService] Using RMI server codebase: http://localhost:8083/
16:53:43,455 INFO  [Log4jService$URLWatchTimerTask] Configuring from URL: resource:jboss-log4j.xml
16:53:44,140 INFO  [TransactionManagerService] JBossTS Transaction Service (JTA version) - JBoss Inc.
16:53:44,141 INFO  [TransactionManagerService] Setting up property manager MBean and JMX layer
16:53:44,382 INFO  [TransactionManagerService] Starting recovery manager
16:53:44,503 INFO  [TransactionManagerService] Recovery manager started
16:53:44,504 INFO  [TransactionManagerService] Binding TransactionManager JNDI Reference
16:53:49,658 INFO  [EJB3Deployer] Starting java:comp multiplexer
16:53:50,123 INFO  [STDOUT] no object for null
16:53:50,126 INFO  [STDOUT] no object for null
16:53:50,184 INFO  [STDOUT] no object for null
16:53:50,219 INFO  [STDOUT] no object for {urn:jboss:bean-deployer}supplyType
16:53:50,246 INFO  [STDOUT] no object for {urn:jboss:bean-deployer}dependsType
16:53:53,324 INFO  [NativeServerConfig] JBoss Web Services - Native
16:53:53,324 INFO  [NativeServerConfig] jbossws-native-2.0.1.SP2 (build=200710210837)
16:53:55,363 INFO  [Embedded] Catalina naming disabled
16:53:55,632 INFO  [AprLifecycleListener] The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/lib/jvm/java-1.5.0-sun-1.5.0.18/jre/lib/i386/client:/usr/lib/jvm/java-1.5.0-sun-1.5.0.18/jre/lib/i386:/usr/lib/jvm/java-1.5.0-sun-1.5.0.18/jre/../lib/i386:/usr/lib/jvm/java-1.5.0-sun-1.5.0.18/jre/lib/i386/client::/usr/lib/jvm/java-1.5.0-sun-1.5.0.18/jre/lib/i386::/usr/lib/xulrunner-addons:/usr/lib/xulrunner-addons
16:53:55,793 INFO  [Http11Protocol] Inicializando Coyote HTTP/1.1 en puerto http-localhost%2F127.0.0.1-8080
16:53:55,794 INFO  [AjpProtocol] Initializing Coyote AJP/1.3 on ajp-localhost%2F127.0.0.1-8009
16:53:55,794 INFO  [Catalina] Initialization processed in 431 ms
16:53:55,795 INFO  [StandardService] Arrancando servicio jboss.web
16:53:55,797 INFO  [StandardEngine] Starting Servlet Engine: JBossWeb/2.0.1.GA
16:53:55,877 INFO  [Catalina] Server startup in 82 ms
16:53:56,196 INFO  [TomcatDeployer] deploy, ctxPath=/, warUrl=.../deploy/jboss-web.deployer/ROOT.war/
16:53:57,376 INFO  [TomcatDeployer] deploy, ctxPath=/invoker, warUrl=.../deploy/http-invoker.sar/invoker.war/
16:53:57,721 INFO  [TomcatDeployer] deploy, ctxPath=/jbossws, warUrl=.../deploy/jbossws.sar/jbossws-context.war/
16:53:57,985 INFO  [TomcatDeployer] deploy, ctxPath=/jbossmq-httpil, warUrl=.../deploy/jms/jbossmq-httpil.sar/jbossmq-httpil.war/
16:53:58,987 INFO  [TomcatDeployer] deploy, ctxPath=/web-console, warUrl=.../deploy/management/console-mgr.sar/web-console.war/
16:53:59,697 INFO  [MailService] Mail Service bound to java:/mail/OpenKM
16:54:00,215 INFO  [RARDeployment] Required license terms exist, view META-INF/ra.xml in .../deploy/jboss-ha-local-jdbc.rar
16:54:00,255 INFO  [RARDeployment] Required license terms exist, view META-INF/ra.xml in .../deploy/jboss-ha-xa-jdbc.rar
16:54:00,283 INFO  [RARDeployment] Required license terms exist, view META-INF/ra.xml in .../deploy/jboss-local-jdbc.rar
16:54:00,315 INFO  [RARDeployment] Required license terms exist, view META-INF/ra.xml in .../deploy/jboss-xa-jdbc.rar
16:54:00,385 INFO  [RARDeployment] Required license terms exist, view META-INF/ra.xml in .../deploy/jms/jms-ra.rar
16:54:00,419 INFO  [RARDeployment] Required license terms exist, view META-INF/ra.xml in .../deploy/mail-ra.rar
16:54:00,478 INFO  [RARDeployment] Required license terms exist, view META-INF/ra.xml in .../deploy/quartz-ra.rar
16:54:00,489 INFO  [QuartzResourceAdapter] start quartz!!!
16:54:00,584 INFO  [SimpleThreadPool] Job execution threads will use class loader of thread: main
16:54:00,621 INFO  [QuartzScheduler] Quartz Scheduler v.1.5.2 created.
16:54:00,651 INFO  [RAMJobStore] RAMJobStore initialized.
16:54:00,653 INFO  [StdSchedulerFactory] Quartz scheduler \'DefaultQuartzScheduler\' initialized from default resource file in Quartz package: \'quartz.properties\'
16:54:00,654 INFO  [StdSchedulerFactory] Quartz scheduler version: 1.5.2
16:54:00,654 INFO  [QuartzScheduler] Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED started.
16:54:01,975 INFO  [ConnectionFactoryBindingService] Bound ConnectionManager \'jboss.jca:service=DataSourceBinding,name=DefaultDS\' to JNDI name \'java:DefaultDS\'
16:54:02,399 INFO  [A] Bound to JNDI name: queue/A
16:54:02,402 INFO  [B] Bound to JNDI name: queue/B
16:54:02,404 INFO  [C] Bound to JNDI name: queue/C
16:54:02,405 INFO  [D] Bound to JNDI name: queue/D
16:54:02,406 INFO  [ex] Bound to JNDI name: queue/ex
16:54:02,432 INFO  [testTopic] Bound to JNDI name: topic/testTopic
16:54:02,434 INFO  [securedTopic] Bound to JNDI name: topic/securedTopic
16:54:02,436 INFO  [testDurableTopic] Bound to JNDI name: topic/testDurableTopic
16:54:02,439 INFO  [testQueue] Bound to JNDI name: queue/testQueue
16:54:02,481 INFO  [UILServerILService] JBossMQ UIL service available at : localhost/127.0.0.1:8093
16:54:02,542 INFO  [DLQ] Bound to JNDI name: queue/DLQ
16:54:02,708 INFO  [ConnectionFactoryBindingService] Bound ConnectionManager \'jboss.jca:service=ConnectionFactoryBinding,name=JmsXA\' to JNDI name \'java:JmsXA\'
16:54:03,046 INFO  [ConnectionFactoryBindingService] Bound ConnectionManager \'jboss.jca:service=DataSourceBinding,name=OKMActivityDS\' to JNDI name \'java:OKMActivityDS\'
16:54:03,075 INFO  [ConnectionFactoryBindingService] Bound ConnectionManager \'jboss.jca:service=DataSourceBinding,name=OKMAuthDS\' to JNDI name \'java:OKMAuthDS\'
16:54:03,103 INFO  [ConnectionFactoryBindingService] Bound ConnectionManager \'jboss.jca:service=DataSourceBinding,name=OKMDashboardStatsDS\' to JNDI name \'java:OKMDashboardStatsDS\'
16:54:03,175 INFO  [TomcatDeployer] deploy, ctxPath=/jmx-console, warUrl=.../deploy/jmx-console.war/
16:54:06,787 INFO  [EARDeployer] Init J2EE application: file:/usr/local/jboss-4.2.2.GA/server/default/deploy/OpenKM.ear
16:54:35,641 WARN  [verifier] EJB spec violation: 
Bean   : AuthModule
Section: 22.2
Warning: The Bean Provider must specify the fully-qualified name of the Java class that implements the enterprise bean\'s business methods in the <ejb-class> element.
Info   : Class not found on \'es.git.openkm.ejb.AuthModule.AuthModuleBean\': Unexpected error during load of: es.git.openkm.ejb.AuthModule.AuthModuleBean, msg=Bad version number in .class file

16:54:35,642 ERROR [MainDeployer] Could not create deployment: file:/usr/local/jboss-4.2.2.GA/server/default/tmp/deploy/tmp345444343418491701OpenKM.ear-contents/OpenKM.jar
org.jboss.deployment.DeploymentException: Verification of Enterprise Beans failed, see above for error messages.
	at org.jboss.ejb.EJBDeployer.create(EJBDeployer.java:610)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
	at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
	at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
	at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
	at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
	at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)
	at org.jboss.system.InterceptorServiceMBeanSupport.invokeNext(InterceptorServiceMBeanSupport.java:238)
	at org.jboss.wsf.container.jboss42.DeployerInterceptor.create(DeployerInterceptor.java:76)
	at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.create(SubDeployerInterceptorSupport.java:180)
	at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:91)
	at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
	at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
	at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
	at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
	at $Proxy32.create(Unknown Source)
	at org.jboss.deployment.MainDeployer.create(MainDeployer.java:969)
	at org.jboss.deployment.MainDeployer.create(MainDeployer.java:959)
	at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:818)
	at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
	at sun.reflect.GeneratedMethodAccessor20.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
	at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
	at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
	at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
	at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
	at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
	at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
	at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
	at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
	at $Proxy9.deploy(Unknown Source)
	at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
	at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:634)
	at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
	at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:336)
	at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
	at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
	at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
	at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
	at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
	at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
	at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
	at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
	at $Proxy0.start(Unknown Source)
	at org.jboss.system.ServiceController.start(ServiceController.java:417)
	at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
	at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
	at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
	at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
	at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
	at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
	at $Proxy4.start(Unknown Source)
	at org.jboss.deployment.SARDeployer.start(SARDeployer.java:302)
	at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
	at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
	at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
	at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:766)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
	at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
	at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
	at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
	at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
	at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
	at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
	at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
	at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
	at $Proxy5.deploy(Unknown Source)
	at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:482)
	at org.jboss.system.server.ServerImpl.start(ServerImpl.java:362)
	at org.jboss.Main.boot(Main.java:200)
	at org.jboss.Main$1.run(Main.java:508)
	at java.lang.Thread.run(Thread.java:595)
16:54:35,704 ERROR [URLDeploymentScanner] Incomplete Deployment listing:

--- Incompletely deployed packages ---
org.jboss.deployment.DeploymentInfo@b362dffc { url=file:/usr/local/jboss-4.2.2.GA/server/default/deploy/OpenKM.ear }
  deployer: org.jboss.deployment.EARDeployer@5b28c9
  status: Deployment FAILED reason: Verification of Enterprise Beans failed, see above for error messages.
  state: FAILED
  watch: file:/usr/local/jboss-4.2.2.GA/server/default/deploy/OpenKM.ear
  altDD: null
  lastDeployed: 1253130874796
  lastModified: 1253130846000
  mbeans:


16:54:36,534 INFO  [Http11Protocol] Arrancando Coyote HTTP/1.1 en puerto http-localhost%2F127.0.0.1-8080
16:54:36,799 INFO  [AjpProtocol] Starting Coyote AJP/1.3 on ajp-localhost%2F127.0.0.1-8009
16:54:36,816 INFO  [Server] JBoss (MX MicroKernel) [4.2.2.GA (build: SVNTag=JBoss_4_2_2_GA date=200710221139)] Started in 1m:865ms
Gracias...

Re:Montar el entorno de desarrollo

PostPosted:Fri Sep 18, 2009 2:48 pm
by raquel
Buenos días,


Ya logre montar el entorno de desarrollo y todo funciono perfecto... Pero tengo dudas acerca de donde (paquete) debo crear la clase que extienda de la interfaz Principal Adapter? Hasta ahora la cree en el paquete es.git.open.principal. Pero como hago para que el Jboss me pille la clase.

Adjunto el codigo de la principal adapter
Code: Select all

package es.git.openkm.principal;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Hashtable;
import java.util.Iterator;

import javax.naming.*; 
import javax.naming.directory.*; 
import javax.naming.NamingException; 

 
 
import org.slf4j.Logger; 
 
import org.slf4j.LoggerFactory; 

import es.git.openkm.core.Config;

public class UsersRolesPrincipalAdapterLdap implements PrincipalAdapter {
	
	private static Logger log = LoggerFactory.getLogger(UsersRolesPrincipalAdapterLdap.class);

	public Collection<String> getUsers() throws PrincipalAdapterException {
		log.debug(\"getUsers()\");
		ArrayList<String> list = new ArrayList<String>();
		ArrayList<String> ldap = ldapSearch(
				\"cn=users,dc=xx,dc=xx,dc=xx\", 
				\"(objectclass=person)\", 
				\"uid\");
		
		for (Iterator<String> it = ldap.iterator(); it.hasNext(); ) {
			String user = it.next();
			if (!Config.ADMIN_USER.equals(user) && !Config.SYSTEM_USER.equals(user)) {
				list.add(user);
			}
		}

		log.debug(\"getUsers: \" + list);
		return list;
	}


	public Collection<String> getRoles() throws PrincipalAdapterException {
		log.debug(\"getRoles()\");
		ArrayList<String> list = new ArrayList<String>();
		ArrayList<String> ldap = ldapSearch(
				\"cn=groups,dc=xx,dc=xx,dc=xx\", 
				\"(objectclass=posixGroup)\", 
				\"cn\");
		
		for (Iterator<String> it = ldap.iterator(); it.hasNext(); ) {
			String role = it.next();
			if (!Config.DEFAULT_ADMIN_ROLE.equals(role)) {
				list.add(role);
			}
		}

		log.debug(\"getRoles: \" + list);
		return list;
	}


	public Collection<String> getMails(Collection<String> users)
			throws PrincipalAdapterException {
		log.debug(\"getMails()\");
		ArrayList<String> list = new ArrayList<String>();
		
		for (Iterator<String> it = users.iterator(); it.hasNext();) {
			String user = it.next();
			ArrayList<String> ldap = ldapSearch(
					\"uid=\"+user+\",cn=users,dc=xx,dc=xx,dc=xx\", 
					\"(objectclass=person)\", 
					\"mail\");
			if (!ldap.isEmpty()) {
				list.add(ldap.get(0));
			}
		}

		log.debug(\"getMails: \" + list);
		return list;
	}
	

	private ArrayList<String> ldapSearch(String searchBase, String searchFilter, String attribute) {
		ArrayList<String> al = new ArrayList<String>();
		Hashtable<String, String> env = new Hashtable<String, String>();

		// env.put(Context.SECURITY_PRINCIPAL,
		// \"CN=Administrator,CN=Users,DC=ANTIPODES,DC=COM\");
		// env.put(Context.SECURITY_CREDENTIALS, \"XXXXXX\");
		env.put(Context.INITIAL_CONTEXT_FACTORY, \"com.sun.jndi.ldap.LdapCtxFactory\");
		env.put(Context.SECURITY_AUTHENTICATION, \"simple\");
		env.put(Context.PROVIDER_URL, \"ldap://xxx.xxx.xx.xx:389\");
		
		try {
			DirContext ctx = new InitialDirContext(env);
			SearchControls searchCtls = new SearchControls();
			searchCtls.setSearchScope(SearchControls.SUBTREE_SCOPE);
			NamingEnumeration<SearchResult> results = ctx.search(searchBase, searchFilter, searchCtls);

			while (results.hasMore()) {
				SearchResult searchResult = (SearchResult) results.next();
				System.out.println(\">>>\" + searchResult.getName());
				Attributes attributes = searchResult.getAttributes();
				Attribute attrib = attributes.get(attribute);
				
				if (attrib != null) {
					String item = (String) attrib.get();
					al.add(item);
				}
			}

			ctx.close();
		} catch (NamingException e) {
			e.printStackTrace();
		}

		return al;
	}
}



Re:Montar el entorno de desarrollo

PostPosted:Mon Sep 21, 2009 11:37 am
by jllort
1- Paras el jboss
2- Modificas el OpenKM.cfg con la classe correpondiente que hayas creado ( hay una comentada si te fijas, es la que tienes que descomentar y sustituir por el nombre de la clase que hayas creado )
Code: Select all
# principal.adapter=es.git.openkm.core.principal.DatabasePrincipalAdapter

3- Vuelve a arrancar el jboss y listos

Re:Montar el entorno de desarrollo

PostPosted:Mon Sep 21, 2009 4:36 pm
by raquel
Buenos días,

jilort hice lo que me comentaste y además modifique el fichero Config.java y le coloque el nombre de la clase tal como sigue:
Code: Select all
 public static String PRINCIPAL_ADAPTER = \"es.git.openkm.core.principal.UsersRolesPrincipalAdapterLdap\";
Y aún asi me sigue dando error. Adjunto el log del servidor:
Code: Select all
12:22:32,192 INFO  [DirectAuthModule] rgarcia # lockTokensValues.length: 0
12:22:32,212 INFO  [AbstractDAO] Looking for java:/OKMActivityDS DataSource...
12:23:36,424 INFO  [DirectAuthModule] PrincipalAdapter: es.git.openkm.core.principal.UsersRolesPrincipalAdapterLdap
12:23:36,440 ERROR [DirectAuthModule] es.git.openkm.core.principal.UsersRolesPrincipalAdapterLdap
java.lang.ClassNotFoundException: es.git.openkm.core.principal.UsersRolesPrincipalAdapterLdap
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1358)
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)
	at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:164)
	at es.git.openkm.module.direct.DirectAuthModule.getPrincipalAdapter(DirectAuthModule.java:815)
	at es.git.openkm.module.direct.DirectAuthModule.getUsers(DirectAuthModule.java:840)
	at es.git.openkm.api.OKMAuth.getUsers(OKMAuth.java:152)
	at es.git.openkm.frontend.server.OKMAuthServlet.getAllUsers(OKMAuthServlet.java:435)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:527)
	at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:164)
	at com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost(RemoteServiceServlet.java:86)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
	at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
	at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
	at java.lang.Thread.run(Thread.java:595)
12:23:36,441 ERROR [OKMAuthServlet] es.git.openkm.core.principal.UsersRolesPrincipalAdapterLdap
es.git.openkm.core.RepositoryException: es.git.openkm.core.principal.UsersRolesPrincipalAdapterLdap
	at es.git.openkm.module.direct.DirectAuthModule.getPrincipalAdapter(DirectAuthModule.java:819)
	at es.git.openkm.module.direct.DirectAuthModule.getUsers(DirectAuthModule.java:840)
	at es.git.openkm.api.OKMAuth.getUsers(OKMAuth.java:152)
	at es.git.openkm.frontend.server.OKMAuthServlet.getAllUsers(OKMAuthServlet.java:435)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:527)
	at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:164)
	at com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost(RemoteServiceServlet.java:86)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
	at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
	at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
	at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.ClassNotFoundException: es.git.openkm.core.principal.UsersRolesPrincipalAdapterLdap
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1358)
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)
	at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:164)
	at es.git.openkm.module.direct.DirectAuthModule.getPrincipalque debo hacer???Adapter(DirectAuthModule.java:815)
	... 31 more
12:23:37,657 INFO  [AbstractDAO] Looking for java:/OKMDashboardStatsDS DataSource...
12:23:38,627 INFO  [DirectAuthModule] PrincipalAdapter: es.git.openkm.core.principal.UsersRolesPrincipalAdapterLdap
12:23:38,628 ERROR [DirectAuthModule] es.git.openkm.core.principal.UsersRolesPrincipalAdapterLdap
java.lang.ClassNotFoundException: es.git.openkm.core.principal.UsersRolesPrincipalAdapterLdap
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1358)
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)
	at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:164)


Cómo que no encuentra la clase.. a que se deberá??

Re:Montar el entorno de desarrollo

PostPosted:Wed Sep 23, 2009 9:37 am
by jllort
Mas que en el config.java lo mejor ubiese sido solo modificar el OpenKM.cfg pero bueno.

Mira dentro del OpenKM.war/WEB-INF/classes/ que tu clase este donde toca es decir dentro del directorio es/git/openkm etc....

Re:Montar el entorno de desarrollo

PostPosted:Thu Sep 24, 2009 8:39 pm
by raquel
Gracias jilort...

Pero aún me sigue dando el mismo problema. Tengo las siguientes dudas:

1. Algo que no entiendo es que tengo solo el paquete es.git.openkm.core y es.git.openkm.principal entonces como es que cuando mando la ruta donde esta la clase principal adapter se coloca: es.git.openkm.core.principal.nombre_de_la clase. el directorio principal dentro de core no existe.

2. yo tengo montado el entorno de desarrollo y todos los archivos tienen extensión .java como hago para colocar la principal adapter que cree .class y poder colocarla en el directorio directamente [file] del jboss???

3. A continuación muestro el error que me lanza cuando me logueo con el openkm..
[img]
http://mail.google.com/mail/?ui=2&ik=4d ... y780eo1&zw[/img]

Re:Montar el entorno de desarrollo

PostPosted:Tue Sep 29, 2009 10:52 am
by jllort
1- La classe el paquete es.git.openkm.core.principal se refactorizo como es.git.openkm.principal por eso no tienes el directorio core dentro de openkm. Aunque en el OpenKM.cfg o el faq te ponga que tienes que poner la classe es.git.openkm.core.principal.UsersRolesPrincipalAdapterLdap en realidad tienes que poner tu ruta real, que me imagino que debe sr es.git.openkm.principal.UsersRolesPrincipalAdapterLdap

2- Para poner la classe, tienes que abrir el OpenKM.war ( que esta dentro del OpenKM.ear ) navegar hasta WEB-INF/classes ( alli se van poniendo las classes compiladas ), navega por es/git/openkm/principal y copia alli tu fichero ( si estas en windows utiliza winrar para abrir estos ficheros ).

Nota: Todo esto con el jboss parado. Hecho esto ya te encontrará la clase correspondiente al arrancar el jboss.

Re:Montar el entorno de desarrollo

PostPosted:Wed Sep 30, 2009 4:13 pm
by raquel
Gracias jilort.

Ya encontro la clase y se conecto perfecto pero cuando me voy a la pestaña de administración no me muestra los usuarios del Ldap. Ya con la implementación de esta clase no debería mostrarme todos los usuarios???


Gracias

principal adapter

PostPosted:Thu Oct 08, 2009 2:10 pm
by raquel
hola.

Buen día.

Coloque la clase en es.git.open.principal y ya la encontro. Cuando ejecuto me imprime una lista de usuarios en la consola, pero no me los muestra en la pestaña de administración. Que debo hacer para que me los muestre en la interfaz debo programarlo yo???

Gracias...

Re:principal adapter

PostPosted:Tue Oct 13, 2009 6:46 am
by jllort
En el OpenKM.cfg has puesto este principal Adapter que has creado tu que tiene implementada la clase esta, verdad ? esto a parte de visualizar por pantalla ( que lo debes haber hecho tu dentro de cada metodo ), los métodos devuelven una listas, supongo que estas listas las has actualizado con los valores que has capturado no ?

Hecho esto último no entiendo que problema puedes tener, por que en la parte pública UI, deberías ver las listas de usuarios y de grupos ( por ejemplo en la pestaña de seguridad ). Si no es así indícanos hasta donde has llegado para tenerlo mas claro.

Re:principal adapter

PostPosted:Wed Oct 14, 2009 4:18 pm
by raquel
hola

Hasta ahora he hecho lo siguiente:

1. Mofique el fichero openkm.cfg y le coloque la ruta de la clase que cree. Imprimi en la consola la lista que me devuelve (previamente actualizada) y me muestra el listado de los usuarios (sin los roles ni el email solo el uid de usuarios). Lo que no se como hacer es que me muestre los usuarios,roles y email en la UI?

Re:principal adapter

PostPosted:Thu Oct 15, 2009 8:43 pm
by raquel
Hola, este es el codigo que tengo...
Code: Select all

package es.git.openkm.principal;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.LinkedList;

import javax.naming.*; 
import javax.naming.directory.*; 
import javax.naming.NamingException; 

 
 
import org.slf4j.Logger; 
 
import org.slf4j.LoggerFactory; 

import es.git.openkm.core.Config;
import es.git.openkm.dao.AuthDAO;
import es.git.openkm.dao.bean.User;
import es.git.openkm.principal.PrincipalAdapter;
import es.git.openkm.principal.PrincipalAdapterException;
import es.git.openkm.dao.bean.Role;


public class UsersRolesPrincipalAdapterLdap implements PrincipalAdapter {
	
	private static Logger log = LoggerFactory.getLogger(UsersRolesPrincipalAdapterLdap.class);

	/*
	 * (non-Javadoc)
	 * 
	 * @see es.git.openkm.principal.PrincipalAdapter#getUsers()
	 */
	public Collection<String> getUsers() throws PrincipalAdapterException{
		log.debug(\"getUsers()\");
		
		ArrayList<String> list = new ArrayList<String>();
		ArrayList<String> al = new ArrayList<String>();
		Hashtable<String, String> env = new Hashtable<String, String>();
		env.put(Context.SECURITY_PRINCIPAL,
		\"CN=xx,DC=xx,DC=xx,DC=xx\");
		env.put(Context.SECURITY_CREDENTIALS, \"xxx\");
		env.put(Context.INITIAL_CONTEXT_FACTORY, \"com.sun.jndi.ldap.LdapCtxFactory\");
		env.put(Context.SECURITY_AUTHENTICATION, \"simple\");
		env.put(Context.PROVIDER_URL, \"ldap://xxxxx:389\");
		
		try {
			DirContext ctx = new InitialDirContext(env);
			SearchControls searchCtls = new SearchControls();
			searchCtls.setSearchScope(SearchControls.SUBTREE_SCOPE);
			
			NamingEnumeration<SearchResult> results = ctx.search( 
	        		 \"ou=xx,dc=xx,dc=xx,dc=xx\", 
		 				\"(objectclass=xx)\",searchCtls); 

			while (results.hasMore()) {
				SearchResult searchResult = (SearchResult) results.next();
				Attributes attributes = searchResult.getAttributes();
				Attribute attrib = attributes.get(\"uid\");
				
				System.out.println(\"atributo\" +attrib);
				if (attrib != null) {
					String item = (String) attrib.get();
					al.add(item);
				}
			}

			ctx.close();
		} catch (NamingException e) {
			e.printStackTrace();
		}
		ArrayList<String> ldap = al;
		
			for (Iterator<String> it = ldap.iterator(); it.hasNext(); ) {
				String user = it.next();
				if (!Config.ADMIN_USER.equals(user) && !Config.SYSTEM_USER.equals(user)) {
					list.add(user);
					
				}
			}
		
	      log.debug(\"getUsers: \"+list);     
	      return list; 
	

	/*
	 * (non-Javadoc)
	 * 
	 * @see es.git.openkm.principal.PrincipalAdapter#getRoles()
	 */
public Collection<String> getRoles() throws PrincipalAdapterException {
		log.debug(\"getRoles()\");
		
		ArrayList<String> list = new ArrayList<String>();
		ArrayList<String> al = new ArrayList<String>();
		Hashtable<String, String> env = new Hashtable<String, String>();
		env.put(Context.SECURITY_PRINCIPAL,
		\"CN=xx,DC=xx,DC=xx,DC=xx\");
		env.put(Context.SECURITY_CREDENTIALS, \"xx\");
		env.put(Context.INITIAL_CONTEXT_FACTORY, \"com.sun.jndi.ldap.LdapCtxFactory\");
		env.put(Context.SECURITY_AUTHENTICATION, \"simple\");
		env.put(Context.PROVIDER_URL, \"ldap://xxxx:389\");
		
		try {
			DirContext ctx = new InitialDirContext(env);
			SearchControls searchCtls = new SearchControls();
			searchCtls.setSearchScope(SearchControls.SUBTREE_SCOPE);
			
			NamingEnumeration<SearchResult> results = ctx.search(
					\",dc=xx,dc=xx,dc=xx\", 
					\"(objectclass=*)\",searchCtls); 

			while (results.hasMore()) {
				SearchResult searchResult = (SearchResult) results.next();
				System.out.println(\">>>Roles:\" + searchResult.getName());
				Attributes attributes = searchResult.getAttributes();
				Attribute attrib = attributes.get(\"xx\");
				
				
				if (attrib != null) {
					String item = (String) attrib.get();
					al.add(item);
				}
			}

			ctx.close();
		} catch (NamingException e) {
			e.printStackTrace();
		}
		ArrayList<String> ldap = al;
		
		for (Iterator<String> it = ldap.iterator(); it.hasNext(); ) {
			String role = it.next();
			System.out.println(\"rol:\"+role);
			if (!Config.DEFAULT_ADMIN_ROLE.equals(role)) {
				list.add(role);
			}
		}
		
		
	       log.debug(\"getRoles: \"+list); 
	       return list; 
	 
	/*
	 * (non-Javadoc)
	 * 
	 * @see es.git.openkm.principal.PrincipalAdapter#getManullils(java.util.Collection)
	 */
	public Collection<String> getMails(Collection<String> users)
			throws PrincipalAdapterException {
		log.debug(\"getMails()\");
		
		ArrayList<String> list = new ArrayList<String>();
		ArrayList<String> al = new ArrayList<String>();
		
		
		for (Iterator<String> it = users.iterator(); it.hasNext();) {
			String user = it.next();
			
			Hashtable<String, String> env = new Hashtable<String, String>();
			env.put(Context.SECURITY_PRINCIPAL,
			\"CN=xx,DC=xx,DC=xx,DC=xx\");
			env.put(Context.SECURITY_CREDENTIALS, \"xxx\");
			env.put(Context.INITIAL_CONTEXT_FACTORY, \"com.sun.jndi.ldap.LdapCtxFactory\");
			env.put(Context.SECURITY_AUTHENTICATION, \"simple\");
			env.put(Context.PROVIDER_URL, \"ldap://xx:389\");
			
			try {
				DirContext ctx = new InitialDirContext(env);
				SearchControls searchCtls = new SearchControls();
				searchCtls.setSearchScope(SearchControls.SUBTREE_SCOPE);
				
				NamingEnumeration<SearchResult> results = ctx.search(
						\"uid=\"+user+\",ou=xx,dc=xx,dc=xx,dc=xx\", 
						\"(objectclass=person)\",searchCtls); 

				while (results.hasMore()) {
					SearchResult searchResult = (SearchResult) results.next();
					System.out.println(\">>>mail:\" + searchResult.getName());
					Attributes attributes = searchResult.getAttributes();
					Attribute attrib = attributes.get(\"mail\");
					
					
					if (attrib != null) {
						String item = (String) attrib.get();
						al.add(item);
					}
				}

				ctx.close();
			} catch (NamingException e) {
				e.printStackTrace();
			}
			
			ArrayList<String> ldap=al;
			
			if (!ldap.isEmpty()) {
				list.add(ldap.get(0));
			}
			
		
		}

	       log.debug(\"getMails: \" + list);
			return list;
	

		
		log.debug(\"getMails: \" + list);
		return list;
	}

}




Re:principal adapter

PostPosted:Fri Oct 16, 2009 6:53 pm
by jllort
En principio la lista de usuarios y roles la tienes que ver en la pestaña de seguridad ? allí te aparece ?

En la parte de administración esto no se sincroniza, con lo que igualmente continuaras viendo datos que nada tienen que ver con la integración con ldap.

Certifícame si al modificar la seguridad de un documento ves los usuarios y roles. Por que si al hacer getUsers() te devuelve la lista de usuarios, en el apartado de seguridad te tienen que salir. Indicame si esto es así ?

En principio la clase no tiene mala pinta.

Un detalle final, estas sincronizando contra un ldap normal o contra un active directory ?