You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicemix.apache.org by "Darren Davison (JIRA)" <ji...@apache.org> on 2008/11/21 21:46:05 UTC

[jira] Created: (SM-1700) unable to set connection URI on sender

unable to set connection URI on sender
--------------------------------------

                 Key: SM-1700
                 URL: https://issues.apache.org/activemq/browse/SM-1700
             Project: ServiceMix
          Issue Type: Bug
          Components: servicemix-mail
    Affects Versions: 3.3
         Environment: Linux 2.6.27 / JDK 6
            Reporter: Darren Davison


Not sure whether the component is officially released yet, but I obtained it from the snapshot repo today to test it.  I created the skeleton project from the archetype using:

mvn archetype:create -DarchetypeGroupId=org.apache.servicemix.tooling -DarchetypeArtifactId=servicemix-mail-service-unit -DarchetypeVersion=2008.01-SNAPSHOT -DartifactId=tutorial-mail-su -DremoteRepositories=http://people.apache.org/repo/m2-snapshot-repository



I edited xbean.xml to look as follows for the sender endpoint (SMTP server needs no authorisation):

    <mail:sender service="tut:mail" 
                 endpoint="sender"
                 sender="servicemix@example.com"
                 receiver="me@somewhere.else"
                 debugMode="false" 
                 connection="smtp://mail.example.com" />                 




When I try to deploy, I get the following within the error output:

