DataAccessException: Deadlock found when trying to get lock; try restarting transaction - mysql

I'm having a method addEvent() which is adding event records from a webhook REST controller:
public void addEvent(String subscriptionToken, DateTime eventTimestamp, SubscriptionEventType subscriptionEventType) {
LOGGER.debug("Adding event: " + subscriptionEventType.name());
this.ctx.transaction(configuration -> {
// Transaction code ..
});
}
The problem I am facing is that if two webhooks come in at the same time I am getting a DataAccessException:
[http-bio-8080-exec-6] DEBUG com.mz.server.rest.braintree.webhooks.BraintreeWebhooksRestController - Webhook kind: SUBSCRIPTION_WENT_ACTIVE
[http-bio-8080-exec-6] DEBUG com.mz.server.repository.jooq.payment.PaymentGatewaySubscriptionEventRepository - Adding event: WENT_ACTIVE
[http-bio-8080-exec-6] DEBUG com.mz.server.spring.SpringTransactionProvider - ##### begin #####
[http-bio-8080-exec-6] INFO com.mz.server.spring.SpringTransaction - SpringTransaction Ctor()
[http-bio-8080-exec-3] DEBUG com.mz.server.rest.braintree.webhooks.BraintreeWebhooksRestController - Webhook kind: SUBSCRIPTION_CHARGED_SUCCESSFULLY
[http-bio-8080-exec-3] DEBUG com.mz.server.repository.jooq.payment.PaymentGatewaySubscriptionEventRepository - Adding event: CHARGED_SUCCESSFULLY
[http-bio-8080-exec-3] DEBUG com.mz.server.spring.SpringTransactionProvider - ##### begin #####
[http-bio-8080-exec-3] INFO com.mz.server.spring.SpringTransaction - SpringTransaction Ctor()
[http-bio-8080-exec-6] DEBUG com.mz.server.spring.SpringTransactionProvider - ##### commit #####
[http-bio-8080-exec-6] DEBUG com.mz.server.spring.auth.CustomHttpSessionListener - Unhandled event
[http-bio-8080-exec-3] DEBUG com.mz.server.spring.SpringTransactionProvider - ##### rollback #####
[http-bio-8080-exec-3] ERROR com.mz.server.rest.braintree.webhooks.BraintreeWebhooksRestController -
org.jooq.exception.DataAccessException: SQL [update `mz_db`.`payment_gateway_subscription` set `mz_db`.`payment_gateway_subscription`.`subscription_event_type_id` = ? where `mz_db`.`payment_gateway_subscription`.`id` = ?]; Deadlock found when trying to get lock; try restarting transaction
at org.jooq.impl.Utils.translate(Utils.java:1690)
at org.jooq.impl.DefaultExecuteContext.sqlException(DefaultExecuteContext.java:660)
at org.jooq.impl.AbstractQuery.execute(AbstractQuery.java:356)
at org.jooq.impl.AbstractDelegatingQuery.execute(AbstractDelegatingQuery.java:133)
at com.mz.server.repository.jooq.payment.PaymentGatewaySubscriptionEventRepository.lambda$0(PaymentGatewaySubscriptionEventRepository.java:73)
at org.jooq.impl.DefaultDSLContext$1.run(DefaultDSLContext.java:370)
at org.jooq.impl.DefaultDSLContext$1.run(DefaultDSLContext.java:367)
at org.jooq.impl.DefaultDSLContext.transactionResult(DefaultDSLContext.java:339)
at org.jooq.impl.DefaultDSLContext.transaction(DefaultDSLContext.java:367)
What can I do about that?
I don't understand why I'm getting this. It appears that the rows I'm accessing are getting locked and the next thread that comes in chokes on that. Is there a sane way to handle this issue? It's the first time I'm seeing this exception. Since this is the backend of a larger web application I'm not really looking forward to see something like that in production.. although at the moment I fear that this will happen if I do nothing about this.

Related

Getting a reference error on gatsby build

