我找不到apache ftp http://mina.apache.org/ftpserver/spring/v1
的spring命名空间这个链接不起作用.....什么是alternante链接..?
这里是ftpd-typical.xml
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to you under the Apache License, Version
2.0 (the "License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 Unless required by
applicable law or agreed to in writing, software distributed under the
License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the License for
the specific language governing permissions and limitations under the
License.
-->
<server xmlns="http://mina.apache.org/ftpserver/spring/v1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://mina.apache.org/ftpserver/spring/v1 http://mina.apache.org/ftpserver/ftpserver-1.0.xsd"
id="myServer">
<listeners>
<nio-listener name="default" port="2121">
<ssl>
<keystore file="./res/ftpserver.jks" password="password" />
</ssl>
</nio-listener>
</listeners>
<file-user-manager file="./res/conf/users.properties" />
<ftplets>
<ftplet name="myftplet">
<beans:bean class="ftplettest.MyFtplet"></beans:bean>
</ftplet>
</ftplets>
</server>
我收到以下错误:
C:\Apache FTP Server\ftpserver-1.0.6\apache-ftpserver-1.0.6\bin>ftpd.bat res/conf/ftpd-typical.xml
Using XML configuration file res/conf/ftpd-typical.xml...
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 30 in XML document from file [C:\Apache FTP Server\ftpserver-1.0.6\apache-ftpserver-1.0.6
\res\conf\ftpd-typical.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 30; columnNumber: 11; cvc-complex-type.2.4.a: Invalid content
was found starting with element 'ftplets'. One of '{"http://mina.apache.org/ftpserver/spring/v1":native-filesystem, "http://mina.apache.org/ftpserver/spring/v1":file
system, "http://mina.apache.org/ftpserver/spring/v1":commands, "http://mina.apache.org/ftpserver/spring/v1":messages}' is expected.
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:404)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:212)
at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:113)
at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:80)
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:123)
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:423)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:353)
at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:140)
at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:84)
at org.apache.ftpserver.main.CommandLine.getConfiguration(CommandLine.java:132)
at org.apache.ftpserver.main.CommandLine.main(CommandLine.java:56)
Caused by: org.xml.sax.SAXParseException; lineNumber: 30; columnNumber: 11; cvc-complex-type.2.4.a: Invalid content was found starting with element 'ftplets'. One of
'{"http://mina.apache.org/ftpserver/spring/v1":native-filesystem, "http://mina.apache.org/ftpserver/spring/v1":filesystem, "http://mina.apache.org/ftpserver/spring/
v1":commands, "http://mina.apache.org/ftpserver/spring/v1":messages}' is expected.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:134)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:437)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:368)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:325)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:449)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3228)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1787)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:737)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:376)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2715)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:607)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:116)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:488)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:835)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:123)
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:240)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:300)
at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:75)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:396)
... 15 more
答案 0 :(得分:0)
我在普通的java app中也遇到了同样的错误 - 不是Spring-但是我克服了一些变化。你应该小心配置文件。 (ftpd-full.xml)。如果你的java类中有一个包名,你应该写&#34; bean:class&#34;在ftpd-full.xml文件中使用您的包名称的属性。我的conf文件(ftpd-full.xml)是这样的:
<?xml version="1.0" encoding="UTF-8"?>
<server xmlns="http://mina.apache.org/ftpserver/spring/v1"
xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://mina.apache.org/ftpserver/spring/v1 http://mina.apache.org/ftpserver/ftpserver-1.0.xsd
"
id="myServer">
<listeners>
<nio-listener name="default" port="2222" implicit-ssl="false"
idle-timeout="60" >
<ssl>
<keystore file="./res/ftpserver.jks" password="password" />
</ssl>
<blacklist>1.2.3.0/16, 1.2.4.0/16, 1.2.3.4</blacklist>
</nio-listener>
</listeners>
<ftplets>
<ftplet name="ftplet1">
<beans:bean class="MyFtplet">
</beans:bean>
</ftplet>
</ftplets>
<!-- The user manager, choose one -->
<file-user-manager file="./res/conf/users.properties"
encrypt-passwords="true" />
<!-- The file system -->
<native-filesystem case-insensitive="false"
create-home="true" />
<!-- Define the available languages -->
<messages languages="en" />
</server>
也许,它也可以帮助您整理文件。 亲切的问候。