<loc-message>Error creating bean with name 'org.apache.servicemix.mail.MailSenderEndpoint#0' defined in file [/opt/apache-servicemix-3.3/data/smx/service-assemblies/tutorial-sa/version_2/sus/servicemix-mail/tutorial-mail-su/xbean.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'connection' threw exception; nested exception is java.lang.NullPointerException</loc-message>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (SM-1700) unable to set connection URI on sender

Posted by "Ramon Buckland (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/SM-1700?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=47719#action_47719 ] 

rbuckland edited comment on SM-1700 at 11/30/08 5:43 PM:
--------------------------------------------------------------

Lars, 

Your fix did not fix the problem. 

The issue is when you are using an SMTP host that does not require login detauls (this is for the sender).

The component configured as below will cause the NullPointerException

            <mail:sender service="myns:mailSender" 
                         endpoint="mailEndpoint"
                         sender="sender-email@foobar.internal.com"
                         receiver="to-email@foobar.internal.com"
                         connection="smtp://smtp.intranethost" />

Inside the MailSenderEndpoint, the connection is parsed using the Mailutils class.

      MailUtils.configure(this.connection)

So, the connection is smtp://smtp.intranethost

This then gets passed to a URI object .. 
    
     URI uri = URI.create(uriString);

On the URI object is the "query" field, but this is NULL under the above example, which is not checked.

See below for the patch.


      was (Author: rbuckland):
    Lars, 

Your fix did not fix the problem. 

The issue is when you are using an SMTP host that does not require login detauls (this is for the sender).

The component configured as below will cause the NullPointerException

            <mail:sender service="myns:mailSender" 
                         endpoint="mailEndpoint"
                         sender="sender-email@foobar.internal.com"
                         receiver="to-email@foobar.internal.com"
                         connection="smtp://smtp.intranethost" />

Inside the MailSenderEndpoint, the connection is parsed using the Mailutils class.

      MailUtils.configure(this.connection)

So, the connection is smtp://smtp.intranethost

This then gets passed to a URI object .. 
    
     URI uri = URI.create(uriString);

On the URI object is the "query" field, but this is NULL under the above example, which is not checked.

See below for the patch.

rbucklan@workstation ~/projects/042_project-sm/external-sources/servicemix-mail/trunk
$ svn diff 
Index: src/main/java/org/apache/servicemix/mail/utils/MailUtils.java
===================================================================
--- src/main/java/org/apache/servicemix/mail/utils/MailUtils.java       (revision 721938)
+++ src/main/java/org/apache/servicemix/mail/utils/MailUtils.java       (working copy)
@@ -139,7 +139,7 @@
             config.setFolderName("INBOX");
         }
 
 -        if (uri.getQuery().indexOf("password=") != -1) {
 +        if (uri.getQuery() != null && uri.getQuery().indexOf("password=") != -1) {
             // extract the password from query
             int beginIndex = uri.getQuery().indexOf("password=") + "password=".length();
             int endIndex = uri.getQuery().indexOf(';', beginIndex + 1) != -1 ? uri.getQuery()
@@ -152,7 +152,7 @@
 
         if (userInfo == null) {
             // alternative way of specifying the user name
 -            if (uri.getQuery().indexOf("user=") != -1) {
 +            if (uri.getQuery() != null && uri.getQuery().indexOf("user=") != -1) {
                 // extract the password from query
                 int beginIndex = uri.getQuery().indexOf("user=") + "user=".length();
                 int endIndex = uri.getQuery().indexOf(';', beginIndex + 1) != -1 ? uri.getQuery()


  
> unable to set connection URI on sender
> --------------------------------------
>
>                 Key: SM-1700
>                 URL: https://issues.apache.org/activemq/browse/SM-1700
>             Project: ServiceMix
>          Issue Type: Bug
>          Components: servicemix-mail
>    Affects Versions: 3.3
>         Environment: Linux 2.6.27 / JDK 6
>            Reporter: Darren Davison
>            Assignee: Lars Heinemann
>             Fix For: servicemix-mail-2008.02
>
>         Attachments: servicemix-mail-diff.txt
>
>
> Not sure whether the component is officially released yet, but I obtained it from the snapshot repo today to test it.  I created the skeleton project from the archetype using:
> mvn archetype:create -DarchetypeGroupId=org.apache.servicemix.tooling -DarchetypeArtifactId=servicemix-mail-service-unit -DarchetypeVersion=2008.01-SNAPSHOT -DartifactId=tutorial-mail-su -DremoteRepositories=http://people.apache.org/repo/m2-snapshot-repository
> I edited xbean.xml to look as follows for the sender endpoint (SMTP server needs no authorisation):
>     <mail:sender service="tut:mail" 
>                  endpoint="sender"
>                  sender="servicemix@example.com"
>                  receiver="me@somewhere.else"
>                  debugMode="false" 
>                  connection="smtp://mail.example.com" />                 
> When I try to deploy, I get the following within the error output:
> <loc-message>Error creating bean with name 'org.apache.servicemix.mail.MailSenderEndpoint#0' defined in file [/opt/apache-servicemix-3.3/data/smx/service-assemblies/tutorial-sa/version_2/sus/servicemix-mail/tutorial-mail-su/xbean.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
> PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'connection' threw exception; nested exception is java.lang.NullPointerException</loc-message>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (SM-1700) unable to set connection URI on sender

Posted by "Lars Heinemann (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/SM-1700?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Lars Heinemann resolved SM-1700.
--------------------------------

    Resolution: Fixed

Patch applied.
Thanks for providing it, Ramon.


> unable to set connection URI on sender
> --------------------------------------
>
>                 Key: SM-1700
>                 URL: https://issues.apache.org/activemq/browse/SM-1700
>             Project: ServiceMix
>          Issue Type: Bug
>          Components: servicemix-mail
>    Affects Versions: 3.3
>         Environment: Linux 2.6.27 / JDK 6
>            Reporter: Darren Davison
>            Assignee: Lars Heinemann
>             Fix For: servicemix-mail-2008.02
>
>         Attachments: servicemix-mail-diff.txt
>
>
> Not sure whether the component is officially released yet, but I obtained it from the snapshot repo today to test it.  I created the skeleton project from the archetype using:
> mvn archetype:create -DarchetypeGroupId=org.apache.servicemix.tooling -DarchetypeArtifactId=servicemix-mail-service-unit -DarchetypeVersion=2008.01-SNAPSHOT -DartifactId=tutorial-mail-su -DremoteRepositories=http://people.apache.org/repo/m2-snapshot-repository
> I edited xbean.xml to look as follows for the sender endpoint (SMTP server needs no authorisation):
>     <mail:sender service="tut:mail" 
>                  endpoint="sender"
>                  sender="servicemix@example.com"
>                  receiver="me@somewhere.else"
>                  debugMode="false" 
>                  connection="smtp://mail.example.com" />                 
> When I try to deploy, I get the following within the error output:
> <loc-message>Error creating bean with name 'org.apache.servicemix.mail.MailSenderEndpoint#0' defined in file [/opt/apache-servicemix-3.3/data/smx/service-assemblies/tutorial-sa/version_2/sus/servicemix-mail/tutorial-mail-su/xbean.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
> PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'connection' threw exception; nested exception is java.lang.NullPointerException</loc-message>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Work started: (SM-1700) unable to set connection URI on sender

Posted by "Lars Heinemann (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/SM-1700?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Work on SM-1700 started by Lars Heinemann.

> unable to set connection URI on sender
> --------------------------------------
>
>                 Key: SM-1700
>                 URL: https://issues.apache.org/activemq/browse/SM-1700
>             Project: ServiceMix
>          Issue Type: Bug
>          Components: servicemix-mail
>    Affects Versions: 3.3
>         Environment: Linux 2.6.27 / JDK 6
>            Reporter: Darren Davison
>            Assignee: Lars Heinemann
>             Fix For: servicemix-mail-2008.02
>
>         Attachments: servicemix-mail-diff.txt
>
>
> Not sure whether the component is officially released yet, but I obtained it from the snapshot repo today to test it.  I created the skeleton project from the archetype using:
> mvn archetype:create -DarchetypeGroupId=org.apache.servicemix.tooling -DarchetypeArtifactId=servicemix-mail-service-unit -DarchetypeVersion=2008.01-SNAPSHOT -DartifactId=tutorial-mail-su -DremoteRepositories=http://people.apache.org/repo/m2-snapshot-repository
> I edited xbean.xml to look as follows for the sender endpoint (SMTP server needs no authorisation):
>     <mail:sender service="tut:mail" 
>                  endpoint="sender"
>                  sender="servicemix@example.com"
>                  receiver="me@somewhere.else"
>                  debugMode="false" 
>                  connection="smtp://mail.example.com" />                 
> When I try to deploy, I get the following within the error output:
> <loc-message>Error creating bean with name 'org.apache.servicemix.mail.MailSenderEndpoint#0' defined in file [/opt/apache-servicemix-3.3/data/smx/service-assemblies/tutorial-sa/version_2/sus/servicemix-mail/tutorial-mail-su/xbean.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
> PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'connection' threw exception; nested exception is java.lang.NullPointerException</loc-message>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SMXCOMP-1) unable to set connection URI on sender

Posted by "Freeman Fang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/SMXCOMP-1?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Freeman Fang updated SMXCOMP-1:
-------------------------------

    Affects Version/s:     (was: servicemix-mail-2008.01)
                       servicemix-mail-2009.01

> unable to set connection URI on sender
> --------------------------------------
>
>                 Key: SMXCOMP-1
>                 URL: https://issues.apache.org/activemq/browse/SMXCOMP-1
>             Project: ServiceMix Components
>          Issue Type: Bug
>          Components: servicemix-mail
>    Affects Versions: servicemix-mail-2009.01
>         Environment: Linux 2.6.27 / JDK 6
>            Reporter: Darren Davison
>            Assignee: Lars Heinemann
>             Fix For: servicemix-mail-2008.01
>
>         Attachments: servicemix-mail-diff.txt
>
>
> Not sure whether the component is officially released yet, but I obtained it from the snapshot repo today to test it.  I created the skeleton project from the archetype using:
> mvn archetype:create -DarchetypeGroupId=org.apache.servicemix.tooling -DarchetypeArtifactId=servicemix-mail-service-unit -DarchetypeVersion=2008.01-SNAPSHOT -DartifactId=tutorial-mail-su -DremoteRepositories=http://people.apache.org/repo/m2-snapshot-repository
> I edited xbean.xml to look as follows for the sender endpoint (SMTP server needs no authorisation):
>     <mail:sender service="tut:mail" 
>                  endpoint="sender"
>                  sender="servicemix@example.com"
>                  receiver="me@somewhere.else"
>                  debugMode="false" 
>                  connection="smtp://mail.example.com" />                 
> When I try to deploy, I get the following within the error output:
> <loc-message>Error creating bean with name 'org.apache.servicemix.mail.MailSenderEndpoint#0' defined in file [/opt/apache-servicemix-3.3/data/smx/service-assemblies/tutorial-sa/version_2/sus/servicemix-mail/tutorial-mail-su/xbean.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
> PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'connection' threw exception; nested exception is java.lang.NullPointerException</loc-message>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SM-1700) unable to set connection URI on sender

Posted by "Ramon Buckland (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/SM-1700?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ramon Buckland updated SM-1700:
-------------------------------

    Attachment: servicemix-mail-diff.txt

patch supplied to fix issue

To manually create your own 2008.01 replace (using this current 2008.02 version)

1. svn co http://svn.apache.org/repos/asf/servicemix/components/bindings/servicemix-mail/trunk
2. mod pom.xml as follows

Index: pom.xml
===================================================================
--- pom.xml     (revision 721938)
+++ pom.xml     (working copy)
@@ -26,7 +26,7 @@
-  <version>2008.02-SNAPSHOT</version>
+  <version>2008.02</version>
@@ -41,7 +41,7 @@
-    <servicemix-shared-version>2008.02-SNAPSHOT</servicemix-shared-version>
+    <servicemix-shared-version>2008.01</servicemix-shared-version>

3. Now mvn clean install and copy the target/servicemix-mail-2008.02-installer.zip, replacing your 2008.01 version. 
(Not throroughly tested of course.)

> unable to set connection URI on sender
> --------------------------------------
>
>                 Key: SM-1700
>                 URL: https://issues.apache.org/activemq/browse/SM-1700
>             Project: ServiceMix
>          Issue Type: Bug
>          Components: servicemix-mail
>    Affects Versions: 3.3
>         Environment: Linux 2.6.27 / JDK 6
>            Reporter: Darren Davison
>            Assignee: Lars Heinemann
>             Fix For: servicemix-mail-2008.02
>
>         Attachments: servicemix-mail-diff.txt
>
>
> Not sure whether the component is officially released yet, but I obtained it from the snapshot repo today to test it.  I created the skeleton project from the archetype using:
> mvn archetype:create -DarchetypeGroupId=org.apache.servicemix.tooling -DarchetypeArtifactId=servicemix-mail-service-unit -DarchetypeVersion=2008.01-SNAPSHOT -DartifactId=tutorial-mail-su -DremoteRepositories=http://people.apache.org/repo/m2-snapshot-repository
> I edited xbean.xml to look as follows for the sender endpoint (SMTP server needs no authorisation):
>     <mail:sender service="tut:mail" 
>                  endpoint="sender"
>                  sender="servicemix@example.com"
>                  receiver="me@somewhere.else"
>                  debugMode="false" 
>                  connection="smtp://mail.example.com" />                 
> When I try to deploy, I get the following within the error output:
> <loc-message>Error creating bean with name 'org.apache.servicemix.mail.MailSenderEndpoint#0' defined in file [/opt/apache-servicemix-3.3/data/smx/service-assemblies/tutorial-sa/version_2/sus/servicemix-mail/tutorial-mail-su/xbean.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
> PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'connection' threw exception; nested exception is java.lang.NullPointerException</loc-message>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (SM-1700) unable to set connection URI on sender

Posted by "Ramon Buckland (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/SM-1700?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=47719#action_47719 ] 

rbuckland edited comment on SM-1700 at 11/30/08 5:35 PM:
--------------------------------------------------------------

Lars, 

Your fix did not fix the problem. 

The issue is when you are using an SMTP host that does not require login detauls (this is for the sender).

The component configured as below will cause the NullPointerException

            <mail:sender service="myns:mailSender" 
                         endpoint="mailEndpoint"
                         sender="sender-email@foobar.internal.com"
                         receiver="to-email@foobar.internal.com"
                         connection="smtp://smtp.intranethost" />

Inside the MailSenderEndpoint, the connection is parsed using the Mailutils class.

      MailUtils.configure(this.connection)

So, the connection is smtp://smtp.intranethost

This then gets passed to a URI object .. 
    
     URI uri = URI.create(uriString);

On the URI object is the "query" field, but this is NULL under the above example, which is not checked.

See below for the patch.

rbucklan@workstation ~/projects/042_project-sm/external-sources/servicemix-mail/trunk
$ svn diff 
Index: src/main/java/org/apache/servicemix/mail/utils/MailUtils.java
===================================================================
--- src/main/java/org/apache/servicemix/mail/utils/MailUtils.java       (revision 721938)
+++ src/main/java/org/apache/servicemix/mail/utils/MailUtils.java       (working copy)
@@ -139,7 +139,7 @@
             config.setFolderName("INBOX");
         }
 
 -        if (uri.getQuery().indexOf("password=") != -1) {
 +        if (uri.getQuery() != null && uri.getQuery().indexOf("password=") != -1) {
             // extract the password from query
             int beginIndex = uri.getQuery().indexOf("password=") + "password=".length();
             int endIndex = uri.getQuery().indexOf(';', beginIndex + 1) != -1 ? uri.getQuery()
@@ -152,7 +152,7 @@
 
         if (userInfo == null) {
             // alternative way of specifying the user name
 -            if (uri.getQuery().indexOf("user=") != -1) {
 +            if (uri.getQuery() != null && uri.getQuery().indexOf("user=") != -1) {
                 // extract the password from query
                 int beginIndex = uri.getQuery().indexOf("user=") + "user=".length();
                 int endIndex = uri.getQuery().indexOf(';', beginIndex + 1) != -1 ? uri.getQuery()



      was (Author: rbuckland):
    Lars, 

Your fix did not fix the problem. 

The issue is when you are using an SMTP host that does not require login detauls (this is for the sender).

The component configured as below will cause the NullPointerException

            <mail:sender service="myns:mailSender" 
                         endpoint="mailEndpoint"
                         sender="sender-email@foobar.internal.com"
                         receiver="to-email@foobar.internal.com"
                         connection="smtp://smtp.intranethost" />

Inside the MailSenderEndpoint, the connection is parsed using the Mailutils class.

      MailUtils.configure(this.connection)

So, the connection is smtp://smtp.intranethost

This then gets passed to a URI object .. 
    
     URI uri = URI.create(uriString);

On the URI object is the "query" field, but this is NULL under the above example, which is not checked.

See below for the patch.

rbucklan@workstation ~/projects/042_project-sm/external-sources/servicemix-mail/trunk
$ svn diff 
Index: src/main/java/org/apache/servicemix/mail/utils/MailUtils.java
===================================================================
--- src/main/java/org/apache/servicemix/mail/utils/MailUtils.java       (revision 721938)
+++ src/main/java/org/apache/servicemix/mail/utils/MailUtils.java       (working copy)
@@ -139,7 +139,7 @@
             config.setFolderName("INBOX");
         }
 
-        if (uri.getQuery().indexOf("password=") != -1) {
+        if (uri.getQuery() != null && uri.getQuery().indexOf("password=") != -1) {
             // extract the password from query
             int beginIndex = uri.getQuery().indexOf("password=") + "password=".length();
             int endIndex = uri.getQuery().indexOf(';', beginIndex + 1) != -1 ? uri.getQuery()
@@ -152,7 +152,7 @@
 
         if (userInfo == null) {
             // alternative way of specifying the user name
-            if (uri.getQuery().indexOf("user=") != -1) {
+            if (uri.getQuery() != null && uri.getQuery().indexOf("user=") != -1) {
                 // extract the password from query
                 int beginIndex = uri.getQuery().indexOf("user=") + "user=".length();
                 int endIndex = uri.getQuery().indexOf(';', beginIndex + 1) != -1 ? uri.getQuery()


  
> unable to set connection URI on sender
> --------------------------------------
>
>                 Key: SM-1700
>                 URL: https://issues.apache.org/activemq/browse/SM-1700
>             Project: ServiceMix
>          Issue Type: Bug
>          Components: servicemix-mail
>    Affects Versions: 3.3
>         Environment: Linux 2.6.27 / JDK 6
>            Reporter: Darren Davison
>            Assignee: Lars Heinemann
>             Fix For: servicemix-mail-2008.02
>
>
> Not sure whether the component is officially released yet, but I obtained it from the snapshot repo today to test it.  I created the skeleton project from the archetype using:
> mvn archetype:create -DarchetypeGroupId=org.apache.servicemix.tooling -DarchetypeArtifactId=servicemix-mail-service-unit -DarchetypeVersion=2008.01-SNAPSHOT -DartifactId=tutorial-mail-su -DremoteRepositories=http://people.apache.org/repo/m2-snapshot-repository
> I edited xbean.xml to look as follows for the sender endpoint (SMTP server needs no authorisation):
>     <mail:sender service="tut:mail" 
>                  endpoint="sender"
>                  sender="servicemix@example.com"
>                  receiver="me@somewhere.else"
>                  debugMode="false" 
>                  connection="smtp://mail.example.com" />                 
> When I try to deploy, I get the following within the error output:
> <loc-message>Error creating bean with name 'org.apache.servicemix.mail.MailSenderEndpoint#0' defined in file [/opt/apache-servicemix-3.3/data/smx/service-assemblies/tutorial-sa/version_2/sus/servicemix-mail/tutorial-mail-su/xbean.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
> PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'connection' threw exception; nested exception is java.lang.NullPointerException</loc-message>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (SM-1700) unable to set connection URI on sender

Posted by "Ramon Buckland (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/SM-1700?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=47721#action_47721 ] 

rbuckland edited comment on SM-1700 at 11/30/08 5:42 PM:
--------------------------------------------------------------

patch supplied to fix issue (see attachments above)

To manually create your own 2008.01 replace (using this current 2008.02 version)

1. svn co http://svn.apache.org/repos/asf/servicemix/components/bindings/servicemix-mail/trunk
2. mod pom.xml as follows

Index: pom.xml
===================================================================
--- pom.xml     (revision 721938)
+++ pom.xml     (working copy)
@@ -26,7 +26,7 @@
-  <version>2008.02-SNAPSHOT</version>
+  <version>2008.02</version>
@@ -41,7 +41,7 @@
-    <servicemix-shared-version>2008.02-SNAPSHOT</servicemix-shared-version>
+    <servicemix-shared-version>2008.01</servicemix-shared-version>

3. Now mvn clean install and copy the target/servicemix-mail-2008.02-installer.zip, replacing your 2008.01 version. 
(Not throroughly tested of course.)

      was (Author: rbuckland):
    patch supplied to fix issue

To manually create your own 2008.01 replace (using this current 2008.02 version)

1. svn co http://svn.apache.org/repos/asf/servicemix/components/bindings/servicemix-mail/trunk
2. mod pom.xml as follows

Index: pom.xml
===================================================================
--- pom.xml     (revision 721938)
+++ pom.xml     (working copy)
@@ -26,7 +26,7 @@
-  <version>2008.02-SNAPSHOT</version>
+  <version>2008.02</version>
@@ -41,7 +41,7 @@
-    <servicemix-shared-version>2008.02-SNAPSHOT</servicemix-shared-version>
+    <servicemix-shared-version>2008.01</servicemix-shared-version>

3. Now mvn clean install and copy the target/servicemix-mail-2008.02-installer.zip, replacing your 2008.01 version. 
(Not throroughly tested of course.)
  
> unable to set connection URI on sender
> --------------------------------------
>
>                 Key: SM-1700
>                 URL: https://issues.apache.org/activemq/browse/SM-1700
>             Project: ServiceMix
>          Issue Type: Bug
>          Components: servicemix-mail
>    Affects Versions: 3.3
>         Environment: Linux 2.6.27 / JDK 6
>            Reporter: Darren Davison
>            Assignee: Lars Heinemann
>             Fix For: servicemix-mail-2008.02
>
>         Attachments: servicemix-mail-diff.txt
>
>
> Not sure whether the component is officially released yet, but I obtained it from the snapshot repo today to test it.  I created the skeleton project from the archetype using:
> mvn archetype:create -DarchetypeGroupId=org.apache.servicemix.tooling -DarchetypeArtifactId=servicemix-mail-service-unit -DarchetypeVersion=2008.01-SNAPSHOT -DartifactId=tutorial-mail-su -DremoteRepositories=http://people.apache.org/repo/m2-snapshot-repository
> I edited xbean.xml to look as follows for the sender endpoint (SMTP server needs no authorisation):
>     <mail:sender service="tut:mail" 
>                  endpoint="sender"
>                  sender="servicemix@example.com"
>                  receiver="me@somewhere.else"
>                  debugMode="false" 
>                  connection="smtp://mail.example.com" />                 
> When I try to deploy, I get the following within the error output:
> <loc-message>Error creating bean with name 'org.apache.servicemix.mail.MailSenderEndpoint#0' defined in file [/opt/apache-servicemix-3.3/data/smx/service-assemblies/tutorial-sa/version_2/sus/servicemix-mail/tutorial-mail-su/xbean.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
> PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'connection' threw exception; nested exception is java.lang.NullPointerException</loc-message>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Reopened: (SM-1700) unable to set connection URI on sender

Posted by "Ramon Buckland (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/SM-1700?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ramon Buckland reopened SM-1700:
--------------------------------


Lars, 

Your fix did not fix the problem. 

The issue is when you are using an SMTP host that does not require login detauls (this is for the sender).

The component configured as below will cause the NullPointerException

            <mail:sender service="myns:mailSender" 
                         endpoint="mailEndpoint"
                         sender="sender-email@foobar.internal.com"
                         receiver="to-email@foobar.internal.com"
                         connection="smtp://smtp.intranethost" />

Inside the MailSenderEndpoint, the connection is parsed using the Mailutils class.

      MailUtils.configure(this.connection)

So, the connection is smtp://smtp.intranethost

This then gets passed to a URI object .. 
    
     URI uri = URI.create(uriString);

On the URI object is the "query" field, but this is NULL under the above example, which is not checked.

See below for the patch.

rbucklan@workstation ~/projects/042_project-sm/external-sources/servicemix-mail/trunk
$ svn diff 
Index: src/main/java/org/apache/servicemix/mail/utils/MailUtils.java
===================================================================
--- src/main/java/org/apache/servicemix/mail/utils/MailUtils.java       (revision 721938)
+++ src/main/java/org/apache/servicemix/mail/utils/MailUtils.java       (working copy)
@@ -139,7 +139,7 @@
             config.setFolderName("INBOX");
         }
 
-        if (uri.getQuery().indexOf("password=") != -1) {
+        if (uri.getQuery() != null && uri.getQuery().indexOf("password=") != -1) {
             // extract the password from query
             int beginIndex = uri.getQuery().indexOf("password=") + "password=".length();
             int endIndex = uri.getQuery().indexOf(';', beginIndex + 1) != -1 ? uri.getQuery()
@@ -152,7 +152,7 @@
 
         if (userInfo == null) {
             // alternative way of specifying the user name
-            if (uri.getQuery().indexOf("user=") != -1) {
+            if (uri.getQuery() != null && uri.getQuery().indexOf("user=") != -1) {
                 // extract the password from query
                 int beginIndex = uri.getQuery().indexOf("user=") + "user=".length();
                 int endIndex = uri.getQuery().indexOf(';', beginIndex + 1) != -1 ? uri.getQuery()



> unable to set connection URI on sender
> --------------------------------------
>
>                 Key: SM-1700
>                 URL: https://issues.apache.org/activemq/browse/SM-1700
>             Project: ServiceMix
>          Issue Type: Bug
>          Components: servicemix-mail
>    Affects Versions: 3.3
>         Environment: Linux 2.6.27 / JDK 6
>            Reporter: Darren Davison
>            Assignee: Lars Heinemann
>             Fix For: servicemix-mail-2008.02
>
>
> Not sure whether the component is officially released yet, but I obtained it from the snapshot repo today to test it.  I created the skeleton project from the archetype using:
> mvn archetype:create -DarchetypeGroupId=org.apache.servicemix.tooling -DarchetypeArtifactId=servicemix-mail-service-unit -DarchetypeVersion=2008.01-SNAPSHOT -DartifactId=tutorial-mail-su -DremoteRepositories=http://people.apache.org/repo/m2-snapshot-repository
> I edited xbean.xml to look as follows for the sender endpoint (SMTP server needs no authorisation):
>     <mail:sender service="tut:mail" 
>                  endpoint="sender"
>                  sender="servicemix@example.com"
>                  receiver="me@somewhere.else"
>                  debugMode="false" 
>                  connection="smtp://mail.example.com" />                 
> When I try to deploy, I get the following within the error output:
> <loc-message>Error creating bean with name 'org.apache.servicemix.mail.MailSenderEndpoint#0' defined in file [/opt/apache-servicemix-3.3/data/smx/service-assemblies/tutorial-sa/version_2/sus/servicemix-mail/tutorial-mail-su/xbean.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
> PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'connection' threw exception; nested exception is java.lang.NullPointerException</loc-message>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (SM-1700) unable to set connection URI on sender

Posted by "Lars Heinemann (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/SM-1700?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Lars Heinemann resolved SM-1700.
--------------------------------

    Fix Version/s: servicemix-mail-2008.02
       Resolution: Fixed

should work now with the current trunk


> unable to set connection URI on sender
> --------------------------------------
>
>                 Key: SM-1700
>                 URL: https://issues.apache.org/activemq/browse/SM-1700
>             Project: ServiceMix
>          Issue Type: Bug
>          Components: servicemix-mail
>    Affects Versions: 3.3
>         Environment: Linux 2.6.27 / JDK 6
>            Reporter: Darren Davison
>            Assignee: Lars Heinemann
>             Fix For: servicemix-mail-2008.02
>
>
> Not sure whether the component is officially released yet, but I obtained it from the snapshot repo today to test it.  I created the skeleton project from the archetype using:
> mvn archetype:create -DarchetypeGroupId=org.apache.servicemix.tooling -DarchetypeArtifactId=servicemix-mail-service-unit -DarchetypeVersion=2008.01-SNAPSHOT -DartifactId=tutorial-mail-su -DremoteRepositories=http://people.apache.org/repo/m2-snapshot-repository
> I edited xbean.xml to look as follows for the sender endpoint (SMTP server needs no authorisation):
>     <mail:sender service="tut:mail" 
>                  endpoint="sender"
>                  sender="servicemix@example.com"
>                  receiver="me@somewhere.else"
>                  debugMode="false" 
>                  connection="smtp://mail.example.com" />                 
> When I try to deploy, I get the following within the error output:
> <loc-message>Error creating bean with name 'org.apache.servicemix.mail.MailSenderEndpoint#0' defined in file [/opt/apache-servicemix-3.3/data/smx/service-assemblies/tutorial-sa/version_2/sus/servicemix-mail/tutorial-mail-su/xbean.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
> PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'connection' threw exception; nested exception is java.lang.NullPointerException</loc-message>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (SM-1700) unable to set connection URI on sender

Posted by "Lars Heinemann (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/SM-1700?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Lars Heinemann reassigned SM-1700:
----------------------------------

    Assignee: Lars Heinemann

> unable to set connection URI on sender
> --------------------------------------
>
>                 Key: SM-1700
>                 URL: https://issues.apache.org/activemq/browse/SM-1700
>             Project: ServiceMix
>          Issue Type: Bug
>          Components: servicemix-mail
>    Affects Versions: 3.3
>         Environment: Linux 2.6.27 / JDK 6
>            Reporter: Darren Davison
>            Assignee: Lars Heinemann
>
> Not sure whether the component is officially released yet, but I obtained it from the snapshot repo today to test it.  I created the skeleton project from the archetype using:
> mvn archetype:create -DarchetypeGroupId=org.apache.servicemix.tooling -DarchetypeArtifactId=servicemix-mail-service-unit -DarchetypeVersion=2008.01-SNAPSHOT -DartifactId=tutorial-mail-su -DremoteRepositories=http://people.apache.org/repo/m2-snapshot-repository
> I edited xbean.xml to look as follows for the sender endpoint (SMTP server needs no authorisation):
>     <mail:sender service="tut:mail" 
>                  endpoint="sender"
>                  sender="servicemix@example.com"
>                  receiver="me@somewhere.else"
>                  debugMode="false" 
>                  connection="smtp://mail.example.com" />                 
> When I try to deploy, I get the following within the error output:
> <loc-message>Error creating bean with name 'org.apache.servicemix.mail.MailSenderEndpoint#0' defined in file [/opt/apache-servicemix-3.3/data/smx/service-assemblies/tutorial-sa/version_2/sus/servicemix-mail/tutorial-mail-su/xbean.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
> PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'connection' threw exception; nested exception is java.lang.NullPointerException</loc-message>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.