08-03-2009 10:23 AM
08-03-2009 11:39 AM
08-04-2009 05:28 AM
protected static void groups(String username) throws Exception{
administrationService = WebServiceFactory.getAdministrationService();
int batchSize = 5;
QueryConfiguration queryCfg = new QueryConfiguration();
queryCfg.setFetchSize(batchSize);
WebServiceFactory.getAdministrationService().setHeader(
new RepositoryServiceLocator().getServiceName().getNamespaceURI(),
"QueryHeader",
queryCfg);
// check the user
boolean existUser=false;
try {
// test before the user
UserDetails userDetails = administrationService.getUser(username);
existUser=true;
} catch (Exception e){
existUser=false;
e.printStackTrace();
}
if (existUser) {System.out.println("the user "+username+" exists");}
else{System.out.println("the user "+username+" DO NOT exists");}
/*TODO: get all the groups which the user belongs to*/
}
AuthorityService authorityService=serviceRegistry.getAuthorityService();
Set<String> auths = authorityService.getAuthoritiesForUser(username);
08-04-2009 06:42 AM
ApplicationContext appContext = new ClassPathXmlApplicationContext("alfresco/application-context.xml");
ServiceRegistry serviceRegistry = (ServiceRegistry)appContext.getBean(ServiceRegistry.SERVICE_REGISTRY);
AuthorityService authorityService = serviceRegistry.getAuthorityService();
Set<String> auths = authorityService.getAuthoritiesForUser(username);
Iterator<String> authIt = auths.iterator();
while (authIt.hasNext()){
System.out.println("- " + authIt.next());
}
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'avmRemoteService' defined in class path resource [alfresco/remote-services-context.xml]: Invocation of init method failed; nested exception is java.rmi.server.ExportException: Port already in use: 50501; nested exception is:
java.net.BindException: Address already in use
Caused by: java.rmi.server.ExportException: Port already in use: 50501; nested exception is:
java.net.BindException: Address already in use
at sun.rmi.transport.tcp.TCPTransport.listen(TCPTransport.java:328)
at sun.rmi.transport.tcp.TCPTransport.exportObject(TCPTransport.java:236)
at sun.rmi.transport.tcp.TCPEndpoint.exportObject(TCPEndpoint.java:411)
at sun.rmi.transport.LiveRef.exportObject(LiveRef.java:147)
at sun.rmi.server.UnicastServerRef.exportObject(UnicastServerRef.java:207)
at java.rmi.server.UnicastRemoteObject.exportObject(UnicastRemoteObject.java:310)
at java.rmi.server.UnicastRemoteObject.exportObject(UnicastRemoteObject.java:252)
at org.springframework.remoting.rmi.RmiServiceExporter.prepare(RmiServiceExporter.java:280)
at org.springframework.remoting.rmi.RmiServiceExporter.afterPropertiesSet(RmiServiceExporter.java:227)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1203)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1172)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:427)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:249)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:155)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:246)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:291)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:122)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:66)
at pt.moredata.Grupos.groups(Grupos.java:100)
at pt.moredata.Grupos.main(Grupos.java:41)
Caused by: java.net.BindException: Address already in use
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:336)
at java.net.ServerSocket.bind(ServerSocket.java:336)
at java.net.ServerSocket.<init>(ServerSocket.java:202)
at java.net.ServerSocket.<init>(ServerSocket.java:114)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createServerSocket(RMIDirectSocketFactory.java:45)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createServerSocket(RMIMasterSocketFactory.java:351)
at sun.rmi.transport.tcp.TCPEndpoint.newServerSocket(TCPEndpoint.java:667)
at sun.rmi.transport.tcp.TCPTransport.listen(TCPTransport.java:317)
08-04-2009 07:34 AM
08-04-2009 09:29 AM
08-04-2009 12:16 PM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.