2014-06-16 58 views
0

我正在使用JBoss作爲我的應用程序,我想在JBoss中設置自動發送電子郵件功能。請在下面找到我的JBossp-logging.xml文件的代碼:jboss 6.x:發送任何類型的異常時發送電子郵件

<log4j-appender name="SMTP" class="org.apache.log4j.net.SMTPAppender"> 
<error-manager> 
     <only-once/> 
    </error-manager> 

    <level name="ERROR"/> 

    <properties> 
     <param name="SMTPHost" value="smtp.test.com" /> 
     <param name="From" value="[email protected]" /> 
     <param name="To" value="[email protected]" /> 
     <param name="Subject" value="Testing Log4j mail notification" /> 
     <property name="bufferSize">50</property> 
    </properties> 

    <formatter> 
     <pattern-formatter pattern="%d %-5p [%c] (%t) %m%n"/> 
    </formatter> 
</log4j-appender> 

當我啓動JBoss服務器,我收到以下錯誤添加此之後:

15:19:15,149 ERROR [AbstractKernelController] Error installing to Parse: name=vfs:///D:/2.0.10branch/platformV2/jboss-2.0.10/server/default/deploy/jboss-logging.xml state=PreParse mode=Manual requiredState=Parse: org.jboss.deployers.spi.DeploymentException: Error creating managed object for vfs:///D:/2.0.10branch/platformV2/jboss-2.0.10/server/default/deploy/jboss-logging.xml 
at org.jboss.deployers.spi.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:49) [:2.2.2.GA] 
at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.createMetaData(AbstractParsingDeployerWithOutput.java:383) [:2.2.2.GA] 
at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.createMetaData(AbstractParsingDeployerWithOutput.java:343) [:2.2.2.GA] 
at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.createMetaData(AbstractParsingDeployerWithOutput.java:315) [:2.2.2.GA] 
at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.deploy(AbstractParsingDeployerWithOutput.java:255) [:2.2.2.GA] 
at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:179) [:2.2.2.GA] 
at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1832) [:2.2.2.GA] 
at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1550) [:2.2.2.GA] 
at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1491) [:2.2.2.GA] 
at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:379) [jboss-dependency.jar:2.2.0.SP2] 
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:2044) [jboss-dependency.jar:2.2.0.SP2] 
at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:1083) [jboss-dependency.jar:2.2.0.SP2] 
at org.jboss.dependency.plugins.AbstractController.executeOrIncrementStateDirectly(AbstractController.java:1322) [jboss-dependency.jar:2.2.0.SP2] 
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1246) [jboss-dependency.jar:2.2.0.SP2] 
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1139) [jboss-dependency.jar:2.2.0.SP2] 
at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:939) [jboss-dependency.jar:2.2.0.SP2] 
at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:654) [jboss-dependency.jar:2.2.0.SP2] 
at org.jboss.deployers.plugins.deployers.DeployersImpl.change(DeployersImpl.java:1983) [:2.2.2.GA] 
at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:1076) [:2.2.2.GA] 
at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:679) [:2.2.2.GA] 
at org.jboss.system.server.profileservice.deployers.MainDeployerPlugin.process(MainDeployerPlugin.java:106) [:6.1.0.Final] 
at org.jboss.profileservice.dependency.ProfileControllerContext$DelegateDeployer.process(ProfileControllerContext.java:143) [:0.2.2] 
at org.jboss.profileservice.dependency.ProfileDeployAction.deploy(ProfileDeployAction.java:151) [:0.2.2] 
at org.jboss.profileservice.dependency.ProfileDeployAction.installActionInternal(ProfileDeployAction.java:94) [:0.2.2] 
at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:54) [jboss-kernel.jar:2.2.0.SP2] 
at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:42) [jboss-kernel.jar:2.2.0.SP2] 
at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62) [jboss-dependency.jar:2.2.0.SP2] 
at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71) [jboss-dependency.jar:2.2.0.SP2] 
at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51) [jboss-dependency.jar:2.2.0.SP2] 
at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:379) [jboss-dependency.jar:2.2.0.SP2] 
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:2044) [jboss-dependency.jar:2.2.0.SP2] 
at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:1083) [jboss-dependency.jar:2.2.0.SP2] 
at org.jboss.dependency.plugins.AbstractController.executeOrIncrementStateDirectly(AbstractController.java:1322) [jboss-dependency.jar:2.2.0.SP2] 
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1246) [jboss-dependency.jar:2.2.0.SP2] 
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1139) [jboss-dependency.jar:2.2.0.SP2] 
at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:939) [jboss-dependency.jar:2.2.0.SP2] 
at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:654) [jboss-dependency.jar:2.2.0.SP2] 
at org.jboss.profileservice.dependency.ProfileActivationWrapper$BasicProfileActivation.start(ProfileActivationWrapper.java:190) [:0.2.2] 
at org.jboss.profileservice.dependency.ProfileActivationWrapper.start(ProfileActivationWrapper.java:87) [:0.2.2] 
at org.jboss.profileservice.dependency.ProfileActivationService.activateProfile(ProfileActivationService.java:215) [:0.2.2] 
at org.jboss.profileservice.dependency.ProfileActivationService.activate(ProfileActivationService.java:159) [:0.2.2] 
at org.jboss.profileservice.bootstrap.AbstractProfileServiceBootstrap.activate(AbstractProfileServiceBootstrap.java:112) [:0.2.2] 
at org.jboss.profileservice.resolver.BasicResolverFactory$ProfileResolverFacade.deploy(BasicResolverFactory.java:87) [:0.2.2] 
at org.jboss.profileservice.bootstrap.AbstractProfileServiceBootstrap.start(AbstractProfileServiceBootstrap.java:91) [:0.2.2] 
at org.jboss.system.server.profileservice.bootstrap.BasicProfileServiceBootstrap.start(BasicProfileServiceBootstrap.java:132) [:6.1.0.Final] 
at org.jboss.system.server.profileservice.bootstrap.BasicProfileServiceBootstrap.start(BasicProfileServiceBootstrap.java:56) [:6.1.0.Final] 
at org.jboss.bootstrap.impl.base.server.AbstractServer.startBootstraps(AbstractServer.java:827) [jboss-bootstrap-impl-base.jar:2.1.0-alpha-6] 
at org.jboss.bootstrap.impl.base.server.AbstractServer$StartServerTask.run(AbstractServer.java:417) [jboss-bootstrap-impl-base.jar:2.1.0-alpha-6] 
at java.lang.Thread.run(Thread.java:662) [:1.6.0_30] 

