You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by Felix Knecht <fe...@otego.com> on 2008/10/08 09:02:37 UTC

Embedding ApacheDS as a Web Application

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi all
Hi Stefan

I tried to run the example [1] from the page on a linux box. It didn't worked, because there are some hardcoded
(Windows) paths in the build.xml:

"
felix@pcfelix /tmp/test/ApacheDS WebApp $ ant
Buildfile: build.xml

prepare:
    [mkdir] Created dir: /tmp/test/ApacheDS WebApp/WebContent/WEB-INF/classes
    [mkdir] Created dir: /tmp/test/ApacheDS WebApp/WebContent/WEB-INF/lib

copyApacheDsLibs:

BUILD FAILED
/tmp/test/ApacheDS WebApp/build.xml:27: /tmp/test/ApacheDS WebApp/C:/java/apacheds_1.5.4/lib not found.

Total time: 0 seconds
"

Following the well done documentation I created an archetype to let maven2 create a sample project similar to the one
mentioned in the zip file.
I'm able to create a new project with the archetype, build it, put the generated war into an apache-tomcat-6.0.18, run
it and get the RootDSE page shown. I'm not sure if this is all the magic and if you can get the RootDSE page you're sure
that everything else is also working well?

To get the archetype-plugin check it out from my sandbox [2] and build it (mvn install). Then you should be able to
create a new project using

mvn archetype:generate \
  -DgroupId=org.example \
  -DartifactId=myProject \
  -Dversion=1.0-SNAPSHOT \
  -DarchetypeGroupId=org.apache.directory \
  -DarchetypeArtifactId=embed-apacheds-archetype \
  -DarchetypeVersion=1.0-SNAPSHOT

Put the generate target/myProject.war into your tomcat (or whatever) and goto http://localhost:8080/myProject/RootDSE.

If you think it's ok and usefull we can move it from the sandbox to the matured projects.

Regards
Felix

[1] http://cwiki.apache.org/confluence/download/attachments/55251/ApacheDSWebApp.zip?version=1
[2] https://svn.apache.org/repos/asf/directory/sandbox/felixk/embed-apacheds-archetype
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkjsWw0ACgkQ2lZVCB08qHFg8wCdGk2mgLY0qXIID75qtz7JiucM
oEEAoJ1m4YO5IcuOj33w55t6NrQgePmp
=702i
-----END PGP SIGNATURE-----

Re: Embedding ApacheDS as a Web Application

