Service OSGiJavaMail服务
我无法将电子邮件会话声明为OSGI服务。 我使用ApacheKaraf3.0.1作为容器,ApacheAries用于BlueprintJPA和JNDI增强Service OSGiJavaMail服务,service,osgi,jakarta-mail,blueprint-osgi,karaf,Service,Osgi,Jakarta Mail,Blueprint Osgi,Karaf,我无法将电子邮件会话声明为OSGI服务。 我使用ApacheKaraf3.0.1作为容器,ApacheAries用于BlueprintJPA和JNDI增强 <?xml version="1.0" encoding="UTF-8"?> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"> <bean id="mailSession" class="javax.mail.Session" in
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
<bean id="mailSession" class="javax.mail.Session" init-method="getInstance">
<property name="mail.smtp.host" value="mysmptpip"/>
<property name="mail.smtp.port" value="25"/>
</bean>
<service auto-export="interfaces" ref="mailSession">
<service-properties>
<entry key="osgi.jndi.service.name" value="java:mail/MailSession"/>
</service-properties>
</service>
</blueprint>
我在类javax.mail.Session中发现了一个类型为enable的错误,用于参数[{mail.smtp.host=mysmtppip,mail.smtp.port=25}]
有人知道应该如何解决这个问题吗
另外,我想知道如何通过ApacheBlueprint(将创建服务)将JavaMail会话声明为JNDI资源?我认为您可以提供一个配置好的邮件会话作为服务。因此,配置将集中化。BundleContext#registerService()就足够了;如果愿意,可以向服务注册添加属性,但这不是必需的。记得在服务关闭时注销它。我不同意关闭此问题。它不是基于意见的。作者只是在他的蓝图xml中有一个错误。正确的bean定义应该如下所示:mymptpip25