Hi Gerry,

I really like the idea to have schema for each conf files.
XSD will better indicate the user if he made a mistake, it will also allow the source code to validate and eventually modify the files (I'm thinking for example to management application that would regenerate the conf and reload it based on user inputs).

For now, the configuration infrastructure is implemented via a spring post processor defined in spring-beans.xml
https://svn.apache.org/repos/asf/james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/lifecycle/CommonsConfigurableBeanPostProcessor.java
https://svn.apache.org/repos/asf/james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/lifecycle/SpringConfigurationProvider.java

Each spring bean having to be configured need to implement the Configurable interface, and the configure() method will be called by the above post processors. These are not the only mechanic involved for Configurable interface, there is also some the smtp hooks.

The important point is that the developer implements the XML parsing in the configure() method. An example for the XMLDomainList:
https://svn.apache.org/repos/asf/james/server/trunk/domainlist-xml/src/main/java/org/apache/james/domainlist/xml/XMLDomainList.java

The used parsing framework is the apache hierarchical Configuration
http://commons.apache.org/configuration/userguide/howto_xml.html

It's really easy to use, but can not validate against a XSD (as far as I know).
We would need to go to JAXB (or xmlbeans) to benefit from XSD in the code.
Anyway, users editing the XML would already benefit from them.

To know how to define the XSD, there are the comments (the web site still mentions bad information, don't rely on it (I'm slowly updating them...) !!) For now, you really need to play with James to understand how to configure it and deduce the XSD. Also all constraints can not be enforced via XSD, but you can't do anything for it.

The schema place could somewhere on the james.apache.com but you can with relative path in xsi:schemaLocation="./imapserver-1.0.xsd" have local XSD files. For now, you could simply begin with the local path.

Tks,

Eric

On 7/11/2010 01:35, Gerry Matte wrote:
I can construct a schema for each file based upon the samples in CONF.
However, the comments are my only guideline as to what are the allowed settings for an XML tag.
Is there a way to find out all of the XML tags that are loaded/scanned ?
I'm still planning to download the source although I was going to get my james 3 server into production mode first.

In at least one of the james 3 CONF files (mailserver.xml) there is no mention of the tag usernames which is described in the james 3 Global Server Documentation as required. I guess my concern is that the schema will be no better than the comments contained in the XML documents themselves ...... but I guess you expected that, right ?

The other issue I need you to address is where the schema will be published on the web. The URL for the schema document is required in the xsi:schemaLocation attribute at the start of each xml document. The parent tag in the ftpd.xml configuration file for Apache FTP Server is below. We should setup and appropriate folder for James 3.0 so I can store schemas in a publically accessible location that is unique top james 3. For apache ftp the schema is at http://mina.apache.org/ftpserver/ftpserver-1.0.xsd

Gerry
ftpd.xml
<?xml version="1.0" encoding="UTF-8"?>
[snip comments]
<server xmlns="http://mina.apache.org/ftpserver/spring/v1";
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://mina.apache.org/ftpserver/spring/v1 http://mina.apache.org/ftpserver/ftpserver-1.0.xsd";
    id="myServer">

--------------------------------------------------
From: "Norman Maurer" <[email protected]>
Sent: Saturday, November 06, 2010 2:28 AM
To: "James Users List" <[email protected]>
Subject: Re: James 3.0-M2 (Build 46) now starts error free on Windows server 2003

Hi Gerry,

nice to see it worked out for you now ;) Thanks for all your help and
feedback so far it was really helpful. It would be really nice if you
could help out on the xml schema stuff. There are already a few xml
files which are "stable".

These are:
* pop3server.xml
* imapserver.xml
* smtpserver.xml
* lmtpserver.xml


So if you would like to start, just go ahead :)

Thx,
Norman


2010/11/5 Gerry Matte <[email protected]>:
Thanks Norman.
That was the final trick that allowed the server to start without exceptions
thrown.
I'll now start to test the functionality.