I’ve been working on my project as usual, it was working fine. When I tried to do gatsby build it got this error message:
ReferenceError: Cannot access '_404' before initialization
and
ReferenceError: Cannot access '_mdx_slug_' before initialization
I haven’t added anything that should cause this, though I don’t really understand where the problem is coming from. It seems to refer to the way gatsby builds the pages of the website but I’m not experienced enough to know for sure.
gatsby build full:
success load gatsby config - 0.041s
success load plugins - 0.757s
success onPreInit - 0.029s
success initialize cache - 0.046s
success copy gatsby files - 0.183s
success Compiling Gatsby Functions - 0.185s
success onPreBootstrap - 0.201s
success createSchemaCustomization - 0.011s
success Checking for changed pages - 0.001s
success source and transform nodes - 0.511s
info Writing GraphQL type definitions to /home/daniel_gray/GatsbyProjects/watchsdarot/.cache/schema.gql
warn There are conflicting field types in your data.
If you have explicitly defined a type for those fields, you can safely ignore this warning message.
Otherwise, Gatsby will omit those fields from the GraphQL schema.
If you know all field types in advance, the best strategy is to explicitly define them with the `createTypes` action, and skip inference with the `#dontInfer` directive.
See https://www.gatsbyjs.com/docs/actions/#createTypes
Mdx.frontmatter.EpisodeNum:
- type: number
value: 10
- type: string
value: '09'
Mdx.frontmatter.NumOfEpisodes:
- type: number
value: 10
- type: string
value: '09'
success building schema - 0.469s
success createPages - 0.002s
success createPagesStatefully - 0.336s
info Total nodes: 329, SitePage nodes: 86 (use --verbose for breakdown)
success Checking for changed pages - 0.005s
success Cleaning up stale page-data - 0.010s
success onPreExtractQueries - 0.001s
success extract queries from components - 2.813s
success write out redirect data - 0.010s
success Build manifest and related icons - 0.565s
success onPostBootstrap - 0.609s
info bootstrap finished - 9.239s
success write out requires - 0.048s
success Building production JavaScript and CSS bundles - 8.175s
⠼ Building HTML renderer
[============================] 10.041 s 7/7 100% Running gatsby-plugin-sharp.IMAGE_PROCESSING jobs
<w> [webpack.cache.PackFileCacheStrategy] Skipped not serializable cache item 'mini-css-extract-plugin /home/daniel_gray/GatsbyProjects/watchsdarot/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[10].oneOf[0].use[1]!/home/daniel_gray/GatsbyProjects/watchsdarot/node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[10].oneOf[0].use[2]!/home/daniel_gray/GatsbyProjects/watchsdarot/src/components/footer.module.css|0|Compilation/modules|/home/daniel_gray/GatsbyProjects/watchsdarot/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[10].oneOf[0].use[1]!/home/daniel_gray/GatsbyProjects/watchsdar
⠴ Building HTML renderer
[============================] 10.041 s 7/7 100% Running gatsby-plugin-sharp.IMAGE_PROCESSING jobs
<w> [webpack.cache.PackFileCacheStrategy] Skipped not serializable cache item 'Compilation/modules|/home/daniel_gray/GatsbyProjects/watchsdarot/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[9].oneOf[0].use[0]!/home/daniel_gray/GatsbyProjects/watchsdarot/node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[9].oneOf[0].use[1]!/home/daniel_gray/GatsbyProjects/watchsdarot/src/components/foote
success Building HTML renderer - 22.328s
success Execute page configs - 0.028s
success Caching Webpack compilations - 0.002s
success run queries in workers - 0.133s - 78/78 585.57/s
success Running gatsby-plugin-sharp.IMAGE_PROCESSING jobs - 32.550s - 7/7 0.22/s
success Merge worker state - 0.002s
success Rewriting compilation hashes - 0.002s
success Writing page-data.json files to public directory - 0.048s - 79/79 1656.57/s
[ ] 0.000 s 0/85 0% Building static HTML for pages
/home/daniel_gray/GatsbyProjects/watchsdarot/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js:53
throw ex;
^
ReferenceError: Cannot access '_404' before initialization
at Module.default (/home/daniel_gray/GatsbyProjects/watchsdarot/.cache/page-ssr/routes/component---src-pages-404-js.js:182:35)
at RouteHandler.render (/home/daniel_gray/GatsbyProjects/watchsdarot/.cache/page-ssr/routes/webpack:/watchsdarot/.cache/static-entry.js:229:57)
at Ic (/home/daniel_gray/GatsbyProjects/watchsdarot/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:66:30)
at Kc (/home/daniel_gray/GatsbyProjects/watchsdarot/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:68:210)
at Z (/home/daniel_gray/GatsbyProjects/watchsdarot/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:74:89)
at Kc (/home/daniel_gray/GatsbyProjects/watchsdarot/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:72:13)
at Z (/home/daniel_gray/GatsbyProjects/watchsdarot/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:74:89)
at Lc (/home/daniel_gray/GatsbyProjects/watchsdarot/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:77:98)
at Kc (/home/daniel_gray/GatsbyProjects/watchsdarot/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:69:131)
at Z (/home/daniel_gray/GatsbyProjects/watchsdarot/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:74:89)
at Ic (/home/daniel_gray/GatsbyProjects/watchsdarot/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:66:373)
at Kc (/home/daniel_gray/GatsbyProjects/watchsdarot/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:68:210)
at Z (/home/daniel_gray/GatsbyProjects/watchsdarot/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:74:89)
at Kc (/home/daniel_gray/GatsbyProjects/watchsdarot/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:72:271)
at Z (/home/daniel_gray/GatsbyProjects/watchsdarot/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:74:89)
at Kc (/home/daniel_gray/GatsbyProjects/watchsdarot/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:68:481)
Emitted 'error' event on WritableAsPromise instance at:
at emitErrorNT (node:internal/streams/destroy:157:8)
at emitErrorCloseNT (node:internal/streams/destroy:122:3)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
at runNextTicks (node:internal/process/task_queues:65:3)
failed Building static HTML for pages - 2.072s
/home/daniel_gray/GatsbyProjects/watchsdarot/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js:53
throw ex;
^
ReferenceError: Cannot access '_mdx_slug_' before initialization
at Module.default (/home/daniel_gray/GatsbyProjects/watchsdarot/.cache/page-ssr/routes/component---src-pages-player-mdx-slug-js.js:278:35)
at RouteHandler.render (/home/daniel_gray/GatsbyProjects/watchsdarot/.cache/page-ssr/routes/webpack:/watchsdarot/.cache/static-entry.js:229:57)
at Ic (/home/daniel_gray/GatsbyProjects/watchsdarot/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:66:30)
at Kc (/home/daniel_gray/GatsbyProjects/watchsdarot/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:68:210)
at Z (/home/daniel_gray/GatsbyProjects/watchsdarot/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:74:89)
at Kc (/home/daniel_gray/GatsbyProjects/watchsdarot/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:72:13)
at Z (/home/daniel_gray/GatsbyProjects/watchsdarot/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:74:89)
at Lc (/home/daniel_gray/GatsbyProjects/watchsdarot/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:77:98)
at Kc (/home/daniel_gray/GatsbyProjects/watchsdarot/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:69:131)
at Z (/home/daniel_gray/GatsbyProjects/watchsdarot/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:74:89)
at Ic (/home/daniel_gray/GatsbyProjects/watchsdarot/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:66:373)
at Kc (/home/daniel_gray/GatsbyProjects/watchsdarot/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:68:210)
at Z (/home/daniel_gray/GatsbyProjects/watchsdarot/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:74:89)
at Kc (/home/daniel_gray/GatsbyProjects/watchsdarot/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:72:271)
at Z (/home/daniel_gray/GatsbyProjects/watchsdarot/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:74:89)
at Kc (/home/daniel_gray/GatsbyProjects/watchsdarot/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:68:481)
Emitted 'error' event on WritableAsPromise instance at:
at emitErrorNT (node:internal/streams/destroy:157:8)
at emitErrorCloseNT (node:internal/streams/destroy:122:3)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
at runNextTicks (node:internal/process/task_queues:65:3)
ERROR #95313
Building static HTML failed
See our docs page for more info on this error: https://gatsby.dev/debug-html
1 | 'use strict';
> 2 | module.exports = function (obj, predicate) {
| ^
3 | var ret = {};
4 | var keys = Object.keys(obj);
5 | var isArr = Array.isArray(predicate);
WebpackError: Worker exited before finishing task
- index.js:2
[watchsdarot]/[filter-obj]/index.js:2:1
- index.js:194
[watchsdarot]/[query-string]/index.js:194:1
- dev-404-page.js:209
watchsdarot/.cache/dev-404-page.js:209:19
Thanks to anyone tried to help.
Found a solution to it on my own. It was a certain call to document.documentElement that prevented the build process to create static HTML files. No idea still why it pointed to two different pages since it was on another page but everything seems to be working now. For anyone still struggling try wrapping your window or document calls in a useEffect() hook or an if statement like this if(typeof window !== 'undefined')
Hope this helps someone!
Good luck.

Spring Batch - Partitioning Timeout

I have to migrate around millions of blob records from multiple mysql databases to a physical location as files over WAN network.
I chose to use Spring Batch and has already made it work. However, I am struggling with a timeout error happen with random partitioned steps.
Here is some context,
There are multiple MySql database store >10m records in 20 years.
The source tables indexed two composite keys in varchar datatype (there is no ID key) so I have to use an UN-indexed column in date-time format to partitioning the records by year and week to keep the number of records per partition reasonably at average 200 records. If there is any better advice, it would be welcome!
My issue: When the records per partition is high enough, the stepExecutors will randomly failed due to time out
Could not open JDBC Con nection for transaction; nested exception is java.sql.SQLTransientConnectionException: HikariPool-1 - Connection is not available, request timed out after 30000ms
I have done some tweaks with the DataSource properties and Transaction properties but no luck. Can I get some advice please! Thanks
Terminal log:
org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Con
nection for transaction; nested exception is
java.sql.SQLTransientConnectionException: HikariPool-1 - Connection is not available, request timed out after 30000ms.
at org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:309)
~[spring-jdbc-5.3.16.jar:5.3.16]
...
Caused by: java.sql.SQLTransientConnectionException: HikariPool-1 - Connection is not available, request timed out after 30000ms.
2022-03-05 10:05:43.146 ERROR 15624 --- [main] o.s.batch.core.step.AbstractStep : Encountered an error executing step managerStep in job mainJob
org.springframework.batch.core.JobExecutionException: Partition handler returned an unsuccessful step at ...
The job is marked as [FAILED] or [UNKNOWN] sometimes, and not restartable.
org.springframework.batch.core.partition.support.PartitionStep.doExecute(PartitionStep.java:112) ~[spring-batch-core-4.3.5.jar:4.3.5]
2022-03-05 10:05:43.213 INFO 15624 --- [main] o.s.b.c.l.support.SimpleJobLauncher : Job: [SimpleJob: [name=mainJob]] completed with the following parameters: [{run.id=20}] and the following status: [FAILED] in 3m13s783ms
2022-03-05 10:05:43.590 INFO 15624 --- [SpringApplicationShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-2 - Shutdown initiated...
2022-03-05 10:05:43.624 INFO 15624 --- [SpringApplicationShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-2 - Shutdown completed.
2022-03-05 10:05:43.626 INFO 15624 --- [SpringApplicationShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated...
2022-03-05 10:05:43.637 INFO 15624 --- [SpringApplicationShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.
Datasource builder: I have tried to increase the connection timeout and pool size, but it seems not be applied.
#Bean(name = "srcDataSource")
// #ConfigurationProperties(prefix = "spring.datasource.hikari")
public HikariDataSource dataSource() {
HikariDataSource hikariDS = new HikariDataSource();
hikariDS.setDriverClassName("com.mysql.jdbc.Driver");
hikariDS.setJdbcUrl("jdbc:mysql://dburl");
hikariDS.setUsername("dbuser");
hikariDS.setPassword("dbpwd");
// properties below does not solve the problem
hikariDS.setMaximumPoolSize(16);
hikariDS.setConnectionTimeout(30000);
// hikariDS.addDataSourceProperty("serverName",
// getConfig().getString("mysql.host"));
// hikariDS.addDataSourceProperty("port", getConfig().getString("mysql.port"));
// hikariDS.addDataSourceProperty("databaseName",
// getConfig().getString("mysql.database"));
// hikariDS.addDataSourceProperty("user", getConfig().getString("mysql.user"));
// hikariDS.addDataSourceProperty("password",
// getConfig().getString("mysql.password"));
// hikariDS.addDataSourceProperty("autoReconnect", true);
// hikariDS.addDataSourceProperty("cachePrepStmts", true);
// hikariDS.addDataSourceProperty("prepStmtCacheSize", 250);
// hikariDS.addDataSourceProperty("prepStmtCacheSqlLimit", 2048);
// hikariDS.addDataSourceProperty("useServerPrepStmts", true);
// hikariDS.addDataSourceProperty("cacheResultSetMetadata", true);
return hikariDS;
}
ManagerStep:
#Bean
public Step managerStep() {
return stepBuilderFactory.get("managerStep")
.partitioner(workerStep().getName(), dateRangePartitioner())
.step(workerStep())
// .gridSize(52) // number of worker, which is not necessary with datepartition
.taskExecutor(new SimpleAsyncTaskExecutor())
.build();
}
WorkerStep: I also tried to increase the transaction properties timeout, but not luck
#Bean
public Step workerStep() {
DefaultTransactionAttribute attribute = new DefaultTransactionAttribute();
attribute.setPropagationBehavior(Propagation.REQUIRED.value());
attribute.setIsolationLevel(Isolation.DEFAULT.value());
// attribute.setTimeout(30);
attribute.setTimeout(1000000);
return stepBuilderFactory.get("workerStep")
.<Image, Image>chunk(10)
.reader(jdbcPagingReader(null))
.processor(new ImageItemProcessor())
.writer(imageConverter())
// .listener(wrkrStepExecutionListener)
.transactionAttribute(attribute)
.build();
}
Job builder:
#Bean
public Job mainJob() {
return jobBuilderFactory.get("mainJob")
// .incrementer(new RunIdIncrementer())
.start(managerStep())
// .listener()
.build();
}

Mule JSON validation Schema component avoid error logs

I'm using JSON Validation Schema component and I have notice, that it logs all the errors to the console.
I would like to avoid this error message being displayed in the console.
Even though I have chosen a special exception strategy which has catch exception strategy with JSONValidation Exception and has custom logic implemented and no loggers at all in it, I still see the following error message:
org.mule.api.MessagingException: Json content is not compliant with schema
com.github.fge.jsonschema.core.report.ListProcessingReport: failure
--- BEGIN MESSAGES ---
error: string "blah" is too long (length: 4, maximum allowed: 3)
level: "error"
schema: {"loadingURI":"file:/...}
instance: {"pointer":"/blah_blah_code"}
domain: "validation"
keyword: "maxLength"
value: "blah"
found: 4
maxLength: 3
--- END MESSAGES ---
How could I make mule omit this error message? I don't want these errors to be logged to the console.
You can set the logException attribute of the catch-exception-strategy element to false, forcing mule not to log errors to the console:
<catch-exception-strategy logException="false">
set below logger to false in log4j2.xml
<AsyncLogger name="org.mule.module.apikit.validation.RestJsonSchemaValidator" level="OFF"/>

graphhopper GHRequest not fetching

I have a problem with this code:
GraphHopperAPI gh = new GraphHopperWeb();
gh.load("http://localhost:8989/api/route");
GHResponse ph = gh.route(new GHRequest(45.104546,7.69043,45.104546,7.69043));
It gives me this error:
2014-03-29 09:33:00,036 [main] INFO graphhopper.http.GraphHopperWeb - Full request took:0.037406, API took:0.0
Exception in thread "main" java.lang.RuntimeException: Problem while fetching path 45.104546, 7.69043->45.104546, 7.69043
at com.graphhopper.http.GraphHopperWeb.route(GraphHopperWeb.java:119)
at provaMain.main(provaMain.java:23)
Caused by: org.json.JSONException: A JSONObject text must begin with '{' at character 0
at org.json.JSONTokener.syntaxError(JSONTokener.java:410)
at org.json.JSONObject.<init>(JSONObject.java:179)
at org.json.JSONObject.<init>(JSONObject.java:402)
at com.graphhopper.http.GraphHopperWeb.route(GraphHopperWeb.java:95)
... 1 more
The documentation currently undergoes a change (moving it from wiki to source). Where did you find that snippet? Please try gh.load("http://localhost:8989/"); for the latest branch and gh.load("http://localhost:8989/api"); before.

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().