Posted by Emmanuel Lecharny <el...@gmail.com>.
BerkOFF wrote:
> Hi,
>
> I'm using directory studio.
> When I'm trying to create new context entry I'm getting this error:
>
> Error while creating entry
> [LDAP: error code 32 - NO_SUCH_OBJECT: failed for     Add Request :
> ClientEntry
>     dn: 2.5.4.11=people
>   
I guess that your context suffix is not ou=people, but something more 
complex. Just inject the full DN instead of a part of it, it will work.

-- 
--
cordialement, regards,
Emmanuel Lécharny
www.iktek.com
directory.apache.org



Re: Embedding ApacheDS as a Web Application

Posted by BerkOFF <be...@mail.ru>.
Hi,

I'm using directory studio.
When I'm trying to create new context entry I'm getting this error:

Error while creating entry
[LDAP: error code 32 - NO_SUCH_OBJECT: failed for     Add Request :
ClientEntry
    dn: 2.5.4.11=people
    objectclass: extensibleObject
    objectclass: top
    objectclass: organizationalUnit
    ou: people
: ou=people:
org.apache.directory.shared.ldap.exception.LdapNameNotFoundException:
ou=people
	at
org.apache.directory.server.core.partition.DefaultPartitionNexus.getPartition(DefaultPartitionNexus.java:1097)
	at
org.apache.directory.server.core.partition.DefaultPartitionNexus.hasEntry(DefaultPartitionNexus.java:1019)
	at
org.apache.directory.server.core.interceptor.InterceptorChain$1.hasEntry(InterceptorChain.java:165)
	at
org.apache.directory.server.core.interceptor.InterceptorChain$Entry$1.hasEntry(InterceptorChain.java:1293)
	at
org.apache.directory.server.core.interceptor.BaseInterceptor.hasEntry(BaseInterceptor.java:159)
	at
org.apache.directory.server.core.interceptor.InterceptorChain$Entry$1.hasEntry(InterceptorChain.java:1293)
	at
org.apache.directory.server.core.interceptor.BaseInterceptor.hasEntry(BaseInterceptor.java:159)
	at
org.apache.directory.server.core.interceptor.InterceptorChain$Entry$1.hasEntry(InterceptorChain.java:1293)
	at
org.apache.directory.server.core.interceptor.BaseInterceptor.hasEntry(BaseInterceptor.java:159)
	at
org.apache.directory.server.core.interceptor.InterceptorChain$Entry$1.hasEntry(InterceptorChain.java:1293)
	at
org.apache.directory.server.core.interceptor.BaseInterceptor.hasEntry(BaseInterceptor.java:159)
	at
org.apache.directory.server.core.interceptor.InterceptorChain$Entry$1.hasEntry(InterceptorChain.java:1293)
	at
org.apache.directory.server.core.interceptor.BaseInterceptor.hasEntry(BaseInterceptor.java:159)
	at
org.apache.directory.server.core.interceptor.InterceptorChain$Entry$1.hasEntry(InterceptorChain.java:1293)
	at
org.apache.directory.server.core.interceptor.BaseInterceptor.hasEntry(BaseInterceptor.java:159)
	at
org.apache.directory.server.core.interceptor.InterceptorChain$Entry$1.hasEntry(InterceptorChain.java:1293)
	at
org.apache.directory.server.core.interceptor.BaseInterceptor.hasEntry(BaseInterceptor.java:159)
	at
org.apache.directory.server.core.interceptor.InterceptorChain$Entry$1.hasEntry(InterceptorChain.java:1293)
	at
org.apache.directory.server.core.exception.ExceptionInterceptor.add(ExceptionInterceptor.java:154)
	at
org.apache.directory.server.core.interceptor.InterceptorChain$Entry$1.add(InterceptorChain.java:1189)
	at
org.apache.directory.server.core.interceptor.BaseInterceptor.add(BaseInterceptor.java:129)
	at
org.apache.directory.server.core.interceptor.InterceptorChain$Entry$1.add(InterceptorChain.java:1189)
	at
org.apache.directory.server.core.authz.AciAuthorizationInterceptor.add(AciAuthorizationInterceptor.java:448)
	at
org.apache.directory.server.core.interceptor.InterceptorChain$Entry$1.add(InterceptorChain.java:1189)
	at
org.apache.directory.server.core.authn.AuthenticationInterceptor.add(AuthenticationInterceptor.java:213)
	at
org.apache.directory.server.core.interceptor.InterceptorChain$Entry$1.add(InterceptorChain.java:1189)
	at
org.apache.directory.server.core.normalization.NormalizationInterceptor.add(NormalizationInterceptor.java:113)
	at
org.apache.directory.server.core.interceptor.InterceptorChain.add(InterceptorChain.java:749)
	at
org.apache.directory.server.core.DefaultOperationManager.add(DefaultOperationManager.java:78)
	at
org.apache.directory.server.core.DefaultCoreSession.add(DefaultCoreSession.java:378)
	at
org.apache.directory.server.ldap.handlers.AddHandler.handleIgnoringReferrals(AddHandler.java:59)
	at
org.apache.directory.server.ldap.handlers.AddHandler.handleIgnoringReferrals(AddHandler.java:40)
	at
org.apache.directory.server.ldap.handlers.ReferralAwareRequestHandler.handleWithReferrals(ReferralAwareRequestHandler.java:483)
	at
org.apache.directory.server.ldap.handlers.ReferralAwareRequestHandler.handle(ReferralAwareRequestHandler.java:150)
	at
org.apache.directory.server.ldap.handlers.ReferralAwareRequestHandler.handle(ReferralAwareRequestHandler.java:66)
	at
org.apache.directory.server.ldap.handlers.LdapRequestHandler.messageReceived(LdapRequestHandler.java:171)
	at
org.apache.directory.server.ldap.handlers.LdapRequestHandler.messageReceived(LdapRequestHandler.java:46)
	at
org.apache.mina.handler.demux.DemuxingIoHandler.messageReceived(DemuxingIoHandler.java:141)
	at
org.apache.directory.server.ldap.LdapProtocolHandler.messageReceived(LdapProtocolHandler.java:181)
	at
org.apache.mina.common.support.AbstractIoFilterChain$TailFilter.messageReceived(AbstractIoFilterChain.java:570)
	at
org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(AbstractIoFilterChain.java:299)
	at
org.apache.mina.common.support.AbstractIoFilterChain.access$1100(AbstractIoFilterChain.java:53)
	at
org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceived(AbstractIoFilterChain.java:648)
	at
org.apache.mina.filter.codec.support.SimpleProtocolDecoderOutput.flush(SimpleProtocolDecoderOutput.java:58)
	at
org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:180)
	at
org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(AbstractIoFilterChain.java:299)
	at
org.apache.mina.common.support.AbstractIoFilterChain.access$1100(AbstractIoFilterChain.java:53)
	at
org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceived(AbstractIoFilterChain.java:648)
	at
org.apache.mina.filter.executor.ExecutorFilter.processEvent(ExecutorFilter.java:220)
	at
org.apache.mina.filter.executor.ExecutorFilter$ProcessEventsRunnable.run(ExecutorFilter.java:264)
	at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:619)
]
  [LDAP: error code 32 - NO_SUCH_OBJECT: failed for     Add Request :
ClientEntry
    dn: 2.5.4.11=people
    objectclass: extensibleObject
    objectclass: top
    objectclass: organizationalUnit
    ou: people
: ou=people:
org.apache.directory.shared.ldap.exception.LdapNameNotFoundException:
ou=people
	at
org.apache.directory.server.core.partition.DefaultPartitionNexus.getPartition(DefaultPartitionNexus.java:1097)
	at
org.apache.directory.server.core.partition.DefaultPartitionNexus.hasEntry(DefaultPartitionNexus.java:1019)
	at
org.apache.directory.server.core.interceptor.InterceptorChain$1.hasEntry(InterceptorChain.java:165)
	at
org.apache.directory.server.core.interceptor.InterceptorChain$Entry$1.hasEntry(InterceptorChain.java:1293)
	at
org.apache.directory.server.core.interceptor.BaseInterceptor.hasEntry(BaseInterceptor.java:159)
	at
org.apache.directory.server.core.interceptor.InterceptorChain$Entry$1.hasEntry(InterceptorChain.java:1293)
	at
org.apache.directory.server.core.interceptor.BaseInterceptor.hasEntry(BaseInterceptor.java:159)
	at
org.apache.directory.server.core.interceptor.InterceptorChain$Entry$1.hasEntry(InterceptorChain.java:1293)
	at
org.apache.directory.server.core.interceptor.BaseInterceptor.hasEntry(BaseInterceptor.java:159)
	at
org.apache.directory.server.core.interceptor.InterceptorChain$Entry$1.hasEntry(InterceptorChain.java:1293)
	at
org.apache.directory.server.core.interceptor.BaseInterceptor.hasEntry(BaseInterceptor.java:159)
	at
org.apache.directory.server.core.interceptor.InterceptorChain$Entry$1.hasEntry(InterceptorChain.java:1293)
	at
org.apache.directory.server.core.interceptor.BaseInterceptor.hasEntry(BaseInterceptor.java:159)
	at
org.apache.directory.server.core.interceptor.InterceptorChain$Entry$1.hasEntry(InterceptorChain.java:1293)
	at
org.apache.directory.server.core.interceptor.BaseInterceptor.hasEntry(BaseInterceptor.java:159)
	at
org.apache.directory.server.core.interceptor.InterceptorChain$Entry$1.hasEntry(InterceptorChain.java:1293)
	at
org.apache.directory.server.core.interceptor.BaseInterceptor.hasEntry(BaseInterceptor.java:159)
	at
org.apache.directory.server.core.interceptor.InterceptorChain$Entry$1.hasEntry(InterceptorChain.java:1293)
	at
org.apache.directory.server.core.exception.ExceptionInterceptor.add(ExceptionInterceptor.java:154)
	at
org.apache.directory.server.core.interceptor.InterceptorChain$Entry$1.add(InterceptorChain.java:1189)
	at
org.apache.directory.server.core.interceptor.BaseInterceptor.add(BaseInterceptor.java:129)
	at
org.apache.directory.server.core.interceptor.InterceptorChain$Entry$1.add(InterceptorChain.java:1189)
	at
org.apache.directory.server.core.authz.AciAuthorizationInterceptor.add(AciAuthorizationInterceptor.java:448)
	at
org.apache.directory.server.core.interceptor.InterceptorChain$Entry$1.add(InterceptorChain.java:1189)
	at
org.apache.directory.server.core.authn.AuthenticationInterceptor.add(AuthenticationInterceptor.java:213)
	at
org.apache.directory.server.core.interceptor.InterceptorChain$Entry$1.add(InterceptorChain.java:1189)
	at
org.apache.directory.server.core.normalization.NormalizationInterceptor.add(NormalizationInterceptor.java:113)
	at
org.apache.directory.server.core.interceptor.InterceptorChain.add(InterceptorChain.java:749)
	at
org.apache.directory.server.core.DefaultOperationManager.add(DefaultOperationManager.java:78)
	at
org.apache.directory.server.core.DefaultCoreSession.add(DefaultCoreSession.java:378)
	at
org.apache.directory.server.ldap.handlers.AddHandler.handleIgnoringReferrals(AddHandler.java:59)
	at
org.apache.directory.server.ldap.handlers.AddHandler.handleIgnoringReferrals(AddHandler.java:40)
	at
org.apache.directory.server.ldap.handlers.ReferralAwareRequestHandler.handleWithReferrals(ReferralAwareRequestHandler.java:483)
	at
org.apache.directory.server.ldap.handlers.ReferralAwareRequestHandler.handle(ReferralAwareRequestHandler.java:150)
	at
org.apache.directory.server.ldap.handlers.ReferralAwareRequestHandler.handle(ReferralAwareRequestHandler.java:66)
	at
org.apache.directory.server.ldap.handlers.LdapRequestHandler.messageReceived(LdapRequestHandler.java:171)
	at
org.apache.directory.server.ldap.handlers.LdapRequestHandler.messageReceived(LdapRequestHandler.java:46)
	at
org.apache.mina.handler.demux.DemuxingIoHandler.messageReceived(DemuxingIoHandler.java:141)
	at
org.apache.directory.server.ldap.LdapProtocolHandler.messageReceived(LdapProtocolHandler.java:181)
	at
org.apache.mina.common.support.AbstractIoFilterChain$TailFilter.messageReceived(AbstractIoFilterChain.java:570)
	at
org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(AbstractIoFilterChain.java:299)
	at
org.apache.mina.common.support.AbstractIoFilterChain.access$1100(AbstractIoFilterChain.java:53)
	at
org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceived(AbstractIoFilterChain.java:648)
	at
org.apache.mina.filter.codec.support.SimpleProtocolDecoderOutput.flush(SimpleProtocolDecoderOutput.java:58)
	at
org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:180)
	at
