directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Felix Knecht <fel...@apache.org>
Subject Re: Embedded Server - Sample
Date Mon, 17 Nov 2008 11:13:02 GMT
Hi Juergen

Juergen Weber schrieb:
> Hi Felix,
>
> I put the web application sample into a main, but I get an Exception
>   
I'm sorry to say that I don't have that much knowledge about the
sample.zip, but probably either something is missing in the classpath or
one of the libraries is corrupt.
What I tried is
- Create a new maven project using the artifact from [1]:

mvn archetype:generate \
  -DgroupId=org.example \
  -DartifactId=myProject \
  -Dversion=1.0-SNAPSHOT \
  -DarchetypeGroupId=org.apache.directory.samples \
  -DarchetypeArtifactId=apacheds-webapp \
  -DarchetypeVersion=1.0-SNAPSHOT \
  -DarchetypeRepository=http://vm094.oxylos.org/mirror-maven2/


- Added the DSStart source in myProject/src/main/java
- Added the exec-plugin to the pom.xml (to start it via maven)
 
felix@pcfelix ~/tmp/emb/myProject $ diff pom.xml.orig pom.xml
59a60,63
>       <plugin>
>         <groupId>org.codehaus.mojo</groupId>
>         <artifactId>exec-maven-plugin</artifactId>
>       </plugin>

- And run it

felix@pcfelix ~/tmp/emb/myProject $ mvn clean install exec:java
-Dexec.mainClass="DSStarter"
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'exec'.
[INFO] artifact org.codehaus.mojo:exec-maven-plugin: checking for
updates from central
Downloading:
http://repo1.maven.org/maven2/org/codehaus/mojo/exec-maven-plugin/1.1/exec-maven-plugin-1.1.pom
3K downloaded
Downloading:
http://repo1.maven.org/maven2/org/codehaus/mojo/exec-maven-plugin/1.1/exec-maven-plugin-1.1.jar
26K downloaded
[INFO]
------------------------------------------------------------------------
[INFO] Building Embed ApacheDS as a Web Application
[INFO]    task-segment: [clean, install, exec:java]
[INFO]
------------------------------------------------------------------------
[INFO] [clean:clean]
[INFO] Deleting directory /home/felix/tmp/emb/myProject/target
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
[INFO] Compiling 3 source files to
/home/felix/tmp/emb/myProject/target/classes
[INFO] [resources:testResources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:testCompile]
[INFO] No sources to compile
[INFO] [surefire:test]
[INFO] No tests to run.
[INFO] [war:war]
[INFO] Packaging webapp
[INFO] Assembling webapp[myProject] in
[/home/felix/tmp/emb/myProject/target/myProject]
[INFO] Processing war project
[INFO] Webapp assembled in[175 msecs]
[INFO] Building war: /home/felix/tmp/emb/myProject/target/myProject.war
[INFO] [install:install]
[INFO] Installing /home/felix/tmp/emb/myProject/target/myProject.war to
/home/felix/.m2/repository/org/example/myProject/1.0-SNAPSHOT/myProject-1.0-SNAPSHOT.war
[INFO] Preparing exec:java
[INFO] No goals needed for project - skipping
[INFO] [exec:java]
[11:57:50] INFO
[org.apache.directory.server.core.DefaultDirectoryService] - ApacheDS
shutdown hook has been registered with the runtime.
[11:57:51] INFO
[org.apache.directory.server.core.event.EventInterceptor] - Initializing ...
[11:57:51] INFO
[org.apache.directory.server.core.event.EventInterceptor] -
Initialization complete.
[11:57:51] INFO [org.apache.directory.server.ldap.LdapService] -
Successful bind of an LDAP Service (10389) is complete.

So this seems to work.

Following the classpath used by maven ( mvn dependency:build-classpath )