A couple of comments for you:
During the startup, a log entry appears that indicates an incorrect version number - possibly this is hard coded or only changes when a major release is
issued.  See line 32 of the attachment.
When the server has completed all initialisations and is ready for business a final log message to that effect would be nice (eg "James Server 3.x.y is ready"). The current last log entry (see attached) says "james.fetchmail | FetchMail Disabled" which doesn't communicate that startup is completed. Finally, when I look back on my difficulties getting to this point many of them could have been "self-caught" if all your config XML files included a schema reference AND all XML files were validated as they were loaded by James. I am willing to help build the schemas at an appropriate time but turning on validation for your XML parser would have to be your task. I appreciate that this is a potentially daunting task but the sooner we do it, the more likely that new users will be able to find/fix their own problems or at the least your support should become much easier. Just a reminder for
you to ping me when you are ready.

Gerry
--------------------------------------------------
From: "Norman" <[email protected]>
Sent: Thursday, November 04, 2010 11:13 PM
To: <[email protected]>
Subject: Re: James 3.0-M2 fails to startup on Windows server 2003

Hi Gerry,

you are right the upgrade documentation suxx (or better say it just not
exist yet).

The problem you see come from the virtualusertable.xml file. I guess you
have two table configurations active, but only one is allowed.

See:

http://svn.apache.org/viewvc/james/server/trunk/container-spring/src/main/config/james/virtualusertable.xml?view=co&content-type=text%2Fplain

#####

<!-- Configure VirtualUserTable here. -->
<!-- Only one table can be active -->

#####

Maybe we should use UPPERCASE here.

As a side note, I'm really happy with all your comments. Without feedback we wouldn't be able to catch bugs ;) Anyway its a milestone release so you sould be aware that it can have bugs, in reality every software has bugs
even "stable" releases..
I hope we can cut the next milestone soon to make it easier for brave
users (like you) to test it..

Thanks again,
Norman





Am 04.11.2010 22:06, schrieb Gerry Matte:

Ok - now with the XMLDomalist working, my startup gets much further.
However, I seem to still have problems with my SMTP server configuration. I'm assuming that the spring-beans file is not the source of the problem
anyway.

Much of my smtp server config was from comparing my 2.3.2 config file
section to the new smtpserver.xml

I've attached the run log and my smtpserver.xml