org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(AbstractIoFilterChain.java:299)
	at
org.apache.mina.common.support.AbstractIoFilterChain.access$1100(AbstractIoFilterChain.java:53)
	at
org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceived(AbstractIoFilterChain.java:648)
	at
org.apache.mina.filter.executor.ExecutorFilter.processEvent(ExecutorFilter.java:220)
	at
org.apache.mina.filter.executor.ExecutorFilter$ProcessEventsRunnable.run(ExecutorFilter.java:264)
	at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:619)
]



Emmanuel Lecharny-3 wrote:
> 
> BerkOFF wrote:
>> Hi All, 
>> I've just tried that example and face serous problem.
>> The web app is deploying and server starting without any problem. I'm
>> able
>> to connect to the server and fetch data from it. However I'm unable to
>> modify existing data and populate new one. I just getting LDAP exception
>> OBJECT_NOT_FOUND. Could you please suggest me anything?
>>   
> Which version ? Can you provide the log you get ?
> 
> (Blind guess : you are using ADS 1.5.4, and you are trying to inject 
> some new data into a partiton like dc=example,dc=org, without having 
> create the associated context entry. In this case, you have to inject a 
> first entry withing the partition suffix)
>> Thanks in advance,
>> Sergey.
>>   
> 
> 
> -- 
> --
> cordialement, regards,
> Emmanuel Lécharny
> www.iktek.com
> directory.apache.org
> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Embedding-ApacheDS-as-a-Web-Application-tp19873402p20910940.html
Sent from the Apache Directory Project mailing list archive at Nabble.com.


Re: Embedding ApacheDS as a Web Application

Posted by Emmanuel Lecharny <el...@gmail.com>.
BerkOFF wrote:
> Hi All, 
> I've just tried that example and face serous problem.
> The web app is deploying and server starting without any problem. I'm able
> to connect to the server and fetch data from it. However I'm unable to
> modify existing data and populate new one. I just getting LDAP exception
> OBJECT_NOT_FOUND. Could you please suggest me anything?
>   
Which version ? Can you provide the log you get ?

(Blind guess : you are using ADS 1.5.4, and you are trying to inject 
some new data into a partiton like dc=example,dc=org, without having 
create the associated context entry. In this case, you have to inject a 
first entry withing the partition suffix)
> Thanks in advance,
> Sergey.
>   


-- 
--
cordialement, regards,
Emmanuel Lécharny
www.iktek.com
directory.apache.org



Re: Embedding ApacheDS as a Web Application

Posted by BerkOFF <be...@mail.ru>.
Hi All, 
I've just tried that example and face serous problem.
The web app is deploying and server starting without any problem. I'm able
to connect to the server and fetch data from it. However I'm unable to
modify existing data and populate new one. I just getting LDAP exception
OBJECT_NOT_FOUND. Could you please suggest me anything?

Thanks in advance,
Sergey.
-- 
View this message in context: http://www.nabble.com/Embedding-ApacheDS-as-a-Web-Application-tp19873402p20905120.html
Sent from the Apache Directory Project mailing list archive at Nabble.com.


Re: Embedding ApacheDS as a Web Application

Posted by Felix Knecht <fe...@apache.org>.
Any comments?