antlr-2.7.7.jar
commons-collections-3.2.1.jar
commons-lang-2.4.jar
servlet-api-2.5.jar
log4j-1.2.14.jar
commons-io-1.3.2.jar
apacheds-bootstrap-extract-1.5.4.jar
apacheds-bootstrap-partition-1.5.4.jar
apacheds-core-1.5.4.jar
apacheds-core-avl-1.5.4.jar
apacheds-core-constants-1.5.4.jar
apacheds-core-cursor-1.5.4.jar
apacheds-core-entry-1.5.4.jar
apacheds-core-jndi-1.5.4.jar
apacheds-core-shared-1.5.4.jar
apacheds-jdbm-1.5.4.jar
apacheds-jdbm-store-1.5.4.jar
apacheds-kerberos-shared-1.5.4.jar
apacheds-protocol-ldap-1.5.4.jar
apacheds-protocol-shared-1.5.4.jar
apacheds-schema-bootstrap-1.5.4.jar
apacheds-schema-extras-1.5.4.jar
apacheds-schema-registries-1.5.4.jar
apacheds-utils-1.5.4.jar
apacheds-xdbm-base-1.5.4.jar
apacheds-xdbm-search-1.5.4.jar
apacheds-xdbm-tools-1.5.4.jar
shared-asn1-0.9.12.jar
shared-asn1-codec-0.9.12.jar
shared-bouncycastle-reduced-0.9.12.jar
shared-ldap-0.9.12.jar
shared-ldap-constants-0.9.12.jar
mina-core-1.1.7.jar
mina-filter-ssl-1.1.7.jar
slf4j-api-1.5.2.jar
slf4j-log4j12-1.5.2.jar

[1] http://vm094.oxylos.org/projects/samples/apacheds-webapp/


