jodd cannot sent response to view - jodd

I have an app build with joy-5.0.13 where I cannot send some variable value to the template to be rendered on screen. I'm sure its something simple that I'm missing right now.
This is my action:
#MadvocAction
public class IndexAction {
#PetiteInject
private TemperatureService temperatureService;
#Out
List<TemperatureLog> temps;
#Action
public void view() {
temps = temperatureService.getLastHoutTemperatures();
System.out.println(temps);
}
and this is the file called index.jsp
<%# taglib prefix="j" uri="/jodd" %>
<html>
<head>
<title>SmartHome</title>
</head>
<body>
<j:iter items="${temps}" var="tl">
${tl.temperature}<br/>
</j:iter>
</body>
</html>
and here it is the log from the console:
80281 [DEBUG] j.m.c.MadvocController.invoke:102 - Action path: GET /index
80281 [DEBUG] j.m.c.MadvocController.invoke:125 - Invoke action for '/index' using ro.videanuadrian.sh.action.IndexAction#view
80291 [DEBUG] j.j.i.LocalizationUtil.setRequestBundleName:78 - Bundle name for this request: ro.videanuadrian.sh.action.IndexAction
80297 [DEBUG] j.j.JtxTransactionManager.requestTransaction:272 - Requesting TX jtx{Required,readonly,Read Committed,-1}
80299 [DEBUG] j.j.JtxTransaction.<init>:102 - New JTX {status:Active, mode:jtx{Required,readonly,Read Committed,-1}}
80321 [DEBUG] j.d.j.DbJtxSessionProvider.getDbSession:57 - Requesting db TX manager session
80322 [DEBUG] j.d.DbSession.<init>:60 - Creating new db session
80323 [DEBUG] j.d.j.DbJtxResourceManager.beginTransaction:71 - begin jtx
80325 [DEBUG] j.d.DbSession.beginTransaction:242 - Beginning transaction
80325 [DEBUG] j.d.p.CoreConnectionPool.getConnection:256 - Returning valid pooled connection
80443 [DEBUG] j.d.DbQueryBase.execute:686 - Executing statement: SELECT tt.id, tt.sensor_id, tt.temperature, tt.timestamp FROM sh_temperature_log tt WHERE tt.timestamp>1577460508000 ORDER BY tt.id ASC
80503 [DEBUG] j.d.DbQueryBase.execute:704 - execution time: 70ms
80526 [DEBUG] j.j.w.LeanJtxWorker.maybeCommitTransaction:93 - commit tx
80526 [DEBUG] j.j.JtxTransaction.commitOrRollback:255 - Commit JTX
80526 [DEBUG] j.d.j.DbJtxResourceManager.commitTransaction:83 - commit jtx
80526 [DEBUG] j.d.DbSession.commitTransaction:254 - Committing transaction
80614 [DEBUG] j.d.DbSession.closeSession:84 - Closing db session
[TemperatureLog [sensorId=1, timestamp=1577535822000, temperature=23.0], TemperatureLog [sensorId=1, timestamp=1577535826000, temperature=24.0], TemperatureLog [sensorId=1, timestamp=1577535829000, temperature=25.0], TemperatureLog [sensorId=1, timestamp=1577535844000, temperature=26.5]]
80623 [DEBUG] j.m.c.MadvocController.render:202 - Result type: ServletDispatcherActionResult
80623 [DEBUG] j.m.r.AbstractTemplateViewActionResult.render:91 - new target: /index:
80623 [DEBUG] j.m.r.ServletDispatcherActionResult.targetExists:105 - target check: /index.jspf
80624 [DEBUG] j.m.r.ServletDispatcherActionResult.targetExists:105 - target check: /index.jsp
80625 [DEBUG] j.m.r.AbstractTemplateViewActionResult.render:102 - target found: /index.jsp
but in the view I only get:
${tl.temperature}
it's like the result it's not reaching the view engine. I've made some debug and it seems that the actionResult is null.
Any idea what I`m doing wrong?
Thanks
P.S. I have tried the toturial and I have the same issue:
Messages
${msg.messageId} ${msg.text}
${resp.responseId} ${resp.text}
new message...
REST APi: message 1
that is the output that I have

This should work. Here is a working example:
#MadvocAction
public class FooAction {
#Out
List<Integer> temps;
#Action
public void view() {
temps = new ArrayList<>();
temps.add(30);
temps.add(20);
System.out.println(temps);
}
}
This action is mapped to /foo. This is important! You need to call the action, not the .jsp in your browser. My foo.jsp code looks like yours:
Temperatures:
<j:iter items="${temps}" var="tl">
${tl}<br/>
</j:iter>
So, it really should work.
Maybe you can use Jodd-Joy: it is a predefined Jodd bundle. It displays the list of link nicely on the beginning, like this:
If you want, you can send me your code/example.

Related

ejabberd ACME unexpected content type when it receives certificate

I am running a processone/ejabberd container that i am trying to get to request a certificate via ACME to a smallstep ca container. The request fails with this error:
#{<<"kid">> =>
<<"https://ca.mydomain.local:8000/acme/acme/account/svUkT7QwXD4pBqyrVdys94VMeVCeeo0D">>,
<<"nonce">> =>
<<"..">>,
<<"url">> =>
<<"https://ca.mydomain.local:8000/acme/acme/certificate/Jks2zJjdJwqDzE7VSsLM0TOaAzzYUB2P">>}}
2022-11-07 08:30:28.355858+00:00 [debug] HTTP request: {post,{"https://ca.mydomain.local:8000/acme/acme/certificate/Jks2zJjdJwqDzE7VSsLM0TOaAzzYUB2P",
[],"application/jose+json",
<<"{\"signature\":\"....\",\"protected\":\"......\",\"payload\":\"\"}">>}}
2022-11-07 08:30:28.608072+00:00 [debug] HTTP response: {{"HTTP/1.1",200,"OK"},
[{"cache-control","no-store"},
{"date","Mon, 07 Nov 2022 08:30:28 GMT"},
{"content-length","2108"},
{"content-type",
"application/pem-certificate-chain; charset=utf-8"},
{"link",
"<https://ca.mydomain.local:8000/acme/acme/directory>;rel=\"index\""},
{"replay-nonce",
".."}],
<<"-----BEGIN CERTIFICATE-----........\n-----END CERTIFICATE-----\n-----BEGIN CERTIFICATE-----........\n-----END CERTIFICATE-----\n">>}
2022-11-07 08:30:28.609162+00:00 [error] Failed to request certificate for jabber-gw.mydomain.me: HTTP error: unexpected content type: application/pem-certificate-chain; charset=utf-8
2022-11-07 08:30:28.609456+00:00 [debug] Unregistering ACME challenge #Ref<0.1802325958.1657798659.124306>
2022-11-07 08:35:26.914567+00:00 [debug] Error when retrieving http headers gen_tcp: timeout
Any ideas on why its not happy with the content type and how to resolve?
Prior to the error message, the logs show what looks like a successful ACME challenge:
[<<".well-known">>,<<"acme-challenge">>,
<<"3rNIelLxSuDU0tWZgb3yEw5sL6d6Z61J">>] matches [<<".well-known">>,
<<"acme-challenge">>]
2022-11-04 04:28:12.436337+00:00 [debug] Received ACME challenge request for token: blah
2022-11-04 04:28:12.546710+00:00 [debug] HTTP response: {{"HTTP/1.1",200,"OK"},
The smallstep container was built with this great blog.

Ejabberd api set_vcard database_failure

When I use the following command for the ejabberd API I get the following response;
curl -ik -X POST -H 'Authorization: Bearer xxxxxxxxxxx' https://localhost:5280/api/set_vcard -d '{"user":"foo","host":"example.com","name":"FN","content":"foobar"}'
HTTP/1.1 400 Bad Request
Content-Length: 18
Content-Type: application/json
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: Content-Type, Authorization, X-Admin
"database_failure"
On the ejabberd log (level 5) I see this;
[info] (<0.607.0>) Accepted connection ::ffff:172.18.0.1:46622 -> ::ffff:172.18.0.3:5280
[debug] S: [{[<<"ws">>],ejabberd_http_ws},{[<<"bosh">>],mod_bosh},{[<<"oauth">>],ejabberd_oauth},{[<<"api">>],mod_http_api},{[<<"admin">>],ejabberd_web_admin}]
[debug] ({tlssock,#Port<0.18819>,#Ref<0.650175335.3240493057.203147>}) http query: 'POST' <<"/api/set_vcard">>
[debug] client data: <<"{\"user\":\"foo\",\"host\":\"example.com\",\"contents\":[\"FN:foobar\"]}">>
[debug] [<<"api">>,<<"set_vcard">>] matches [<<"api">>]
[info] API call set_vcard [{<<"user">>,<<"foo">>},{<<"host">>,<<"example.com">>},{<<"contents">>,[<<"FN:foobar">>]}] from ::ffff:172.18.0.1:46622
[debug] Command 'set_vcard' execution allowed by rule 'api service' (CallerInfo=#{caller_module => mod_http_api,caller_server => <<"example.com">>,ip => {0,0,0,0,0,65535,44050,1},oauth_scope => [<<"ejabberd:api-service">>],usr => {<<"admin">>,<<"example.com">>,<<>>}})
[debug] Executing command mod_admin_extra:set_vcard with Args=[<<"foo">>,<<"example.com">>,<<>>,<<>>,[<<"FN:foobar">>]]
It is using MySQL as a database (working fine for everything else) however when I watch the database general query log I don't see my API request trigger any queries. I see all the other normal ejabberd queries so there isn't a problem with the db connection and as mentioned earlier everything else works.
$ ejabberdctl status
The node ejabberd#e87da11aa894 is started with status: started
ejabberd 18.4.0 is running in that node
Does anyone have any clues they can throw my way? I've ran out of leads on what could be the issue.
!!! EDIT !!!
Work around
As mentioned in https://github.com/processone/ejabberd/issues/2629 other people have experienced this issue. Changing config to disable the cache and clearing the vcard table in the database seems to be a work around;
SQL:
DELETE FROM vcard;
Config:
...
mod_vcard:
search: false
use_cache: false
...
The API is fairly permissive in what it allows, however once it's in the database the record will fail to load.
For 'set_vcard', the 'name 'is the field name you wish to alter and the content is the contents of that field.
{
"user": "catman",
"host": "the.host",
"name": "FN",
"content": "Cat Man"
}
ejabberd also caches queries, so once you have a barfed record it'll return 'database_failed' even if you've corrected your api call or fixed it in the database by hand. Caching can be disabled under the modules configuration.
Notice in your log that it says:
[debug] client data: <<"{\"user\":\"foo\",\"host\":\"example.com\",\"contents\":[\"FN:foobar\"]}">>
How can it be that contents is FN:foobar? I installed 18.04, setup mysql storage, and running this query:
$ curl -v -H "X-Admin: true" -H "Content-Type:application/json" http://localhost:5280/api/set_vcard -d '{"user":"user1","host":"localhost","name":"FN","content":"mi nombre curllll"}'
The log says:
21:42:29.638 [info] (<0.487.0>) Accepted connection 127.0.0.1:58412 -> 127.0.0.1:5280
21:42:29.638 [debug] S: [{[<<"api">>],mod_http_api},{[<<"bosh">>],mod_bosh},{[<<"oauth">>],ejabberd_oauth},{[<<"presence">>],mod_webpresence},{[<<"register">>],mod_register_web},{[<<"rest">>],mod_rest},{[<<"ws">>],ejabberd_http_ws},{[<<"admin">>],ejabberd_web_admin}]
21:42:29.639 [debug] (#Port<0.18079>) http query: 'POST' <<"/api/set_vcard">>
21:42:29.639 [debug] client data: <<"{\"user\":\"user1\",\"host\":\"localhost\",\"name\":\"FN\",\"content\":\"mi nombre curllll\"}">>
21:42:29.639 [debug] [<<"api">>,<<"set_vcard">>] matches [<<"api">>]
21:42:29.639 [info] API call set_vcard [{<<"user">>,<<"user1">>},{<<"host">>,<<"localhost">>},{<<"name">>,<<"FN">>},{<<"content">>,<<"mi nombre curllll">>}] from 127.0.0.1:58412
21:42:29.640 [debug] Command 'set_vcard' execution allowed by rule 'test commands' (CallerInfo=#{caller_module => mod_http_api,ip => {127,0,0,1}})
21:42:29.640 [debug] Executing command mod_admin_extra:set_vcard with Args=[<<"user1">>,<<"localhost">>,<<"FN">>,<<"mi nombre curllll">>]
21:42:29.640 [debug] SQL: "select vcard from vcard where username='user1' and 0=0"
21:42:29.642 [debug] SQL: "begin;"
21:42:29.642 [debug] SQL: "UPDATE vcard SET vcard='<vCard xmlns=''vcard-temp''><FN>mi nombre curllll</FN><N><FAMILY>mi familia11</FAMILY></N><NICKNAME>mi apodoooooooooooooooooooo11</NICKNAME><PHOTO><BINVAL>R0lGODlhDwAPAJECAP//AAAAAP///wAAACH5BAEAAAIALAAAAAAPAA8AAAIulB2Zx5IA4WIhWnnqvQFJDTyhE4khaG5Wqn4tp4ErFnMY+Sll9naUfGpkFL5DAQA7</BINVAL><TYPE>image/gif</TYPE></PHOTO></vCard>' WHERE username='user1'"
21:42:29.644 [debug] SQL: "UPDATE vcard_search SET username='user1', fn='mi nombre curllll', lfn='mi nombre curllll', family='mi familia11', lfamily='mi familia11', given='', lgiven='', middle='', lmiddle='', nickname='mi apodoooooooooooooooooooo11', lnickname='mi apodoooooooooooooooooooo11', bday='', lbday='', ctry='', lctry='', locality='', llocality='', email='', lemail='', orgname='', lorgname='', orgunit='', lorgunit='' WHERE lusername='user1'"
21:42:29.658 [debug] SQL: "commit;"

Switching to webview context will got exception "chrome not reachable" after resetApp

Environment
Appium : 1.6.4
OS : Ubuntu 16.04 64bit
Node.js : 7.9.0
Android : 5.1
Device :1501-M02
API :java
Appium CLI
Details
I am using spock as test framework,with blow code:
class Test{
AndroidDriver<RemoteWebElement> driver;
DesiredCapabilities cap=DesiredCapabilities.android();
........
def setup(){
//setup driver
.....
cap.setCapability(NO_RESET, "true");
cap.setCapability(FULL_RESET, "false");
.....
cap.setCapability(RECREATE_CHROME_DRIVER_SESSIONS, "true");
.......
driver.context("WEBVIEW_com.domain.pkg");
}
def "test1"(){}
def "test2"(){}
def cleanup(){
driver.resetApp();
}
}
In eclipse,If right clicking test1 or test2->run as->junit test,both two run as expected,but if right clicking Test(class)->run as->junit test,the first test works,and the second test will throw exception:
org.openqa.selenium.WebDriverException: chrome not reachable
(Session info: webview=39.0.0.0)
(Driver info: chromedriver=2.28.455506
if replacing cleanup() with this:
def cleanup(){
driver.quit();
}
all works as expected,but each test will reinitialize a lot of staff which wastes huge time,
so
driver.resetApp()
not work as expected,is this a bug or do I do something wrong?
appium log like this:
[debug] [ADB] Running '/opt/android-sdk/platform-tools/adb' with args: ["-P",5037,"-s","MB8DW44999999999","shell","am","force-stop","com.vsi.pd.doctor"]
[debug] [MJSONWP] Responding to client with driver.closeApp() result: null
[HTTP] <-- POST /wd/hub/session/ebe4a8b1-844c-49f3-9997-9bc1bc0dd8a2/appium/app/close 200 1099 ms - 76
[HTTP] --> POST /wd/hub/session/ebe4a8b1-844c-49f3-9997-9bc1bc0dd8a2/appium/app/launch {}
[debug] [MJSONWP] Calling AppiumDriver.launchApp() with args: ["ebe4a8b1-844c-49f3-9997-9bc1bc0dd8a2"]
[AndroidDriver] No app sent in, not parsing package/activity
[debug] [AndroidDriver] No app capability. Assuming it is already on the device
[debug] [ADB] Device API level: 22
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running '/opt/android-sdk/platform-tools/adb' with args: ["-P",5037,"-s","MB8DW44999999999","shell","am","start","-W","-n","com.vsi.pd.doctor/.MainActivity","-S","-a","android.intent.action.MAIN","-c","android.intent.category.LAUNCHER","-f","0x10200000"]
[debug] [MJSONWP] Responding to client with driver.launchApp() result: null
[HTTP] <-- POST /wd/hub/session/ebe4a8b1-844c-49f3-9997-9bc1bc0dd8a2/appium/app/launch 200 1987 ms - 76
[HTTP] --> POST /wd/hub/session/ebe4a8b1-844c-49f3-9997-9bc1bc0dd8a2/context {"name":"WEBVIEW_com.vsi.pd.doctor"}
[debug] [MJSONWP] Calling AppiumDriver.setContext() with args: ["WEBVIEW_com.vsi.pd.doctor","ebe4a8b1-844c-49f3-9997-9bc1bc0dd8a2"]
[debug] [AndroidDriver] Getting a list of available webviews
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running '/opt/android-sdk/platform-tools/adb' with args: ["-P",5037,"-s","MB8DW44999999999","shell","cat","/proc/net/unix"]
[debug] [AndroidDriver] WEBVIEW_17929 mapped to pid 17929
[debug] [AndroidDriver] Getting process name for webview
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running '/opt/android-sdk/platform-tools/adb' with args: ["-P",5037,"-s","MB8DW44999999999","shell","ps"]
[debug] [AndroidDriver] Parsed pid: 17929 pkg: com.vsi.pd.doctor!
[debug] [AndroidDriver] from: u0_a181,17929,274,1666480,109536,ffffffff,00000000,S,com.vsi.pd.doctor
[debug] [AndroidDriver] returning process name: com.vsi.pd.doctor
[debug] [AndroidDriver] Found webviews: ["WEBVIEW_com.vsi.pd.doctor"]
[debug] [AndroidDriver] Available contexts: ["NATIVE_APP","WEBVIEW_com.vsi.pd.doctor"]
[debug] [MJSONWP] Responding to client with driver.setContext() result: null
[HTTP] <-- POST /wd/hub/session/ebe4a8b1-844c-49f3-9997-9bc1bc0dd8a2/context 200 117 ms - 76
[HTTP] --> POST /wd/hub/session/ebe4a8b1-844c-49f3-9997-9bc1bc0dd8a2/element {"using":"id","value":"login"}
[MJSONWP] Driver proxy active, passing request on via HTTP proxy
[debug] [JSONWP Proxy] Proxying [POST /wd/hub/session/ebe4a8b1-844c-49f3-9997-9bc1bc0dd8a2/element] to [POST http://127.0.0.1:8000/wd/hub/session/eb87d1b86ef6331102013b50ee2c0ea4/element] with body: {"using":"id","value":"login"}
[debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"eb87d1b86ef6331102013b50ee2c0ea4","status":100,"value":{"message":**"chrome not reachable**\n (Session info: webview=39.0.0.0)\n (Driver info: chromedriver=2.28.455506 (18f6627e265f442aeec9b6661a49fe819aeeea1f),platform=Linux 4.4.0-75-generic x86_64)"}}
[JSONWP Proxy] Replacing sessionId eb87d1b86ef6331102013b50ee2c0ea4 with ebe4a8b1-844c-49f3-9997-9bc1bc0dd8a2
[HTTP] <-- POST /wd/hub/session/ebe4a8b1-844c-49f3-9997-9bc1bc0dd8a2/element 200 13 ms - 269
[HTTP] --> POST /wd/hub/session/ebe4a8b1-844c-49f3-9997-9bc1bc0dd8a2/appium/app/close {}
[debug] [MJSONWP] Calling AppiumDriver.closeApp() with args: ["ebe4a8b1-844c-49f3-9997-9bc1bc0dd8a2"]
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running '/opt/android-sdk/platform-tools/adb' with args: ["-P",5037,"-s","MB8DW44999999999","shell","am","force-stop","com.vsi.pd.doctor"]
[debug] [MJSONWP] Responding to client with driver.closeApp() result: null
With new UIautomator you don't need to switch your driver to webview. It has built in capabilities to identify the elements inside webView.
Please update your Android SDK once.
Elements inside WebView will be visible in UIAutomator for Android Version 6.0+ versions. However, once you automate the script for Android 6.0+ device, you can use the same script for Android version below 6.0.
And also you can see the elements inside webView on Android 6.0+ devices using UIAutomator.

javax.mail.sendfailedexception sending failed nested exception is class javax.mail.MessagingException

It give error about some problem with STARTTLS command .
it gives the error like this
javax.mail.sendfailedexception sending failed nested exception is class javax.mail.MessagingException
So please help me out of it.
Java Code
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
public class MailDemo {
public static void main(String[] args) {
Properties properties=new Properties();
properties.put("mail.smtp.auth", "true");
properties.put("mail.smtp.starttls.enable","true");
properties.put("mail.smtp.host","smtp.gmail.com");
properties.put("mail.smtp.port", "587");
Scanner scn=new Scanner(System.in);
System.out.println("Username for Authentication :");
final String username=scn.nextLine();
System.out.println("Password for Authentication :");
final String password=scn.nextLine();
System.out.println("From Email..");
String fromEmailAddrs=scn.nextLine();
System.out.println("To Email..");
String toEmail=scn.nextLine();
System.out.println("Subject..");
String subject=scn.nextLine();
System.out.println("Message..");
String textMessage=scn.nextLine();
Session session=Session.getDefaultInstance(properties,new Authenticator() {
#Override
protected javax.mail.PasswordAuthentication getPasswordAuthentication(){
return new javax.mail.PasswordAuthentication(username, password);
}
});
try{
Message msg=new MimeMessage(session);
msg.setFrom(new InternetAddress(fromEmailAddrs));
msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse(toEmail));
msg.setSubject(subject);
msg.setText(textMessage);
Transport.send(msg);
System.out.println("/n Your Message Delivered Succesfully");
}
catch(MessagingException m){
throw new RuntimeException(m);
}
}
}
Console
Username for Authentication :
bijaybhaskar01
Password for Authentication :
abcdef#456789
From Email..
bijaybhaskar01#gmail.com
To Email..
bbswain1001#gmail.com
Subject..
Hello
Message..
hai
Output
Exception in thread "main" java.lang.RuntimeException: javax.mail.SendFailedException: Sending failed;
nested exception is:
class javax.mail.MessagingException: 530 5.7.0 Must issue a STARTTLS command first. fh14sm3131583pab.31 - gsmtp
at com.mail.bhaskar.MailDemo.main(MailDemo.java:52)
Caused by: javax.mail.SendFailedException: Sending failed;
nested exception is:
class javax.mail.MessagingException: 530 5.7.0 Must issue a STARTTLS command first. fh14sm3131583pab.31 - gsmtp
at javax.mail.Transport.send0(Transport.java:218)
at javax.mail.Transport.send(Transport.java:80)
at com.mail.bhaskar.MailDemo.main(MailDemo.java:48)
Debug output
DEBUG: JavaMail version 1.3.1
DEBUG: java.io.FileNotFoundException: C:\Program Files\Java\jre1.8.0_77\lib\javamail.providers (The system cannot find the file specified)
DEBUG: URL jar:file:/E:/Study/Java/Jars/MailJars/gimap.jar!/META-INF/javamail.providers
DEBUG: successfully loaded resource: jar:file:/E:/Study/Java/Jars/MailJars/gimap.jar!/META-INF/javamail.providers
DEBUG: URL jar:file:/E:/Study/Java/Jars/MailJars/imap.jar!/META-INF/javamail.providers
DEBUG: successfully loaded resource: jar:file:/E:/Study/Java/Jars/MailJars/imap.jar!/META-INF/javamail.providers
DEBUG: URL jar:file:/E:/Study/Java/Jars/MailJars/pop3.jar!/META-INF/javamail.providers
DEBUG: successfully loaded resource: jar:file:/E:/Study/Java/Jars/MailJars/pop3.jar!/META-INF/javamail.providers
DEBUG: URL jar:file:/E:/Study/Java/Jars/MailJars/smtp.jar!/META-INF/javamail.providers
DEBUG: successfully loaded resource: jar:file:/E:/Study/Java/Jars/MailJars/smtp.jar!/META-INF/javamail.providers
DEBUG: successfully loaded resource: /META-INF/javamail.default.providers
DEBUG: Tables of loaded providers
DEBUG: Providers Listed By Class Name: {com.sun.mail.smtp.SMTPSSLTransport=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Oracle], 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,Oracle], com.sun.mail.gimap.GmailSSLStore=javax.mail.Provider[STORE,gimaps,com.sun.mail.gimap.GmailSSLStore,Oracle], com.sun.mail.pop3.POP3SSLStore=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Oracle], com.sun.mail.imap.IMAPStore=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc], com.sun.mail.gimap.GmailStore=javax.mail.Provider[STORE,gimap,com.sun.mail.gimap.GmailStore,Oracle], com.sun.mail.pop3.POP3Store=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc]}
DEBUG: Providers Listed By Protocol: {imaps=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Oracle], imap=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Oracle], gimap=javax.mail.Provider[STORE,gimap,com.sun.mail.gimap.GmailStore,Oracle], smtps=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Oracle], pop3=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Oracle], smtp=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Oracle], pop3s=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Oracle], gimaps=javax.mail.Provider[STORE,gimaps,com.sun.mail.gimap.GmailSSLStore,Oracle]}
DEBUG: successfully loaded resource: /META-INF/javamail.default.address.map
DEBUG: URL jar:file:/E:/Study/Java/Jars/MailJars/smtp.jar!/META-INF/javamail.address.map
DEBUG: successfully loaded resource: jar:file:/E:/Study/Java/Jars/MailJars/smtp.jar!/META-INF/javamail.address.map
DEBUG: java.io.FileNotFoundException: C:\Program Files\Java\jre1.8.0_77\lib\javamail.address.map (The system cannot find the file specified)
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Oracle]
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: trying to connect to host "smtp.gmail.com", port 587
220 smtp.gmail.com ESMTP n6sm3627811pfa.2 - gsmtp
DEBUG SMTP: connected to host "smtp.gmail.com", port: 587
EHLO Bhaskar
250-smtp.gmail.com at your service, [119.82.116.106]
250-SIZE 35882577
250-8BITMIME
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-PIPELINING
250 SMTPUTF8
DEBUG SMTP: Found extension "SIZE", arg "35882577"
DEBUG SMTP: Found extension "8BITMIME", arg ""
DEBUG SMTP: Found extension "STARTTLS", arg ""
DEBUG SMTP: Found extension "ENHANCEDSTATUSCODES", arg ""
DEBUG SMTP: Found extension "PIPELINING", arg ""
DEBUG SMTP: Found extension "SMTPUTF8", arg ""
DEBUG SMTP: use8bit false
MAIL FROM:<bijaybhaskar01#gmail.com>
530 5.7.0 Must issue a STARTTLS command first. n6sm3627811pfa.2 - gsmtp
QUIT
You're using JavaMail 1.3.1, which is ancient and does not support STARTTLS.
Upgrade to a newer version.

ESB Mule Client staring with xml-properties fails

I use Mule 3.x
I have a code that tests MuleClient connectivity.
This test is ok and works proper way:
public void testHello() throws Exception
{
MuleClient client = new MuleClient(muleContext);
MuleMessage result = client.send("http://127.0.0.1:8080/hello", "some data", null);
assertNotNull(result);
assertNull(result.getExceptionPayload());
assertFalse(result.getPayload() instanceof NullPayload);
//TODO Assert the correct data has been received
assertEquals("hello", result.getPayloadAsString());
}
But this tes is not ok - it fail with an connection exceptions:
public void testHello_with_Spring() throws Exception {
MuleClient client = new MuleClient("mule-config-test.xml");
client.getMuleContext().start();
//it fails here
MuleMessage result = client.send("http://127.0.0.1:8080/hello", "some data", null);
assertNotNull(result);
assertNull(result.getExceptionPayload());
assertFalse(result.getPayload() instanceof NullPayload);
//TODO Assert the correct data has been received
assertEquals("hello", result.getPayloadAsString());
}
The 'mule-config-test.xml' is used in both tests, the path for this file is ok, i checked.
This is error message I have in the end:
Exception stack is:
1. Address already in use (java.net.BindException) java.net.PlainSocketImpl:-2 (null)
2. Failed to bind to uri "http://127.0.0.1:8080/hello" (org.mule.transport.ConnectException)
org.mule.transport.tcp.TcpMessageReceiver:81
(http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/transport/ConnectException.html)
-------------------------------------------------------------------------------- Root Exception stack trace: java.net.BindException: Address already in
use at java.net.PlainSocketImpl.socketBind(Native Method) at
java.net.PlainSocketImpl.bind(PlainSocketImpl.java:383) at
java.net.ServerSocket.bind(ServerSocket.java:328)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
[10-05 16:33:37] ERROR HttpConnector [main]:
org.mule.transport.ConnectException: Failed to bind to uri
"http://127.0.0.1:8080/hello" [10-05 16:33:37] ERROR ConnectNotifier
[main]: Failed to connect/reconnect: HttpConnector {
name=connector.http.mule.default lifecycle=stop this=7578a7d9
numberOfConcurrentTransactedReceivers=4
createMultipleTransactedReceivers=true connected=false
supportedProtocols=[http] serviceOverrides= } . Root Exception
was: Address already in use. Type: class java.net.BindException [10-05
16:33:37] ERROR DefaultSystemExceptionStrategy [main]: Failed to bind
to uri "http://127.0.0.1:8080/hello"
org.mule.api.lifecycle.LifecycleException: Cannot process event as
"connector.http.mule.default" is stopped
I think the problem is in what you're not showing: testHello_with_Spring() is probably executing while Mule is already running. The second Mule you're starting in it then port-conflicts with the other one.
Are testHello() and testHello_with_Spring() in the same test suite? If yes, seeing that testHello() relies on an already running Mule, I'd say that would be the cause of port conflict for testHello_with_Spring().