Felix Knecht schrieb:
> Hi all
> Hi Stefan
> 
> I tried to run the example [1] from the page on a linux box. It didn't worked, because there are some hardcoded
> (Windows) paths in the build.xml:
> 
> "
> felix@pcfelix /tmp/test/ApacheDS WebApp $ ant
> Buildfile: build.xml
> 
> prepare:
>     [mkdir] Created dir: /tmp/test/ApacheDS WebApp/WebContent/WEB-INF/classes
>     [mkdir] Created dir: /tmp/test/ApacheDS WebApp/WebContent/WEB-INF/lib
> 
> copyApacheDsLibs:
> 
> BUILD FAILED
> /tmp/test/ApacheDS WebApp/build.xml:27: /tmp/test/ApacheDS WebApp/C:/java/apacheds_1.5.4/lib not found.
> 
> Total time: 0 seconds
> "
> 
> Following the well done documentation I created an archetype to let maven2 create a sample project similar to the one
> mentioned in the zip file.
> I'm able to create a new project with the archetype, build it, put the generated war into an apache-tomcat-6.0.18, run
> it and get the RootDSE page shown. I'm not sure if this is all the magic and if you can get the RootDSE page you're sure
> that everything else is also working well?
> 
> To get the archetype-plugin check it out from my sandbox [2] and build it (mvn install). Then you should be able to
> create a new project using
> 
> mvn archetype:generate \
>   -DgroupId=org.example \
>   -DartifactId=myProject \
>   -Dversion=1.0-SNAPSHOT \
>   -DarchetypeGroupId=org.apache.directory \
>   -DarchetypeArtifactId=embed-apacheds-archetype \
>   -DarchetypeVersion=1.0-SNAPSHOT
> 
> Put the generate target/myProject.war into your tomcat (or whatever) and goto http://localhost:8080/myProject/RootDSE.
> 
> If you think it's ok and usefull we can move it from the sandbox to the matured projects.
> 
> Regards
> Felix
> 
> [1] http://cwiki.apache.org/confluence/download/attachments/55251/ApacheDSWebApp.zip?version=1
> [2] https://svn.apache.org/repos/asf/directory/sandbox/felixk/embed-apacheds-archetype

Re: Missing location for Samples [was Embedding ApacheDS as a Web Application]

Posted by Felix Knecht <fe...@apache.org>.
Felix Knecht schrieb:
> Emmanuel Lecharny schrieb:
>   
>> {svn}/directory
>>  samples
>>    branches
>>    tags
>>    trunk
>>
>> should be ok. Do we need the Archetype sub-level ?
>>
>> (I think that sample-a, sample-b are under trunk ?)
>>     
> I'm also fine with this. Just one question/remark: archetypes can/should
> be released. So this would look then like
> samples
>   trunk
>     apacheds-webapp-archetype
>     sample-a
>     sample
>   tags/apacheds-webapp-archetype/1.0/  (or)
>   tags/1.0/apacheds-webapp-archetype/ (or)
>   tags/apachds-webapp-archetype-1.0/
>
> Or do we consider archetypes just like 'normal' samples which are never
> released and deploy them just as snapshot on the CI server?
>   
Or we just forget about archetypes and just pu in the sample.
> Felix
>
>   


Re: Missing location for Samples [was Embedding ApacheDS as a Web Application]

Posted by Felix Knecht <fe...@apache.org>.
Emmanuel Lecharny schrieb:
> {svn}/directory
>  samples
>    branches
>    tags
>    trunk
>
> should be ok. Do we need the Archetype sub-level ?
>
> (I think that sample-a, sample-b are under trunk ?)
I'm also fine with this. Just one question/remark: archetypes can/should
be released. So this would look then like
samples
  trunk
    apacheds-webapp-archetype
    sample-a
    sample
  tags/apacheds-webapp-archetype/1.0/  (or)
  tags/1.0/apacheds-webapp-archetype/ (or)
  tags/apachds-webapp-archetype-1.0/

Or do we consider archetypes just like 'normal' samples which are never
released and deploy them just as snapshot on the CI server?

Felix

Re: Missing location for Samples [was Embedding ApacheDS as a Web Application]

Posted by Emmanuel Lecharny <el...@gmail.com>.
Felix Knecht wrote:
> I haven't found a place with such samples already existing in the svn.
> Therefore I suggest to create a new project with the following sturcture
> where we can store our samples/archetypes/...
>
> {svn}\directories
>   samples
>     archetypes
>       branches
>       tags
>       trunk
>     sample-a
>     sample-b
>
> WDOT?
>
>   
{svn}/directory
  samples
    branches
    tags
    trunk

should be ok. Do we need the Archetype sub-level ?

(I think that sample-a, sample-b are under trunk ?)

-- 
--
cordialement, regards,
Emmanuel Lécharny
www.iktek.com
directory.apache.org



Missing location for Samples [was Embedding ApacheDS as a Web Application]

Posted by Felix Knecht <fe...@apache.org>.
I haven't found a place with such samples already existing in the svn.
Therefore I suggest to create a new project with the following sturcture
where we can store our samples/archetypes/...

{svn}\directories
  samples
    archetypes
      branches
      tags
      trunk
    sample-a
    sample-b

WDOT?

Felix