> 2008-11-17 11:05:43,895 [main] DEBUG
> org.apache.directory.server.core.DefaultDirectoryService  - <---
> DefaultDirectoryService initialized
> Exception in thread "main" java.lang.NoSuchMethodError:
> org.apache.directory.server.ldap.LdapProtocolHandler.removeMessageHandler(Ljava/lang/Class;)Lorg/apache/mina/handler/demux/MessageHandler;
> 	at
> org.apache.directory.server.ldap.LdapService.setAbandonHandler(LdapService.java:855)
> 	at
> org.apache.directory.server.ldap.LdapService.installDefaultHandlers(LdapService.java:228)
> 	at org.apache.directory.server.ldap.LdapService.start(LdapService.java:319)
> 	at test.DSStarter.startDS(DSStarter.java:35)
> 	at test.DSStarter.main(DSStarter.java:42)
>
>
>
>
> import java.io.File;
>
> import org.apache.directory.server.core.DefaultDirectoryService;
> import org.apache.directory.server.core.DirectoryService;
> import org.apache.directory.server.ldap.LdapService;
> import org.apache.directory.server.protocol.shared.SocketAcceptor;
>
> public class DSStarter
> {
> 	private DirectoryService directoryService;
>
> 	private SocketAcceptor socketAcceptor;
>     private LdapService ldapService;
>
>     void startDS() throws Exception
>     {
>     	directoryService = new DefaultDirectoryService();
>         directoryService.setShutdownHookEnabled(true);
>
>         socketAcceptor = new SocketAcceptor(null);
>         ldapService = new LdapService();
>         ldapService.setSocketAcceptor(socketAcceptor);
>         ldapService.setDirectoryService(directoryService);
>
>         ldapService.setIpPort(10389);
>
>         
>         String s = System.getProperty("java.io.tmpdir");
>         
>         directoryService.setWorkingDirectory(new File(s));
>
>         directoryService.startup();
>         ldapService.start();
>
>     }
>     
> 	
> 	public static void main(String[] args) throws Exception
> 	{
> 		new DSStarter().startDS();
> 		Thread.sleep(Long.MAX_VALUE);
> 		System.out.println("done");
> 	}
> }
>
> The classpath is
>
> D:\java\apacheds-1.5.4\lib\xbean-spring-3.3.jar
> D:\java\apacheds-1.5.4\lib\antlr-2.7.7.jar
> D:\java\apacheds-1.5.4\lib\apacheds-bootstrap-extract-1.5.4.jar
> D:\java\apacheds-1.5.4\lib\apacheds-bootstrap-partition-1.5.4.jar
> D:\java\apacheds-1.5.4\lib\apacheds-core-1.5.4.jar
> D:\java\apacheds-1.5.4\lib\apacheds-core-avl-1.5.4.jar
> D:\java\apacheds-1.5.4\lib\apacheds-core-constants-1.5.4.jar
> D:\java\apacheds-1.5.4\lib\apacheds-core-cursor-1.5.4.jar
> D:\java\apacheds-1.5.4\lib\apacheds-core-entry-1.5.4.jar
> D:\java\apacheds-1.5.4\lib\apacheds-core-jndi-1.5.4.jar
> D:\java\apacheds-1.5.4\lib\apacheds-core-shared-1.5.4.jar
> D:\java\apacheds-1.5.4\lib\apacheds-jdbm-1.5.4.jar
> D:\java\apacheds-1.5.4\lib\apacheds-jdbm-store-1.5.4.jar
> D:\java\apacheds-1.5.4\lib\apacheds-kerberos-shared-1.5.4.jar
> D:\java\apacheds-1.5.4\lib\apacheds-noarch-installer-1.5.4.jar
> D:\java\apacheds-1.5.4\lib\apacheds-protocol-changepw-1.5.4.jar
> D:\java\apacheds-1.5.4\lib\apacheds-protocol-dns-1.5.4.jar
> D:\java\apacheds-1.5.4\lib\apacheds-protocol-kerberos-1.5.4.jar
> D:\java\apacheds-1.5.4\lib\apacheds-protocol-ldap-1.5.4.jar
> D:\java\apacheds-1.5.4\lib\apacheds-protocol-ntp-1.5.4.jar
> D:\java\apacheds-1.5.4\lib\apacheds-protocol-shared-1.5.4.jar
> D:\java\apacheds-1.5.4\lib\apacheds-schema-bootstrap-1.5.4.jar
> D:\java\apacheds-1.5.4\lib\apacheds-schema-extras-1.5.4.jar
> D:\java\apacheds-1.5.4\lib\apacheds-schema-registries-1.5.4.jar
> D:\java\apacheds-1.5.4\lib\apacheds-server-jndi-1.5.4.jar
> D:\java\apacheds-1.5.4\lib\apacheds-server-unit-1.5.4.jar
> D:\java\apacheds-1.5.4\lib\apacheds-server-xml-1.5.4.jar
> D:\java\apacheds-1.5.4\lib\apacheds-utils-1.5.4.jar
> D:\java\apacheds-1.5.4\lib\apacheds-xbean-spring-1.5.4.jar
> D:\java\apacheds-1.5.4\lib\apacheds-xdbm-base-1.5.4.jar
> D:\java\apacheds-1.5.4\lib\apacheds-xdbm-search-1.5.4.jar
> D:\java\apacheds-1.5.4\lib\apacheds-xdbm-tools-1.5.4.jar
> D:\java\apacheds-1.5.4\lib\bootstrapper.jar
> D:\java\apacheds-1.5.4\lib\commons-cli-1.1.jar
> D:\java\apacheds-1.5.4\lib\commons-collections-3.2.jar
> D:\java\apacheds-1.5.4\lib\commons-daemon-1.0.1.jar
> D:\java\apacheds-1.5.4\lib\commons-io-1.3.2.jar
> D:\java\apacheds-1.5.4\lib\commons-lang-2.3.jar
> D:\java\apacheds-1.5.4\lib\jcl104-over-slf4j-1.4.3.jar
> D:\java\apacheds-1.5.4\lib\log4j-1.2.14.jar
> D:\java\apacheds-1.5.4\lib\mina-core-1.1.6.jar
> D:\java\apacheds-1.5.4\lib\mina-filter-ssl-1.1.6.jar
> D:\java\apacheds-1.5.4\lib\shared-asn1-0.9.12.jar
> D:\java\apacheds-1.5.4\lib\shared-asn1-codec-0.9.12.jar
> D:\java\apacheds-1.5.4\lib\shared-bouncycastle-reduced-0.9.12.jar
> D:\java\apacheds-1.5.4\lib\shared-ldap-0.9.12.jar
> D:\java\apacheds-1.5.4\lib\shared-ldap-constants-0.9.12.jar
> D:\java\apacheds-1.5.4\lib\slf4j-api-1.4.3.jar
> D:\java\apacheds-1.5.4\lib\slf4j-log4j12-1.4.3.jar
> D:\java\apacheds-1.5.4\lib\spring-beans-2.0.6.jar
> D:\java\apacheds-1.5.4\lib\spring-context-2.0.6.jar
> D:\java\apacheds-1.5.4\lib\spring-core-2.0.6.jar
> D:\java\apacheds-1.5.4\lib\wrapper.jar
>
>   


Mime
View raw message