Java apache commons覆盖的端口和主机
我创建了一个EclipseMaven项目,该项目将在Activti bpm中启动一个serviceTask,向给定用户发送电子邮件 我使用的是ApacheJames服务器,并将其配置为gmail,我可以通过telnet发送电子邮件,但不能使用我的服务任务 问题是我的配置被apache commons中名为Email的类覆盖。 我不明白为什么要调用这个类,我在java代码中没有使用apache.commons James配置:config.xmlJava apache commons覆盖的端口和主机,java,maven-2,apache-commons,activiti,james,Java,Maven 2,Apache Commons,Activiti,James,我创建了一个EclipseMaven项目,该项目将在Activti bpm中启动一个serviceTask,向给定用户发送电子邮件 我使用的是ApacheJames服务器,并将其配置为gmail,我可以通过telnet发送电子邮件,但不能使用我的服务任务 问题是我的配置被apache commons中名为Email的类覆盖。 我不明白为什么要调用这个类,我在java代码中没有使用apache.commons James配置:config.xml <servernames autod
<servernames autodetect="true" autodetectIP="true">
<servername>smtp.gmail.com</servername>
</servernames>
<dnsserver>
<servers>
<!--Enter ip address of your DNS server, one IP address per server -->
<!-- element. -->
<!--
<server>127.0.0.1</server>
-->
<server> 8.8.8.8 </server>
<server> 8.8.4.4 </server>
</servers>
<!-- Change autodiscover to false if you would like to turn off autodiscovery -->
<!-- and set the DNS servers manually in the <servers> section -->
<autodiscover>true</autodiscover>
<authoritative>false</authoritative>
<!-- Maximum number of entries to maintain in the DNS cache -->
<maxcachesize>50000</maxcachesize>
</dnsserver>
这是activiti.cfg.xml文件:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="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.xsd">
<bean id="processEngineConfiguration"
class="org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration" >
<!-- Database configurations -->
<property name="databaseType" value="h2" />
<property name="jdbcUrl
value="jdbc:h2:C:/Users/Alexandra/tmp/activiti;AUTO_SERVER=TRUE" />
<property name="jdbcDriver" value="org.h2.Driver" />
<property name="jdbcUsername" value="sa" />
<property name="jdbcPassword" value="" />
<!-- Database configurations -->
<property name="databaseSchemaUpdate" value="true" />
<!-- job executor configurations -->
<property name="jobExecutorActivate" value="true" />
<!-- mail server configurations -->
<property name="mailServerHost" value="smtp.gmail.com" />
<property name="mailServerPort" value="587" />
<property name="mailServerUsername" value="root" />
<property name="mailServerPassword" value="root" />
<property name="history" value="full" />
<property name="customPostDeployers">
<list>
<bean class="org.activiti.engine.impl.rules.RulesDeployer" />
</list>
</property>
</bean>
</beans>
这个问题现在已经解决了。我通过设置流程引擎的数据解决了这个问题
ProcessEngine processEngine = ProcessEngineConfiguration
.createStandaloneInMemProcessEngineConfiguration()
.setMailServerHost("smtp.gmail.com")
.setMailServerPort(587)
.setMailServerUsername("root")
.setMailServerPassword("root")
.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE)
.setMailServerUseSSL(true)
.setMailServerUseTLS(true)
.setMailServerDefaultFrom("workflowact@gmail.com")
.buildProcessEngine();
发布您的电子邮件代码,您可能还想检查James是如何配置的,因为它确实使用apache.commons(作为apache项目)。我现在已经添加了代码,希望您能够提供帮助:)
// Create Activiti process engine
ProcessEngine processEngine = ProcessEngineConfiguration
.createStandaloneInMemProcessEngineConfiguration()
.buildProcessEngine();
// Get Activiti services
RepositoryService repositoryService = processEngine.getRepositoryService();
RuntimeService runtimeService = processEngine.getRuntimeService();
// Deploy the process definition
repositoryService.createDeployment()
.addClasspathResource("risk.bpmn20.xml")
.deploy();
// Start a process instance
String procId =
runtimeService.startProcessInstanceByKey("EmailNotification").getId();
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="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.xsd">
<bean id="processEngineConfiguration"
class="org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration" >
<!-- Database configurations -->
<property name="databaseType" value="h2" />
<property name="jdbcUrl
value="jdbc:h2:C:/Users/Alexandra/tmp/activiti;AUTO_SERVER=TRUE" />
<property name="jdbcDriver" value="org.h2.Driver" />
<property name="jdbcUsername" value="sa" />
<property name="jdbcPassword" value="" />
<!-- Database configurations -->
<property name="databaseSchemaUpdate" value="true" />
<!-- job executor configurations -->
<property name="jobExecutorActivate" value="true" />
<!-- mail server configurations -->
<property name="mailServerHost" value="smtp.gmail.com" />
<property name="mailServerPort" value="587" />
<property name="mailServerUsername" value="root" />
<property name="mailServerPassword" value="root" />
<property name="history" value="full" />
<property name="customPostDeployers">
<list>
<bean class="org.activiti.engine.impl.rules.RulesDeployer" />
</list>
</property>
</bean>
</beans>
ProcessEngine processEngine = ProcessEngineConfiguration
.createStandaloneInMemProcessEngineConfiguration()
.setMailServerHost("smtp.gmail.com")
.setMailServerPort(587)
.setMailServerUsername("root")
.setMailServerPassword("root")
.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE)
.setMailServerUseSSL(true)
.setMailServerUseTLS(true)
.setMailServerDefaultFrom("workflowact@gmail.com")
.buildProcessEngine();