Stefan Zoerner schrieb:
> Hi Felix!
>
> Felix Knecht wrote:
>
>> This is easy to explain:
>> ATM the archetype plugin sin't deployed anywhere, so it's not
>> downloadable. That's why you need to checkout and build
>> the archetype plugin first (and then you have it in your local maven
>> repository).
>> If once a snapshot or release is deployed somewhere you can add this
>> location as well to mvn archetype.... and that's it.
>> -> Run one maven command and you have created a new maven project
>> containing a sample how to use embedded ApacheDS
>> (corresponds to download and unzip your sample)
>> -> Change into the project and run mvn install (corresponds to run
>> ant script)
>> -> in both cases you should get a war file you can deploy where ever
>> you want
>>
>> At least I think your sample works like this.
>
> Ah. I think I got it. If it archetype plugin is deployed somewhere
> there would only one step (the second) for an end user in order to get
> the sample built.
>
> This sounds really good to me.
>
> I thought about changing the same "embed-apacheds-archetype" to
> something with either "sample" or "webapp" in it in order to reflect
> that this is not the only way to embed it, but only one (simple) option.
>
> But if it located in svn somewhere beneath a samples directory, it
> would be sufficient.
>
> Are all these parameters
>
> mvn archetype:generate -DgroupId=org.example \
>    -DartifactId=myProject \
>    -Dversion=1.0-SNAPSHOT \
>    -DarchetypeGroupId=org.apache.directory \
>    -DarchetypeArtifactId=embed-apacheds-archetype \
>    -DarchetypeVersion=1.0-SNAPSHOT
>
> mandatory or is it possible to provide defaults for some of them (for
> instance groupId, artifactId) in order to make the example even more
> easy to build?
>>
>> I've absolutely no idea. I just saw your sample and thought that we
>> could migrate this also into a mvn build as all the
>> directory projects are now build with maven (finally studio does
>> also, thanks to Pierre-Arnaud).
>
> Good move. Thanks for doing that!
>
>>> The funny thing: The example was quite often cited in the mailing list.
>>> This is why I tried to update it ...
>>
>> Me too ;-)
>>
>>> I would have favored a sub-project for samples, in which the ApacheDS
>>> embedded in a WebApp is one of them. What do others think?
>>
>> Do we have other samples yet (sorry for this inocent question)?
>> I think if the samples are maven projects creating archetypes should
>> be the way to go.
>> http://maven.apache.org/guides/introduction/introduction-to-archetypes.html
>>
>
> There is some stuff for adding elements to the schema, but it does not
> contain code programmed against the ApacheDS API (only JNDI).
>
> http://directory.apache.org/apacheds/1.5/add-your-first-elements-to-the-schema.html
>
>
> But it would be nice to have the LDIF files somewhere in svn as well.
> It would be great to have more examples like the web app one. At least
> one for writing an extended operation, one for an intercepter, one for
> a partition (very ambitious ...). Plenty of plans and not enough time :-(
>
> Greetings from Hamburg,
>     Stefan
>
>


Re: Embedding ApacheDS as a Web Application

Posted by Felix Knecht <fe...@apache.org>.
Pierre-Arnaud Marcelot schrieb:
> Hi Felix,
> 
> I tried what you said and I'm getting a build failure.

No. It works for me. But it looks like it didn't download the archetype artifact when looking at your log.
Can you access it via browser
http://vm094.oxylos.org/mirror-maven2//org/apache/directory/samples/apacheds-webapp/1.0-SNAPSHOT/apacheds-webapp-1.0-SNAPSHOT.jar
?

felix@donar /tmp $ mvn archetype:generate -DarchetypeCatalog=http://vm094.oxylos.org/
-DarchetypeRepository=http://vm094.oxylos.org/mirror-maven2/
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'archetype'.
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Default Project
[INFO]    task-segment: [archetype:generate] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] Preparing archetype:generate
[INFO] No goals needed for project - skipping
[INFO] Setting property: classpath.resource.loader.class => 'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'.
[INFO] Setting property: velocimacro.messages.on => 'false'.
[INFO] Setting property: resource.loader => 'classpath'.
[INFO] Setting property: resource.manager.logwhenfound => 'false'.
[INFO] [archetype:generate]
[INFO] Generating project in Interactive mode
[INFO] No archetype defined. Using maven-archetype-quickstart (org.apache.maven.archetypes:maven-archetype-quickstart:1.0)
Choose archetype:
1: remote -> apacheds-webapp (Creates ApacheDS as an embedded Web Application)
Choose a number:  (1): 1
[INFO] snapshot org.apache.directory.samples:apacheds-webapp:1.0-SNAPSHOT: checking for updates from apacheds-webapp-repo
Downloading:
http://vm094.oxylos.org/mirror-maven2//org/apache/directory/samples/apacheds-webapp/1.0-SNAPSHOT/apacheds-webapp-1.0-SNAPSHOT.jar
12K downloaded
Confirm properties configuration:
groupId: org.example
artifactId: myProject
version: 1.0.0-SNAPSHOT
package: org.example
 Y: :
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9 seconds
[INFO] Finished at: Tue Oct 21 17:03:39 CEST 2008
[INFO] Final Memory: 28M/64M
[INFO] ------------------------------------------------------------------------

HTH
Felix

> 
> Here's the log:
> =========================================================
> MacBookPro:Apache pajbam$ mvn archetype:generate
> -DarchetypeCatalog=http://vm094.oxylos.org/
> -DarchetypeRepository=http://vm094.oxylos.org/mirror-maven2/
> [INFO] Scanning for projects...
> [INFO] Searching repository for plugin with prefix: 'archetype'.
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Building Maven Default Project
> [INFO]    task-segment: [archetype:generate] (aggregator-style)
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Preparing archetype:generate
> [INFO] No goals needed for project - skipping
> [INFO] Setting property: classpath.resource.loader.class =>
> 'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'.
> [INFO] Setting property: velocimacro.messages.on => 'false'.
> [INFO] Setting property: resource.loader => 'classpath'.
> [INFO] Setting property: resource.manager.logwhenfound => 'false'.
> [INFO] [archetype:generate]
> [INFO] Generating project in Interactive mode
> [INFO] No archetype defined. Using maven-archetype-quickstart
> (org.apache.maven.archetypes:maven-archetype-quickstart:1.0)
> Choose archetype:
> 1: http://vm094.oxylos.org/ -> apacheds-webapp (Creates ApacheDS as an
> embedded Web Application)
> Choose a number:  (1): 1
> [INFO] snapshot
> org.apache.directory.samples:apacheds-webapp:1.0-SNAPSHOT: checking for
> updates from apacheds-webapp-repo
> Downloading:
> http://vm094.oxylos.org/org/apache/directory/samples/apacheds-webapp/1.0-SNAPSHOT/apacheds-webapp-1.0-SNAPSHOT.jar

Here should be the download ...
"12K downloaded"

> [INFO]
> ------------------------------------------------------------------------
> [ERROR] BUILD FAILURE
> [INFO]
> ------------------------------------------------------------------------
> [INFO] The desired archetype does not exist
> (org.apache.directory.samples:apacheds-webapp:1.0-SNAPSHOT)
> [INFO]
> ------------------------------------------------------------------------
> [INFO] For more information, run Maven with the -e switch
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Total time: 6 seconds
> [INFO] Finished at: Tue Oct 21 16:26:07 CEST 2008
> [INFO] Final Memory: 7M/14M
> [INFO]
> ------------------------------------------------------------------------
> =========================================================
> 
> Any idea what the problem is ?
> 
> Thanks,
> Pierre-Arnaud
> 
> On Mon, Oct 20, 2008 at 4:38 PM, Felix Knecht <felixk@apache.org
> <ma...@apache.org>> wrote:
> 
>     Hi Stefan
>     > I thought about changing the same "embed-apacheds-archetype" to
>     > something with either "sample" or "webapp" in it in order to reflect
>     > that this is not the only way to embed it, but only one (simple)
>     option.
>     >
>     > But if it located in svn somewhere beneath a samples directory, it
>     > would be sufficient.
>     >
>     > Are all these parameters
>     >
>     > mvn archetype:generate -DgroupId=org.example \
>     >    -DartifactId=myProject \
>     >    -Dversion=1.0-SNAPSHOT \
>     >    -DarchetypeGroupId=org.apache.directory \
>     >    -DarchetypeArtifactId=embed-apacheds-archetype \
>     >    -DarchetypeVersion=1.0-SNAPSHOT
>     >
>     > mandatory or is it possible to provide defaults for some of them (for
>     > instance groupId, artifactId) in order to make the example even more
>     > easy to build?
> 
>     The archetype is now on the CI server. You can create a new project and
>     run it with following steps:
> 
>     mvn archetype:generate -DarchetypeCatalog=http://vm094.oxylos.org/
>     -DarchetypeRepository=http://vm094.oxylos.org/mirror-maven2/
>     <http://vm094.oxylos.org/-DarchetypeRepository=http://vm094.oxylos.org/mirror-maven2/>
>      (choose '1' and hit <Enter> for all other questions)
>     cd myProject
>     mvn jetty:run
> 
>     and your done.
>     You can point your browser to http://localhost:8080/ApacheDS/RootDse to
>     see your servlet working.
> 
> 
>     The 2 properties -Darchetype... are still needed because the archetype
>     isn't yet registered in the main archetype-catalog for maven and because
>     the archetype artifact isn't released on repo1.maven.org
>     <http://repo1.maven.org>.
> 
>     Regards
>     Felix
> 
> 