I'm trying not to be lazy in my testing - relying on you to catch my
mistakes. However, without accurate and comprehensive documentation I can't
go far (Oh - Oh .... please don't consider that a criticism).
You've been very helpful and I certainly don't mind sending all my
feedback in hopes that the next release will be more bug free.... let me
know if you want me to cut back for a while, ok ?

Gerry


From: Gerry Matte
Sent: Thursday, November 04, 2010 1:43 PM
To: James Users List
Subject: Re: James 3.0-M2 fails to startup on Windows server 2003


Thanks for catching my invalid tag in the domainlist. I believe I copied
a block from my 2.3.2 config file ......
I know it's a lot of work but perhaps your team should consider
publishing schema for each of these control files - my XML editor would have
caught the invalid tags.
(I'd be happy to help with this if you like)

Anyway, it looks to me like I would still have a problem using the JPA
Domain List, so I changed the JPA log level to TRACE and tried again.
The verbose results are attached.

I'll switch back to using a properly formatted XMLDomainList for further
testing.

Gerry


From: Gerry Matte
Sent: Thursday, November 04, 2010 1:25 PM
To: James Users List
Subject: Re: James 3.0-M2 fails to startup on Windows server 2003


I tried commenting the XML Domain List and activating JPADomainList in
the attached domainlist.xml
Still no domain names are loaded but now I also see new errors related to
JPA (I think).
Gerry
------------------- excerpt from run2 log
47  James  WARN   [main] openjpa.Runtime - An error occurred while
registering a ClassTransformer with PersistenceUnitInfo: name 'James', root URL [file:/C:/s/james-3/conf/]. The error has been consumed. To see it, set your openjpa.Runtime log level to TRACE. Load-time class transformation will
not be available.
INFO  13:45:06,406 | james.domainlist | Bean
org.apache.james.domainlist.jpa.JPADomainList started.
INFO  13:45:06,406 | james.mailserver | JAMES init...
WARN  13:45:09,390 | james.mailserver | Configured defaultDomain not
exist in DomainList, please add it ASAP!
-------------------


From: Gerry Matte
Sent: Thursday, November 04, 2010 12:22 PM
To: James Users List
Subject: James 3.0-M2 fails to startup on Windows server 2003


Hi Guys.
I downloaded the M2 SNAPSHOT (build 41) and carefully changed all conf files while watching for files that have been modified since the snapshot
was created.
I noticed that many of the files included in this build are actually
older than the files included in the M1 build (Oct 21 instead of Oct 26).
Presumably this isn't important.

I am still unable to start the server using an XML Domain List.  It
appears as if the XML Domain list is loaded empty and other modules fail to
find any domains defined.
I've attached the run log and my config files - I've also duplicated the
run log below.
Let me know if there's anything else I can do.

Gerry Matte
250-383-2466      http://www.gerrymatte.ca

Nov 4/10 12:02 PDT Server DMS1

Microsoft Windows [Version 5.2.3790]
(C) Copyright 1985-2003 Microsoft Corp.

C:\s\james-3\bin>run
--------------------
EXTRA_JVM_ARGUMENTS: -Xms128m -Xmx512m
-Djava.system.class.loader=org.apache.james.container.spring.JamesClassLoader
 -Dcom.sun.management.jmxremote=true
-Dcom.sun.management.jmxremote.ssl=false  -Dcom.
sun.management.jmxremote.access.file=../conf/jmx.access
-Dcom.sun.management.jmxremote.password.file=../conf/jmx.password
 -Dcom.sun.management.jmxremote.port=9999
-Dmail.mime.multipart.ignoremissingen
dboundary=true -Dmail.mime.multipart.ignoremissingboundaryparameter=true
 -Dmail.mime.ignoreunknownencoding=true
-Dmail.mime.uudecode.ignoreerrors=true
 -Dmail.mime.uudecode.ignoremissingbeginend=true -
Dmail.mime.multipart.allowempty=true -Dmail.mime.base64.ignoreerrors=true
 -Dmail.mime.encodeparameters=true -Dmail.mime.decodeparameters=true
-Dmail.mime.address.strict=false  -Djames.message.usememory
copy=false
--------------------
Error: Password file read access must be restricted: ../conf/jmx.password

C:\s\james-3\bin>run [after adding to line 73 the java option to disable jmxremote thentication -Dcom.sun.management.jmxremote.authenticate=false]
--------------------
EXTRA_JVM_ARGUMENTS: -Xms128m -Xmx512m
-Djava.system.class.loader=org.apache.james.container.spring.JamesClassLoader
 -Dcom.sun.management.jmxremote=true
-Dcom.sun.management.jmxremote.ssl=false  -Dcom.
sun.management.jmxremote.access.file=../conf/jmx.access
-Dcom.sun.management.jmxremote.password.file=../conf/jmx.password
 -Dcom.sun.management.jmxremote.port=9999
-Dmail.mime.multipart.ignoremissingen
dboundary=true -Dmail.mime.multipart.ignoremissingboundaryparameter=true
 -Dmail.mime.ignoreunknownencoding=true
-Dmail.mime.uudecode.ignoreerrors=true
 -Dmail.mime.uudecode.ignoremissingbeginend=true -
Dmail.mime.multipart.allowempty=true -Dmail.mime.base64.ignoreerrors=true
 -Dmail.mime.encodeparameters=true -Dmail.mime.decodeparameters=true
-Dmail.mime.address.strict=false  -Djames.message.usememory
copy=false -Dcom.sun.management.jmxremote.authenticate=false
--------------------
INFO  13:00:40,859 |
org.apache.james.container.spring.JamesServerApplicationContext | Refreshing org.apache.james.container.spring.jamesserverapplicationcont...@1db4f6f: startup date [Thu Nov 04 13:00:40 GMT-06:00 2010]; root of context hierarchy
log4j:WARN No appenders could be found for logger
(org.apache.commons.configuration.ConfigurationUtils).
log4j:WARN Please initialize the log4j system properly.
INFO  13:00:44,953 |
org.apache.james.container.spring.JamesServerApplicationContext | Bean
'configurationProvider' of type [class
org.apache.james.container.spring.lifecycle.SpringConfigurationProvider] is not eligible for getting processed by all BeanPostProcessors (for example:
not eligible for auto-proxying)
INFO  13:00:44,968 |
org.apache.james.container.spring.JamesServerApplicationContext | Bean
'logProvider' of type [class
org.apache.james.container.spring.lifecycle.SpringLogProvider] is not
eligiblefor getting processed by all BeanPostProcessors (for example: not
eligible for auto-proxying)
INFO  13:00:46,296 | james.domainlist | Set autodetect to: false
INFO  13:00:46,296 | james.domainlist | Set autodetectIP to: true
INFO  13:00:46,296 | james.domainlist | Bean
org.apache.james.domainlist.xml.XMLDomainList started.
INFO  13:00:46,312 | james.mailserver | JAMES init...
INFO  13:00:46,515 | james.domainlist | Local host is: 192.168.12.10
WARN  13:00:46,515 | james.mailserver | Configured defaultDomain not
exist in DomainList, please add it ASAP!
INFO  13:00:46,515 | james.domainlist | Local host is: 192.168.12.10
Exception in thread "main"
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'exporter' defined in class path resource [spring-beans.xml]:
Cannot resolve reference
 to bean 'smtpserver' while setting bean property 'beans' with key
[TypedStringValue: value [org.apache.james:type=server,name=smtpserver],
target type [null]]; nested exception is org.springframework
.beans.factory.BeanCreationException: Error creating bean with name
'smtpserver': Injection of resource dependencies failed; nested exception is
org.springframework.beans.factory.BeanCreationException
: Error creating bean with name 'mailserver': Invocation of init method
failed; nested exception is
org.apache.commons.configuration.ConfigurationException: No domainnames
configured
        at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
        at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)
        at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveManagedMap(BeanDefinitionValueResolver.java:378)
        at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:161)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1325)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1086)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
        at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
        at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
        at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
        at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
        at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
        at
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
        at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
        at
