[JBoss Seam] - Recieving Mail with Seam
by mokua_ombati
Hallo,
I have been trying to create a component for recieving email.
BTW,the component for sending mail is working quite nicely.
The problem is my component is not able to receive the mails and from the logs i get :
| 2007-08-07 08:58:52,375 INFO [STDOUT] DEBUG: JavaMail version 1.4ea
| 2007-08-07 08:58:52,484 INFO [STDOUT] DEBUG: java.io.FileNotFoundException: C:\Program Files\Java\jre1.6.0_01\lib\javamail.providers (The system cannot find the file specified)
| 2007-08-07 08:58:52,484 INFO [STDOUT] DEBUG: !anyLoaded
| 2007-08-07 08:58:52,500 INFO [STDOUT] DEBUG: not loading resource: /META-INF/javamail.providers
| 2007-08-07 08:58:52,515 INFO [STDOUT] DEBUG: successfully loaded resource: /META-INF/javamail.default.providers
| 2007-08-07 08:58:52,515 INFO [STDOUT] DEBUG: Tables of loaded providers
| 2007-08-07 08:58:52,531 INFO [STDOUT] DEBUG: Providers Listed By Class Name: {com.sun.mail.smtp.SMTPSSLTransport=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Sun Microsystems, Inc], com.sun.mail.smtp.SMTPTransport=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc], com.sun.mail.imap.IMAPSSLStore=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Sun Microsystems, Inc], com.sun.mail.pop3.POP3SSLStore=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Sun Microsystems, Inc], com.sun.mail.imap.IMAPStore=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc], com.sun.mail.pop3.POP3Store=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc]}
| 2007-08-07 08:58:52,531 INFO [STDOUT] DEBUG: Providers Listed By Protocol: {imaps=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Sun Microsystems, Inc], imap=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc], smtps=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Sun Microsystems, Inc], pop3=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc], pop3s=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Sun Microsystems, Inc], smtp=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]}
| 2007-08-07 08:58:52,531 INFO [STDOUT] DEBUG: successfully loaded resource: /META-INF/javamail.default.address.map
| 2007-08-07 08:58:52,546 INFO [STDOUT] DEBUG: !anyLoaded
| 2007-08-07 08:58:52,546 INFO [STDOUT] DEBUG: not loading resource: /META-INF/javamail.address.map
| 2007-08-07 08:58:52,546 INFO [STDOUT] DEBUG: java.io.FileNotFoundException: C:\Program Files\Java\jre1.6.0_01\lib\javamail.address.map (The system cannot find the file specified)
| 2007-08-07 08:58:52,546 INFO [STDOUT] DEBUG: setDebug: JavaMail version 1.4ea
| 2007-08-07 08:58:52,546 INFO [STDOUT] DEBUG: getProvider() returning javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc]
| 2007-08-07 08:58:52,562 INFO [STDOUT] DEBUG POP3: connecting to host "localhost", port 110, isSSL false
| 2007-08-07 08:58:53,781 ERROR [org.jboss.resource.adapter.mail.inflow.MailActivation] Failed to execute folder check, spec=MailActivationSpec(mailServer=localhost, storeProtocol=pop3, mailFolder=INBOX, pollingInterval=60000, messageSelector=null, userName=myname, maxMessages=1, debug=true)
| 2007-08-07 08:59:54,421 INFO [STDOUT] DEBUG: JavaMail version 1.4ea
| 2007-08-07 08:59:54,750 INFO [STDOUT] DEBUG: java.io.FileNotFoundException: C:\Program Files\Java\jre1.6.0_01\lib\javamail.providers (The system cannot find the file specified)
| 2007-08-07 08:59:54,750 INFO [STDOUT] DEBUG: !anyLoaded
| 2007-08-07 08:59:54,750 INFO [STDOUT] DEBUG: not loading resource: /META-INF/javamail.providers
| 2007-08-07 08:59:54,750 INFO [STDOUT] DEBUG: successfully loaded resource: /META-INF/javamail.default.providers
| 2007-08-07 08:59:54,750 INFO [STDOUT] DEBUG: Tables of loaded providers
| 2007-08-07 08:59:54,750 INFO [STDOUT] DEBUG: Providers Listed By Class Name: {com.sun.mail.smtp.SMTPSSLTransport=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Sun Microsystems, Inc], com.sun.mail.smtp.SMTPTransport=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc], com.sun.mail.imap.IMAPSSLStore=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Sun Microsystems, Inc], com.sun.mail.pop3.POP3SSLStore=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Sun Microsystems, Inc], com.sun.mail.imap.IMAPStore=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc], com.sun.mail.pop3.POP3Store=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc]}
| 2007-08-07 08:59:54,750 INFO [STDOUT] DEBUG: Providers Listed By Protocol: {imaps=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Sun Microsystems, Inc], imap=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc], smtps=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Sun Microsystems, Inc], pop3=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc], pop3s=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Sun Microsystems, Inc], smtp=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]}
| 2007-08-07 08:59:54,750 INFO [STDOUT] DEBUG: successfully loaded resource: /META-INF/javamail.default.address.map
| 2007-08-07 08:59:54,750 INFO [STDOUT] DEBUG: !anyLoaded
| 2007-08-07 08:59:54,750 INFO [STDOUT] DEBUG: not loading resource: /META-INF/javamail.address.map
| 2007-08-07 08:59:54,750 INFO [STDOUT] DEBUG: java.io.FileNotFoundException: C:\Program Files\Java\jre1.6.0_01\lib\javamail.address.map (The system cannot find the file specified)
| 2007-08-07 08:59:54,750 INFO [STDOUT] DEBUG: setDebug: JavaMail version 1.4ea
| 2007-08-07 08:59:54,750 INFO [STDOUT] DEBUG: getProvider() returning javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc]
| 2007-08-07 08:59:54,750 INFO [STDOUT] DEBUG POP3: connecting to host "localhost", port 110, isSSL false
| 2007-08-07 08:59:55,812 ERROR [org.jboss.resource.adapter.mail.inflow.MailActivation] Failed to execute folder check, spec=MailActivationSpec(mailServer=localhost, storeProtocol=pop3, mailFolder=INBOX, pollingInterval=60000, messageSelector=null, userName=myname, maxMessages=1, debug=true)
|
|
The Mail Receiver is below:
| package com.triad.sessionBeans.student;
|
| import org.jboss.annotation.ejb.ResourceAdapter;
| import org.jboss.resource.adapter.mail.inflow.MailListener;
| import org.jboss.seam.annotations.Logger;
| import org.jboss.seam.annotations.Name;
| import org.jboss.seam.log.Log;
|
| import javax.ejb.ActivationConfigProperty;
| import javax.ejb.MessageDriven;
| import javax.mail.Message;
| import javax.mail.MessagingException;
|
|
| @MessageDriven(activationConfig={
| @ActivationConfigProperty(propertyName="mailServer", propertyValue="localhost"),
| @ActivationConfigProperty(propertyName="mailFolder", propertyValue="INBOX"),
| @ActivationConfigProperty(propertyName="storeProtocol", propertyValue="pop3"),
| @ActivationConfigProperty(propertyName="userName", propertyValue="myname"),
| @ActivationConfigProperty(propertyName="password", propertyValue="mypass"),
| @ActivationConfigProperty(propertyName = "debug", propertyValue = "true"),
| @ActivationConfigProperty(propertyName = "flush", propertyValue = "true")
| })
| @ResourceAdapter("mail-ra.rar")
| @Name("mailListener")
| public class MailRecieverMDB implements MailListener {
|
| @Logger
| private Log log;
| public void onMessage(Message message) {
| // Process the message
|
| try {
| log.info("The msg has been recieveed #0",message.getSubject());
| } catch (MessagingException e) {
| // TODO Auto-generated catch block
| e.printStackTrace();
| }
| }
|
| }
|
The components.xml :
| <?xml version="1.0" encoding="UTF-8"?>
| <components xmlns="http://jboss.com/products/seam/components"
| xmlns:core="http://jboss.com/products/seam/core"
| xmlns:drools="http://jboss.com/products/seam/drools"
| xmlns:security="http://jboss.com/products/seam/security"
| xmlns:mail="http://jboss.com/products/seam/mail"
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xmlns:pdf="http://jboss.com/products/seam/pdf"
| xsi:schemaLocation=
| "http://jboss.com/products/seam/core http://jboss.com/products/seam/core-1.2.xsd
| http://jboss.com/products/seam/drools http://jboss.com/products/seam/drools-1.2.xsd
| http://jboss.com/products/seam/security http://jboss.com/products/seam/security-1.2.xsd
| http://jboss.com/products/seam/mail http://jboss.com/products/seam/mail-1.2.xsd
| http://jboss.com/products/seam/components http://jboss.com/products/seam/components-1.2.xsd">
|
| <core:init debug="true" jndi-pattern="@jndiPattern@"/>
|
| <core:manager concurrent-request-timeout="500"
| conversation-timeout="120000"
| conversation-id-parameter="cid"
| conversation-is-long-running-parameter="clr"/>
|
| <pdf:documentStore useExtensions="true" errorPage="/pdfMissing.seam" />
|
| <component class="org.jboss.seam.web.MultipartFilter">
| <property name="createTempFiles">true</property>
| <!-- <property name="maxRequestSize">5000000000</property> -->
| </component>
|
| <core:managed-persistence-context name="entityManager"
| auto-create="true"
| persistence-unit-jndi-name="java:/E-AssessmentEntityManagerFactory"/>
|
| <core:ejb installed="@embeddedEjb@"/>
|
| <core:dispatcher />
|
| <drools:rule-base name="securityRules">
| <drools:rule-files>
| <value>/security.drl</value>
| </drools:rule-files>
| </drools:rule-base>
|
| <security:identity authenticate-method="#{authenticator.authenticate}"
| security-rules="#{securityRules}"/>
|
| <event type="org.jboss.seam.notLoggedIn">
| <action expression="#{redirect.captureCurrentView}"/>
| </event>
| <event type="org.jboss.seam.postAuthenticate">
| <action expression="#{redirect.returnToCapturedView}"/>
| </event>
|
| <mail:mail-session host="localhost" port="2525" username="myname" password="mypass" />
|
|
| <mail:meldware>
| <mail:users>
| <value>#{myname}</value>
| <value>#{root}</value>
| </mail:users>
| </mail:meldware>
|
| <mail:meldware-user name="myname" username="mypass" password="mypass">
| <mail:aliases>
| <value>mymail(a)gmail.com</value>
| <value>mymail(a)yahoo.com</value>
| </mail:aliases>
| </mail:meldware-user>
| <mail:meldware-user name="root" username="root" password="root" administrator="true" />
|
| <!-- For use with jBPM pageflow or process management -->
| <!--
| <core:jbpm>
| <core:process-definitions></core:process-definitions>
| <core:pageflow-definitions></core:pageflow-definitions>
| </core:jbpm>
| -->
|
|
| </components>
|
The jboss mail-service.xml:
| <?xml version="1.0" encoding="UTF-8"?>
| <!DOCTYPE server>
| <!-- $Id: mail-service.xml 31716 2005-06-01 06:20:43Z starksm $ -->
|
| <server>
|
| <!-- ==================================================================== -->
| <!-- Mail Connection Factory -->
| <!-- ==================================================================== -->
|
| <mbean code="org.jboss.mail.MailService"
| name="jboss:service=Mail">
| <attribute name="JNDIName">java:/Mail</attribute>
| <attribute name="User">mokua</attribute>
| <attribute name="Password">mokua</attribute>
| <attribute name="Configuration">
| <!-- A test configuration -->
| <configuration>
| <!-- Change to your mail server prototocol -->
| <property name="mail.store.protocol" value="pop3"/>
| <property name="mail.transport.protocol" value="smtp"/>
|
| <!-- Change to the user who will receive mail -->
| <property name="mail.user" value="myname"/>
|
| <!-- Change to the mail server -->
| <property name="mail.pop3.host" value="localhost"/>
|
| <!-- Change to the SMTP gateway server -->
| <property name="mail.smtp.host" value="localhost"/>
|
| <!-- The mail server port -->
| <property name="mail.smtp.port" value="2525"/>
|
| <!-- Change to the address mail will be from -->
| <property name="mail.from" value="myname(a)localhost.com"/>
|
| <!-- Enable debugging output from the javamail classes -->
| <property name="mail.debug" value="true"/>
| </configuration>
| </attribute>
| <depends>jboss:service=Naming</depends>
| </mbean>
|
|
| </server>
|
Am using:
seam1.2.1 ga
jboss4.0.5 ga
i have already replaced the mail-ra.ra in jboss with one that comes with seam.
Any help will be greatly appreciated.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4071436#4071436
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4071436
18Â years, 8Â months
[JCA/JBoss] - JBoss 4.0.4 java.sql.SQLException: No more data to read from
by ashishanand
We have 2 machines each with identical JBoss 4.0.4 Server and Oracle 10g installation.
We have an application (war file) installed on both the system.
When trying to insert data into oracle database from within the application, it works fine on one machine, however, on the 2nd machine we encountered the following error.
Oracle-ds.xml (for connection pooling) configuration on both the installation have identical configuration.
2007-08-07 11:15:43,078 DEBUG [org.jboss.web.tomcat.tc5.Tomcat5] Saw org.jboss.system.server.started notification, starting connectors
2007-08-07 11:15:43,093 INFO [org.apache.coyote.http11.Http11BaseProtocol] Starting Coyote HTTP/1.1 on http-0.0.0.0-8080
2007-08-07 11:15:43,218 INFO [org.apache.jk.common.ChannelSocket] JK: ajp13 listening on /0.0.0.0:8009
2007-08-07 11:15:43,234 INFO [org.apache.jk.server.JkMain] Jk running ID=0 time=0/94 config=null
2007-08-07 11:15:43,234 INFO [org.jboss.system.server.Server] JBoss (MX MicroKernel) [4.0.4.GA (build: CVSTag=JBoss_4_0_4_GA date=200605151000)] Started in 22s:297ms
2007-08-07 11:17:19,000 DEBUG [org.jboss.resource.connectionmanager.IdleRemover] internalRegisterPool: registering pool with interval 900000 old interval: 9223372036854775807
2007-08-07 11:17:19,000 DEBUG [org.jboss.resource.connectionmanager.IdleRemover] internalRegisterPool: about to notify thread: old next: 1186457089000, new next: 1186457089000
2007-08-07 11:17:40,015 WARN [org.jboss.resource.connectionmanager.TxConnectionManager] Connection error occured: org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener@3b9a5f[state=NORMAL mc=org.jboss.resource.adapter.jdbc.local.LocalManagedConnection@1a7d9e7 handles=1 lastUse=1186456656140 permit=true trackByTx=false mcp=org.jboss.resource.connectionmanager.JBossManagedConnectionPool$OnePool@d2ee5d context=org.jboss.resource.connectionmanager.InternalManagedConnectionPool@1f568f xaResource=org.jboss.resource.connectionmanager.TxConnectionManager$LocalXAResource@16c02df txSync=null]
java.sql.SQLException: No more data to read from socket
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:208)
at oracle.jdbc.driver.T4CMAREngine.unmarshalUB1(T4CMAREngine.java:1118)
at oracle.jdbc.driver.T4CMAREngine.unmarshalSB1(T4CMAREngine.java:1070)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:478)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:216)
at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:955)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1168)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3316)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3400)
at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:251)
Any help is appreciated.
Thanks in advance.
Regards,
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4071428#4071428
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4071428
18Â years, 8Â months
[JBoss jBPM] - Where to route obsolete parent token in token multiplication
by karmen38
Hi All,
Based on the examples from this forum and jBPM wiki I have implemented a custom action that accepts a list of items, generates a token for each item from the list, creates a variable with the list item for each token and sends the token further to the process. This action could be used in any node.
It all works perfectly but there is an original parent token that came to this node (with the list of items) that I do not need anymore. However, I would need all variables associated with this token because they are inherited by the children tokens generated by the action.
I could reuse this parent token as one of the child tokens but this is bad idea because of two reasons: a) there could be no items in the list so the question would still remain: where to route the parent token since no tokens should go along the process anymore; b) this new reused parent token would carry all the variables inherited by all other child tokens which is not right - some variables should be private for each token.
I could also create a decision node later in the process flow that would route the parent token to the end of the process based on some business value - this parent token will definitely lack some important variable, f.i. the one which keeps the item from the list - all siblings would have it but the parent would not. This solution would complicate the process topology unnecessary.
I could not end this parent token because it will effectively terminate all children with all the variables. I could not also suspend this token because I would not know when to restart it and (eventually) where to route it after un-suspend.
So the question is: is there any way to route this parent token in the action code right to the end of the process or to some designated node (join?) where it would wait for all of its children without having the process to know about it?
Thank you,
Mark
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4071423#4071423
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4071423
18Â years, 8Â months
[Messaging, JMS & JBossMQ] - Publish once but get 8 replicated message on the topic
by treefield
Hi,
I looked around and found some sample code to publish to a JBoss topic...
public static boolean publish(String xml) throws Exception
| {
| log.info("Creating jndi context - alternatively use a jndi.properties");
| Properties properties = new Properties();
| properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
| properties.put(Context.URL_PKG_PREFIXES, "org.jnp.interfaces");
| properties.put(Context.PROVIDER_URL, "jnp://myserver:1099");
| InitialContext ctx = new InitialContext(properties);
|
| Topic topic = (Topic) ctx.lookup("topic/myTopic");
| TopicConnectionFactory tcf = (TopicConnectionFactory) ctx.lookup("ConnectionFactory");
| TopicConnection tc = tcf.createTopicConnection("user","pwd");
| try
| {
| TopicSession ts = tc.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
| TopicPublisher publisher = ts.createPublisher(topic);
| TextMessage message = ts.createTextMessage(xml);
|
| publisher.send(message);
| publisher.close();
| tc.close();
| return true;
| }
| catch(Exception e){
| log.error("Exception thrown trying to send to topic", e);
| return false;
| }
| finally
| {
| tc.close();
| }
| }
If I disable the subscriber to the topic and look in the JMS_MESSAGES table (HA JMS is configured), I find 8 duplicated messages. There is no looping and only a single subscriber has been configured. Since this is the first tested topic other than the samples that come already installed, this is the only custom configuration so far. I set up the topic in the *-service.xml file as follows...
<mbean code="org.jboss.mq.server.jmx.Topic"
| name="jboss.mq.destination:service=Topic,name=myTopic">
| <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
| <depends optional-attribute-name="SecurityManager">jboss.mq:service=SecurityManager</depends>
| <attribute name="SecurityConf">
| <security>
| <role name="guest" read="true" write="true"/>
| <role name="publisher" read="true" write="true" create="false"/>
| <role name="durpublisher" read="true" write="true" create="true"/>
| </security>
| </attribute>
| </mbean>
I am not sure what could be causing the superfluous messages. Is there a known issue with publishing to topics? I am using JBoss 4.0.2 and JDK 1.5.
Thanks in advance!
Theresa
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4071422#4071422
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4071422
18Â years, 8Â months