Re: Embedding ApacheDS as a Web Application

Posted by Pierre-Arnaud Marcelot <pa...@marcelot.net>.
Hi Felix,

I tried what you said and I'm getting a build failure.

Here's the log:
=========================================================
MacBookPro:Apache pajbam$ mvn archetype:generate -DarchetypeCatalog=
http://vm094.oxylos.org/ -DarchetypeRepository=
http://vm094.oxylos.org/mirror-maven2/
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'archetype'.
[INFO]
------------------------------------------------------------------------
[INFO] Building Maven Default Project
[INFO]    task-segment: [archetype:generate] (aggregator-style)
[INFO]
------------------------------------------------------------------------
[INFO] Preparing archetype:generate
[INFO] No goals needed for project - skipping
[INFO] Setting property: classpath.resource.loader.class =>
'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'.
[INFO] Setting property: velocimacro.messages.on => 'false'.
[INFO] Setting property: resource.loader => 'classpath'.
[INFO] Setting property: resource.manager.logwhenfound => 'false'.
[INFO] [archetype:generate]
[INFO] Generating project in Interactive mode
[INFO] No archetype defined. Using maven-archetype-quickstart
(org.apache.maven.archetypes:maven-archetype-quickstart:1.0)
Choose archetype:
1: http://vm094.oxylos.org/ -> apacheds-webapp (Creates ApacheDS as an
embedded Web Application)
Choose a number:  (1): 1
[INFO] snapshot org.apache.directory.samples:apacheds-webapp:1.0-SNAPSHOT:
checking for updates from apacheds-webapp-repo
Downloading:
http://vm094.oxylos.org/org/apache/directory/samples/apacheds-webapp/1.0-SNAPSHOT/apacheds-webapp-1.0-SNAPSHOT.jar
[INFO]
------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO]
------------------------------------------------------------------------
[INFO] The desired archetype does not exist
(org.apache.directory.samples:apacheds-webapp:1.0-SNAPSHOT)
[INFO]
------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 6 seconds
[INFO] Finished at: Tue Oct 21 16:26:07 CEST 2008
[INFO] Final Memory: 7M/14M
[INFO]
------------------------------------------------------------------------
=========================================================

Any idea what the problem is ?

Thanks,
Pierre-Arnaud

On Mon, Oct 20, 2008 at 4:38 PM, Felix Knecht <fe...@apache.org> wrote:

> Hi Stefan
> > I thought about changing the same "embed-apacheds-archetype" to
> > something with either "sample" or "webapp" in it in order to reflect
> > that this is not the only way to embed it, but only one (simple) option.
> >
> > But if it located in svn somewhere beneath a samples directory, it
> > would be sufficient.
> >
> > Are all these parameters
> >
> > mvn archetype:generate -DgroupId=org.example \
> >    -DartifactId=myProject \
> >    -Dversion=1.0-SNAPSHOT \
> >    -DarchetypeGroupId=org.apache.directory \
> >    -DarchetypeArtifactId=embed-apacheds-archetype \
> >    -DarchetypeVersion=1.0-SNAPSHOT
> >
> > mandatory or is it possible to provide defaults for some of them (for
> > instance groupId, artifactId) in order to make the example even more
> > easy to build?
>
> The archetype is now on the CI server. You can create a new project and
> run it with following steps:
>
> mvn archetype:generate -DarchetypeCatalog=http://vm094.oxylos.org/
> -DarchetypeRepository=http://vm094.oxylos.org/mirror-maven2/<http://vm094.oxylos.org/-DarchetypeRepository=http://vm094.oxylos.org/mirror-maven2/>
>  (choose '1' and hit <Enter> for all other questions)
> cd myProject
> mvn jetty:run
>
> and your done.
> You can point your browser to http://localhost:8080/ApacheDS/RootDse to
> see your servlet working.
>
>
> The 2 properties -Darchetype... are still needed because the archetype
> isn't yet registered in the main archetype-catalog for maven and because
> the archetype artifact isn't released on repo1.maven.org.
>
> Regards
> Felix
>
>

Re: Embedding ApacheDS as a Web Application

Posted by Felix Knecht <fe...@apache.org>.
Hi Stefan
> I thought about changing the same "embed-apacheds-archetype" to
> something with either "sample" or "webapp" in it in order to reflect
> that this is not the only way to embed it, but only one (simple) option.
>
> But if it located in svn somewhere beneath a samples directory, it
> would be sufficient.
>
> Are all these parameters
>
> mvn archetype:generate -DgroupId=org.example \
>    -DartifactId=myProject \
>    -Dversion=1.0-SNAPSHOT \
>    -DarchetypeGroupId=org.apache.directory \
>    -DarchetypeArtifactId=embed-apacheds-archetype \
>    -DarchetypeVersion=1.0-SNAPSHOT
>
> mandatory or is it possible to provide defaults for some of them (for
> instance groupId, artifactId) in order to make the example even more
> easy to build?

The archetype is now on the CI server. You can create a new project and
run it with following steps:

mvn archetype:generate -DarchetypeCatalog=http://vm094.oxylos.org/
-DarchetypeRepository=http://vm094.oxylos.org/mirror-maven2/
  (choose '1' and hit <Enter> for all other questions)
cd myProject
mvn jetty:run

and your done.
You can point your browser to http://localhost:8080/ApacheDS/RootDse to
see your servlet working.


The 2 properties -Darchetype... are still needed because the archetype
isn't yet registered in the main archetype-catalog for maven and because
the archetype artifact isn't released on repo1.maven.org.

Regards
Felix


Re: Embedding ApacheDS as a Web Application

Posted by Felix Knecht <fe...@apache.org>.
Hi Stefan