Caused by: org.jboss.xb.binding.JBossXBException: Failed to parse source: vfs:///D:/2.0.10branch/platformV2/jboss-2.0.10/server/default/deploy/[email protected],52 
at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:224) [jbossxb.jar:2.0.3.GA] 
at org.jboss.xb.binding.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:178) [jbossxb.jar:2.0.3.GA] 
at org.jboss.xb.util.JBossXBHelper.parse(JBossXBHelper.java:257) [jbossxb.jar:2.0.3.GA] 
at org.jboss.xb.util.JBossXBHelper.parse(JBossXBHelper.java:231) [jbossxb.jar:2.0.3.GA] 
at org.jboss.deployers.vfs.spi.deployer.SchemaResolverDeployer.parse(SchemaResolverDeployer.java:137) [:2.2.2.GA] 
at org.jboss.deployers.vfs.spi.deployer.SchemaResolverDeployer.parse(SchemaResolverDeployer.java:121) [:2.2.2.GA] 
at org.jboss.deployers.vfs.spi.deployer.AbstractVFSParsingDeployer.parseAndInit(AbstractVFSParsingDeployer.java:352) [:2.2.2.GA] 
at org.jboss.deployers.vfs.spi.deployer.AbstractVFSParsingDeployer.parseAndInit(AbstractVFSParsingDeployer.java:334) [:2.2.2.GA] 
at org.jboss.deployers.vfs.spi.deployer.AbstractVFSParsingDeployer.parse(AbstractVFSParsingDeployer.java:251) [:2.2.2.GA] 
at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.createMetaData(AbstractParsingDeployerWithOutput.java:369) [:2.2.2.GA] 

Caused by: org.jboss.xb.binding.JBossXBRuntimeException: {urn:jboss:logging:6.0}param not found as a child of {urn:jboss:logging:6.0}properties in sequence: {urn:jboss:logging:6.0}property* 
at org.jboss.xb.binding.sunday.unmarshalling.ElementPosition.nextPosition(ElementPosition.java:199) [jbossxb.jar:2.0.3.GA] 
at org.jboss.xb.binding.sunday.unmarshalling.ElementPosition.startParticle(ElementPosition.java:475) [jbossxb.jar:2.0.3.GA] 
at org.jboss.xb.binding.sunday.unmarshalling.SundayContentHandler.startElement(SundayContentHandler.java:202) [jbossxb.jar:2.0.3.GA] 
at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.startElement(SaxJBossXBParser.java:401) [jbossxb.jar:2.0.3.GA] 
at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source) [xercesImpl.jar:6.1.0.Final] 
at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source) [xercesImpl.jar:6.1.0.Final] 
at org.apache.xerces.xinclude.XIncludeHandler.emptyElement(Unknown Source) [xercesImpl.jar:6.1.0.Final] 
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source) [xercesImpl.jar:6.1.0.Final] 
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) [xercesImpl.jar:6.1.0.Final] 
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) [xercesImpl.jar:6.1.0.Final] 
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) [xercesImpl.jar:6.1.0.Final] 
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) [xercesImpl.jar:6.1.0.Final] 
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) [xercesImpl.jar:6.1.0.Final] 
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) [xercesImpl.jar:6.1.0.Final] 
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source) [xercesImpl.jar:6.1.0.Final] 
at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:209) [jbossxb.jar:2.0.3.GA] 

請幫忙,可發送電子郵件警報啓用當異常拋出時。

回答

0

當你收到這樣的堆棧跟蹤時,你需要看看它說了什麼,如果有一個或多個「由」引發的異常,它們是什麼。這通常是問題所在。

在你的情況,例外的是:

15:19:15,149 ERROR [AbstractKernelController] Error installing to Parse: 
name=vfs:///D:/2.0.10branch/platform 
... 
Caused by: org.jboss.xb.binding.JBossXBException: Failed to parse source: 
vfs:///D:/2.0.10branch/platformV2/jboss-2.0.10/server/default/deploy/ 
[email protected],52 
... 
Caused by: org.jboss.xb.binding.JBossXBRuntimeException: {urn:jboss:logging:6.0}param 
not found as a child of {urn:jboss:logging:6.0}properties in sequence: 
{urn:jboss:logging:6.0}property* 

所以你可以看到,JBoss是無法在行103字符52來解析文件的jboss-logging.xml你可以看到,它是抱怨param找不到爲{甕:JBoss的:日誌記錄:6.0}的子properties順序:{甕:JBoss的:日誌記錄:6.0} property*

所以的jboss-logging.xml是不正確;具體而言,您不能將param元素作爲屬性元素的子元素。

+0

感謝您的回覆。 我明白,但想知道如何糾正XML文件的意思,你可以讓我知道哪個DTD/XSD文件需要更新爲此? 另外一個在互聯網上隨處可見的這種類型的結構我得到了。你能幫我解決這個問題嗎? –