org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
        at
org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)
        at
org.apache.james.container.spring.JamesServerApplicationContext.<init>(JamesServerApplicationContext.java:37)
        at org.apache.james.container.spring.Main.main(Main.java:27)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'smtpserver': Injection of resource dependencies
failed; nested exception is org.springframework.beans
.factory.BeanCreationException: Error creating bean with name
'mailserver': Invocation of init method failed; nested exception is
org.apache.commons.configuration.ConfigurationException: No domainname
s configured
        at
org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:300)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1074)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
        at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
        at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
        at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
        at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
        at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322)
        ... 18 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mailserver': Invocation of init method failed;
nested exception is org.apache.commons.configuration.C
onfigurationException: No domainnames configured
        at
org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:133)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:394)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1413)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
        at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
        at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
        at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
        at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
        at
org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.autowireResource(CommonAnnotationBeanPostProcessor.java:435)
        at
org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.getResource(CommonAnnotationBeanPostProcessor.java:409)
        at
org.springframework.context.annotation.CommonAnnotationBeanPostProcessor$ResourceElement.getResourceToInject(CommonAnnotationBeanPostProcessor.java:541)
        at
org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:156)
        at
org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:84)
        at
org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:297)
        ... 26 more
Caused by: org.apache.commons.configuration.ConfigurationException: No
domainnames configured
        at
org.apache.james.JamesMailServer.initializeServernames(JamesMailServer.java:169)
        at
org.apache.james.JamesMailServer.init(JamesMailServer.java:124)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at
org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:340)
        at
org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:293)
        at
org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:130)
        ... 40 more

C:\s\james-3\bin>



--------------------------------------------------------------------------------



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



--------------------------------------------------------------------------------



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



--------------------------------------------------------------------------------



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to