> I thought about changing the same "embed-apacheds-archetype" to
> something with either "sample" or "webapp" in it in order to reflect
> that this is not the only way to embed it, but only one (simple) option.

NP. We can call it e.g. apacheds-webapp-archetype. I wouldn't call it just 'sample' because an archetype should be a
well known expression to a maven user - at least you'll get easier hits fitting your needs when doing a search on 'maven
archteype' than doing a search on 'maven sample' :-)

> 
> But if it located in svn somewhere beneath a samples directory, it would
> be sufficient.
> 
> Are all these parameters
> 
> mvn archetype:generate -DgroupId=org.example \
>    -DartifactId=myProject \
>    -Dversion=1.0-SNAPSHOT \
>    -DarchetypeGroupId=org.apache.directory \
>    -DarchetypeArtifactId=embed-apacheds-archetype \
>    -DarchetypeVersion=1.0-SNAPSHOT
> 
> mandatory or is it possible to provide defaults for some of them (for
> instance groupId, artifactId) in order to make the example even more
> easy to build?

I think it should be possible, but don't know how yet.
All the properties starting with 'archetype' are just needed to indicate which archetype shall be used (it's like a
dependency in a pom).
If we have (and want) archetypes I'm quite sure that we can add them also to the maven archetype list (see [1]) and make
it better and easier choosable.

[1] http://maven.apache.org/plugins/maven-archetype-plugin/usage.html

>>
>> I've absolutely no idea. I just saw your sample and thought that we
>> could migrate this also into a mvn build as all the
>> directory projects are now build with maven (finally studio does also,
>> thanks to Pierre-Arnaud).
> 
> Good move. Thanks for doing that!

Your welcome :-)

>>> I would have favored a sub-project for samples, in which the ApacheDS
>>> embedded in a WebApp is one of them. What do others think?

Not sure IIUC but I wouldn't pollute the apacheds project with sample sub-projects - it's containing already enough
sub-projects. I'd rather create a new module directory/[archetypes|samples]/{branches,tags,trunk} for such stuff.
Archetypes should be released whereas samples have no need at all to be release.

>>
>> Do we have other samples yet (sorry for this inocent question)?
>> I think if the samples are maven projects creating archetypes should
>> be the way to go.
>> http://maven.apache.org/guides/introduction/introduction-to-archetypes.html
>>
> 
> There is some stuff for adding elements to the schema, but it does not
> contain code programmed against the ApacheDS API (only JNDI).
> 
> http://directory.apache.org/apacheds/1.5/add-your-first-elements-to-the-schema.html
> 
> 
> But it would be nice to have the LDIF files somewhere in svn as well. It
> would be great to have more examples like the web app one. At least one
> for writing an extended operation, one for an intercepter, one for a
> partition (very ambitious ...).

I'm not sure about the difference of the terms sample and archetype. Most of your sample above have to do with code.
We can add for each sample (if we can work it out) a single simple archetype containing a running apacheds just
including one sample.


> Plenty of plans and not enough time :-(

Regards
Felix


Re: Embedding ApacheDS as a Web Application

Posted by Stefan Zoerner <st...@labeo.de>.
Hi Felix!

Felix Knecht wrote:

> This is easy to explain:
> ATM the archetype plugin sin't deployed anywhere, so it's not downloadable. That's why you need to checkout and build
> the archetype plugin first (and then you have it in your local maven repository).
> If once a snapshot or release is deployed somewhere you can add this location as well to mvn archetype.... and that's it.
> -> Run one maven command and you have created a new maven project containing a sample how to use embedded ApacheDS
> (corresponds to download and unzip your sample)
> -> Change into the project and run mvn install (corresponds to run ant script)
> -> in both cases you should get a war file you can deploy where ever you want
> 
> At least I think your sample works like this.

Ah. I think I got it. If it archetype plugin is deployed somewhere there 
would only one step (the second) for an end user in order to get the 
sample built.

This sounds really good to me.

I thought about changing the same "embed-apacheds-archetype" to 
something with either "sample" or "webapp" in it in order to reflect 
that this is not the only way to embed it, but only one (simple) option.

But if it located in svn somewhere beneath a samples directory, it would 
be sufficient.

Are all these parameters

mvn archetype:generate -DgroupId=org.example \
    -DartifactId=myProject \
    -Dversion=1.0-SNAPSHOT \
    -DarchetypeGroupId=org.apache.directory \
    -DarchetypeArtifactId=embed-apacheds-archetype \
    -DarchetypeVersion=1.0-SNAPSHOT

mandatory or is it possible to provide defaults for some of them (for 
instance groupId, artifactId) in order to make the example even more 
easy to build?
> 
> I've absolutely no idea. I just saw your sample and thought that we could migrate this also into a mvn build as all the
> directory projects are now build with maven (finally studio does also, thanks to Pierre-Arnaud).

Good move. Thanks for doing that!

>> The funny thing: The example was quite often cited in the mailing list.
>> This is why I tried to update it ...
> 
> Me too ;-)
> 
>> I would have favored a sub-project for samples, in which the ApacheDS
>> embedded in a WebApp is one of them. What do others think?
> 
> Do we have other samples yet (sorry for this inocent question)?
> I think if the samples are maven projects creating archetypes should be the way to go.
> http://maven.apache.org/guides/introduction/introduction-to-archetypes.html

There is some stuff for adding elements to the schema, but it does not 
contain code programmed against the ApacheDS API (only JNDI).

http://directory.apache.org/apacheds/1.5/add-your-first-elements-to-the-schema.html

But it would be nice to have the LDIF files somewhere in svn as well. It 
would be great to have more examples like the web app one. At least one 
for writing an extended operation, one for an intercepter, one for a 
partition (very ambitious ...). Plenty of plans and not enough time :-(

Greetings from Hamburg,
     Stefan



Re: Embedding ApacheDS as a Web Application

Posted by Felix Knecht <fe...@apache.org>.
Stefan Zoerner schrieb:
> Hi Felix,
> 
> thanks for the feedback. Sorry for the late reply, I am currently
> totally overloaded.
> 
> Felix Knecht wrote:
> 
>> I tried to run the example [1] from the page on a linux box. It didn't
>> worked, because there are some hardcoded
>> (Windows) paths in the build.xml:
> 
> My fault. I thought about changing it to use ivy. But I did not had the
> time, to do this, and my maven skills are really lame. And I thought,
> mvn is overkill for simply compiling two classes and create a war file
> with some libs from it ...
> 
>> Following the well done documentation I created an archetype to let
>> maven2 create a sample project similar to the one
>> mentioned in the zip file.
> 
> Great!
> 
>> I'm able to create a new project with the archetype, build it, put the
>> generated war into an apache-tomcat-6.0.18, run
>> it and get the RootDSE page shown. I'm not sure if this is all the
>> magic and if you can get the RootDSE page you're sure
>> that everything else is also working well?
> 
> I have also run some tests with an LDAP client against the running
> webapp, and it worked fine as well. I think it is not necessary to do
> more. It is simply an example about how to embed ApacheDS somewhere, and
> the web app approach looked charmingly easy.
> 
> 
>> To get the archetype-plugin check it out from my sandbox [2] and build
>> it (mvn install). 
> 
> This worked fine.
> 
> Then you should be able to
>> create a new project using
>>
>> mvn archetype:generate \
>>   -DgroupId=org.example \
>>   -DartifactId=myProject \
>>   -Dversion=1.0-SNAPSHOT \
>>   -DarchetypeGroupId=org.apache.directory \
>>   -DarchetypeArtifactId=embed-apacheds-archetype \
>>   -DarchetypeVersion=1.0-SNAPSHOT
> 
> This worked as well. Although I am a little bit confused about the two
> steps. First I checkout the archetype-plugin and build it. Then I use
> this plugin to create a new mvn project. Afterwards I build this one as
> well. Finally, I have the web app as in the example. And I am able to
> create many other webapps with the same content as a template.

This is easy to explain:
ATM the archetype plugin sin't deployed anywhere, so it's not downloadable. That's why you need to checkout and build
the archetype plugin first (and then you have it in your local maven repository).
If once a snapshot or release is deployed somewhere you can add this location as well to mvn archetype.... and that's it.
-> Run one maven command and you have created a new maven project containing a sample how to use embedded ApacheDS
(corresponds to download and unzip your sample)
-> Change into the project and run mvn install (corresponds to run ant script)
-> in both cases you should get a war file you can deploy where ever you want

At least I think your sample works like this.

> 
> It is impressive, how it works, but I question myself, whether a simple
> maven project is perhaps more appropriate for the task.

As said it generates a maven project. I think the intention of archetypes are exactly this to generate a maven project
skeleton for a user.

> 
>> If you think it's ok and usefull we can move it from the sandbox to
> the matured projects.
> 
> 
> My goal was to have a simple example for embedding the server in the
> docs for people to get inspired. You build a tool which acts as a blue
> print for comparable web apps, which may act as a starting point.
> Question: Is it a common task to embed ApacheDS in a WebApp at all?

I've absolutely no idea. I just saw your sample and thought that we could migrate this also into a mvn build as all the
directory projects are now build with maven (finally studio does also, thanks to Pierre-Arnaud).

> 
> The funny thing: The example was quite often cited in the mailing list.
> This is why I tried to update it ...

Me too ;-)

> 
> I would have favored a sub-project for samples, in which the ApacheDS
> embedded in a WebApp is one of them. What do others think?

Do we have other samples yet (sorry for this inocent question)?
I think if the samples are maven projects creating archetypes should be the way to go.
http://maven.apache.org/guides/introduction/introduction-to-archetypes.html

If you just run 'mvn archetype:generate' you see a list of already existing and registered archetypes.

> 
> Anyway, we need a better way to build the example, in order to make it
> easier for users to let it run. 

In fact, we can add some jetty configuration to the generated project and then a user can simply create a new project
using the archetype, change into the created project and run something like 'mvn install jetty:run' and there is a
running embed-apacheds he can connect to :-)

Your mvn approach is obviously better
> than putting a zip-File without dependency resolution in the wiki. Thank
> you therefore for the excellent work you did, Felix!
> 
> Greetings from Hamburg,
>     Stefan
> 


Re: Embedding ApacheDS as a Web Application

Posted by Stefan Zoerner <st...@labeo.de>.
Hi Felix,

thanks for the feedback. Sorry for the late reply, I am currently 
totally overloaded.

Felix Knecht wrote:

> I tried to run the example [1] from the page on a linux box. It didn't worked, because there are some hardcoded
> (Windows) paths in the build.xml:

My fault. I thought about changing it to use ivy. But I did not had the 
time, to do this, and my maven skills are really lame. And I thought, 
mvn is overkill for simply compiling two classes and create a war file 
with some libs from it ...

> Following the well done documentation I created an archetype to let maven2 create a sample project similar to the one
> mentioned in the zip file.

Great!

> I'm able to create a new project with the archetype, build it, put the generated war into an apache-tomcat-6.0.18, run
> it and get the RootDSE page shown. I'm not sure if this is all the magic and if you can get the RootDSE page you're sure
> that everything else is also working well?

I have also run some tests with an LDAP client against the running 
webapp, and it worked fine as well. I think it is not necessary to do 
more. It is simply an example about how to embed ApacheDS somewhere, and 
the web app approach looked charmingly easy.


> To get the archetype-plugin check it out from my sandbox [2] and build it (mvn install). 

This worked fine.

Then you should be able to
> create a new project using
> 
> mvn archetype:generate \
>   -DgroupId=org.example \
>   -DartifactId=myProject \
>   -Dversion=1.0-SNAPSHOT \
>   -DarchetypeGroupId=org.apache.directory \
>   -DarchetypeArtifactId=embed-apacheds-archetype \
>   -DarchetypeVersion=1.0-SNAPSHOT

This worked as well. Although I am a little bit confused about the two 
steps. First I checkout the archetype-plugin and build it. Then I use 
this plugin to create a new mvn project. Afterwards I build this one as 
well. Finally, I have the web app as in the example. And I am able to 
create many other webapps with the same content as a template.

It is impressive, how it works, but I question myself, whether a simple 
maven project is perhaps more appropriate for the task.

 > If you think it's ok and usefull we can move it from the sandbox to 
the matured projects.


My goal was to have a simple example for embedding the server in the 
docs for people to get inspired. You build a tool which acts as a blue 
print for comparable web apps, which may act as a starting point. 
Question: Is it a common task to embed ApacheDS in a WebApp at all?

The funny thing: The example was quite often cited in the mailing list. 
This is why I tried to update it ...

I would have favored a sub-project for samples, in which the ApacheDS 
embedded in a WebApp is one of them. What do others think?

Anyway, we need a better way to build the example, in order to make it 
easier for users to let it run. Your mvn approach is obviously better 
than putting a zip-File without dependency resolution in the wiki. Thank 
you therefore for the excellent work you did, Felix!

Greetings from Hamburg,
     Stefan