I am trying to migrate from specflow excel to using a json data file and the external data plugin
Related to Specflow - using data from external file in feature file is there a walkthrough to setup a feature file, and json data file with new #property approach to data?
I have a Specflow feature like this, which originally came from Specflow Excel.
Feature: EndToEndId
Scenario Outline: Single Payment
Given a client <clientNo> called <cName>
And a broker <bName> with book ref <bRef>
When a deal to <buyOrSell> an amount <fromAmt> of <ccy1> for <ccy2> for value <vDate> at client rate <cRate> and bank rate <bRate>
Then create a deal <dealNo> with client amt <toCAmt> and cover amt <coverAmt> and PnL <PnL> and profit rate <pRate> and <bYes>
And add beneficiary <benName> and country <ctry> and pay type <payType> and charge <charge> and <abYes>
When a credit file <c1> with <c1Name> for <c1Amt> <c1Ccy> for value <c1Date> with ref <EndToEndId1>
Then CreditNotice gets <fIn1Type> for client <fIn1Client>
Examples:
| case | clientNo | cName | bName | bRef | buyOrSell | fromAmt | ccy1 | ccy2 | vDate | cRate | bRate | dealNo | toCAmt | coverAmt | PnL | pRate | bYes | benName | ctry | payType | charge | abYes | c1 | c1Name | c1Amt | c1Ccy | c1Date | EndToEndId1 | fIn1Type | fIn1Client |
| T1: 99549 ###### | 99549 | Gherkin Test | MERCURY | 01W3RG5638 | SELL | 100000 | EUR | GBP | SP | 0.89435 | 0.89935 | ###### | 89435 | 89935 | 500 | 1 | yes | Gherkin Ben | GB | CHAPS | NONE | yes | 99549 | Gherkin Test | 100000 | EUR | SP | 99549 ###### | FullFundsIn | Gherkin Test |
To use the with a json file for the data, am I going to need to define each property again like this:
#property:clientNo=clientNo
#property:cName=cName
#property:bName=bName
and a json data file like this:
{
"case": "T-9: 99549 ######",
"clientNo": "99549",
"cName": "Gherkin Test",
"bName": "MERCURY",
"bRef": "01W3RG5638",
"buyOrSell": "SELL",
"fromAmt": "100,000",
"ccy1": "EUR",
"ccy2": "GBP",
"vDate": "SP",
"cRate": " 0.894350 ",
"bRate": " 0.894350 ",
"dealNo": "######",
"toCAmt": "89,435.00",
"coverAmt": "89,435.00",
"PnL": "0.00",
"pRate": " 1.000000 ",
"bYes": " yes ",
"benName": "Gherkin Ben",
"ctry": "GB",
"payType": "CHAPS",
"charge": "NONE",
"abYes": "yes",
"c1": "99549",
"c1Name": "Gherkin Test",
"c1Amt": "100,000",
"c1Ccy": "EUR",
"c1Date": "SP",
"EndToEndId1": "99549 ######",
"fIn1Type": "FullFundsIn",
"fIn1Client": "Gherkin Test"
},
{
"case": "T-8: 1234 1234",
"clientNo": "99549",
"cName": "Gherkin Test",
"bName": "JUPITER",
"bRef": "01W3RG5639",
"buyOrSell": "SELL",
"fromAmt": "200,000",
"ccy1": "EUR",
"ccy2": "GBP",
"vDate": "SP",
"cRate": " 0.894350 ",
"bRate": " 0.894350 ",
"dealNo": "######",
"toCAmt": "178,870.00",
"coverAmt": "178,870.00",
"PnL": "0.00",
"pRate": " 1.000000 ",
"bYes": " yes ",
"benName": "Gherkin Ben",
"ctry": "GB",
"payType": "FASTER",
"charge": "NONE",
"abYes": "yes",
"c1": "99549",
"c1Name": "Gherkin Test",
"c1Amt": "200,000",
"c1Ccy": "EUR",
"c1Date": "SP",
"EndToEndId1": "1234 1234",
"fIn1Type": "BankRec",
"fIn1Client": "Gherkin Test"
}
Thanks for some pointers on how to get the json data into the specflow feature file.
The SpecFlow.ExternalData plugin is currently limited to a single parameter.
Please upvote the feature request at https://support.specflow.org/hc/en-us/community/posts/360015106078-Allow-multiple-parameters-to-be-used-with-External-Data-plugin to get this higher in our backlog priority.
There is a separate plugin called Specflow.Contrib.JsonData as part of Nuget packages which accepts JSON data as an input for specflow scenarios. It is an extension to the Specflow.ExternalData plugin. It also accepts multiple properties. Check out https://libraries.io/nuget/SpecFlow.Contrib.JsonData.
How can you interact with a local Truffle Ganache blockchain through a Rails 6 app? I have prototyped the FixedSupplyToken app in vanilla javascript, and everything works as expected. Next, I try to move it into a Rails 6 app. I am nervous about using the Ruby gems (ethereum.rb - looking for someone to take over maintenance, others seem abandoned). I am wondering if you can you import web3.js directly into Rails 6 using Webpacker?
I created a new Rails 6 app and added the following:
yarn add web3
yarn add truffle-contract
Both installed and showed up in the package.json:
{
"name": "app",
"private": true,
"dependencies": {
"#fortawesome/fontawesome-free": "^5.12.0",
"#fortawesome/free-brands-svg-icons": "^5.12.0",
"#fortawesome/free-regular-svg-icons": "^5.12.0",
"#fortawesome/free-solid-svg-icons": "^5.12.0",
"#rails/actioncable": "^6.0.0",
"#rails/actiontext": "^6.0.2-1",
"#rails/activestorage": "^6.0.0",
"#rails/ujs": "^6.0.0",
"#rails/webpacker": "4.2.2",
"bootstrap": "^4.4.1",
"bootswatch": "^4.4.1",
"chart.js": "^2.9.3",
"chartkick": "^3.2.0",
"datatables.net-bs4": "^1.10.20",
"datatables.net-buttons-bs4": "^1.6.1",
"datatables.net-responsive-bs4": "^2.2.3",
"datatables.net-select-bs4": "^1.3.1",
"flatpickr": "^4.6.3",
"jquery": "^3.4.1",
"popper.js": "^1.16.0",
"trix": "^1.0.0",
"truffle-contract": "^4.0.31",
"turbolinks": "^5.2.0",
"vue": "^2.6.11",
"web3": "^1.2.5-rc.0"
},
"version": "0.1.0",
"devDependencies": {
"webpack-dev-server": "^3.10.1"
}
}
I then added this to app/javascript/packs (web3/index.js):
// Import libraries we need.
import Web3 from 'web3';
import contract from 'truffle-contract';
// Import our contract artifacts and turn them into usable abstractions.
import token_artifacts from './FixedSupplyToken.json';
// TokenContract is our usable abstraction, which we'll use through the code below.
var TokenContract = contract(token_artifacts);
// The following code is to interact with contracts.
var accounts;
var account;
window.App = {
start: function() {
var self = this;
// Bootstrap the TokenContract abstraction for Use.
TokenContract.setProvider(web3.currentProvider);
// Get the initial account balance so it can be displayed.
web3.eth.getAccounts(function (err, accs) {
if (err != null) {
alert("There was an error fetching your accounts.");
return;
}
if (accs.length == 0) {
alert("Couldn't get any accounts! Make sure your Ethereum client is configured correctly.");
return;
}
accounts = accs;
account = accounts[0];
});
},
initManageToken: function() {
App.updateTokenBalance();
App.watchTokenEvents();
},
updateTokenBalance: function() {
var tokenInstance;
TokenContract.deployed().then(function (instance) {
tokenInstance = instance;
return tokenInstance.balanceOf.call(account);
}).then(function (value) {
console.log(value);
var balance_element = document.getElementById("balanceTokenInToken");
balance_element.innerHTML = value.valueOf();
}).catch(function (e) {
console.log(e);
App.setStatus("Error getting balance; see log.");
});
},
watchTokenEvents: function() {
var tokenInstance;
TokenContract.deployed().then(function (instance) {
tokenInstance = instance;
tokenInstance.allEvents({}, {fromBlock: 0, toBlock: 'latest'}).watch(function (error, result) {
var alertbox = document.createElement("div");
alertbox.setAttribute("class", "alert alert-info alert-dismissible");
var closeBtn = document.createElement("button");
closeBtn.setAttribute("type", "button");
closeBtn.setAttribute("class", "close");
closeBtn.setAttribute("data-dismiss", "alert");
closeBtn.innerHTML = "<span>×</span>";
alertbox.appendChild(closeBtn);
var eventTitle = document.createElement("div");
eventTitle.innerHTML = '<strong>New Event: ' + result.event + '</strong>';
alertbox.appendChild(eventTitle);
var argsBox = document.createElement("textarea");
argsBox.setAttribute("class", "form-control");
argsBox.innerText = JSON.stringify(result.args);
alertbox.appendChild(argsBox);
document.getElementById("tokenEvents").appendChild(alertbox);
//document.getElementById("tokenEvents").innerHTML += '<div class="alert alert-info alert-dismissible" role="alert"> <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button><div></div><div>Args: '+JSON.stringify(result.args) + '</div></div>';
});
}).catch(function (e) {
console.log(e);
App.setStatus("Error getting balance; see log.");
});
},
sendToken: function() {
var amount = parseInt(document.getElementById("inputAmountSendToken").value);
var receiver = document.getElementById("inputBeneficiarySendToken").value;
App.setStatus("Initiating transaction... (please wait)");
var tokenInstance;
return TokenContract.deployed().then(function (instance) {
tokenInstance = instance;
return tokenInstance.transfer(receiver, amount, {from: account});
}).then(function () {
App.setStatus("Transaction complete!");
App.updateTokenBalance();
}).catch(function (e) {
console.log(e);
self.setStatus("Error sending coin; see log.");
});
},
allowanceToken: function() {
var self = this;
var amount = parseInt(document.getElementById("inputAmountAllowanceToken").value);
var receiver = document.getElementById("inputBeneficiaryAllowanceToken").value;
this.setStatus("Initiating transaction... (please wait)");
var tokenInstance;
return TokenContract.deployed().then(function (instance) {
tokenInstance = instance;
return tokenInstance.approve(receiver, amount, {from: account});
}).then(function () {
self.setStatus("Transaction complete!");
App.updateTokenBalance();
}).catch(function (e) {
console.log(e);
self.setStatus("Error sending coin; see log.");
});
}
};
document.addEventListener('load', function() {
// Checking if Web3 has been injected by the browser (Mist/MetaMask)
if (typeof web3 !== 'undefined') {
console.warn("Using web3 detected from external source. If you find that your accounts don't appear or you have 0 MetaCoin, ensure you've configured that source properly. If using MetaMask, see the following link. Feel free to delete this warning. :) http://truffleframework.com/tutorials/truffle-and-metamask")
// Use Mist/MetaMask's provider
window.web3 = new Web3(web3.currentProvider);
} else {
console.warn("No web3 detected. Falling back to http://localhost:8545. You should remove this fallback when you deploy live, as it's inherently insecure. Consider switching to Metamask for development. More info here: http://truffleframework.com/tutorials/truffle-and-metamask");
// fallback - use your fallback strategy (local node / hosted node + in-dapp id mgmt / fail)
window.web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:7545"));
}
});
Then, when I launch the Rails 6 app in a Docker container, everything seems fine until the webpack-dev-server attempts to compile the assets, and it throws this error:
webpack-dev-server | ℹ 「wdm」: Compiling...
webpack-dev-server | ✖ 「wdm」: Hash: 8531025c7b3abcc5d778
webpack-dev-server | Version: webpack 4.41.5
webpack-dev-server | Time: 1963ms
webpack-dev-server | Built at: 01/21/2020 4:46:26 PM
webpack-dev-server | Asset Size Chunks Chunk Names
webpack-dev-server | js/application-8df32eacba8ebdbf7444.js 6.49 MiB application [emitted] [immutable] application
webpack-dev-server | js/application-8df32eacba8ebdbf7444.js.map 6.93 MiB application [emitted] [dev] application
webpack-dev-server | manifest.json 1.9 KiB [emitted]
webpack-dev-server | media/images/Logo_medlarge-e2a09f85c0c6ed39d81ce70b3bd44e51.png 130 KiB
webpack-dev-server | media/images/pdf_icon-c00c8db0462b60773a72302f7b9d456b.png 1.36 KiB
webpack-dev-server | media/webfonts/fa-brands-400-088a34f7.eot 129 KiB
webpack-dev-server | media/webfonts/fa-brands-400-273dc9bf.ttf 129 KiB
webpack-dev-server | media/webfonts/fa-brands-400-822d94f1.woff2 74.2 KiB
webpack-dev-server | media/webfonts/fa-brands-400-d7229311.svg 692 KiB
webpack-dev-server | media/webfonts/fa-brands-400-f4920c94.woff 87 KiB
webpack-dev-server | media/webfonts/fa-regular-400-3ac49cb3.eot 33.6 KiB
webpack-dev-server | media/webfonts/fa-regular-400-9efb8697.woff2 13.3 KiB
webpack-dev-server | media/webfonts/fa-regular-400-a57bcf76.woff 16.4 KiB
webpack-dev-server | media/webfonts/fa-regular-400-d2e53334.svg 141 KiB
webpack-dev-server | media/webfonts/fa-regular-400-ece54318.ttf 33.3 KiB
webpack-dev-server | media/webfonts/fa-solid-900-2aa6edf8.ttf 189 KiB
webpack-dev-server | media/webfonts/fa-solid-900-7a5de9b0.svg 829 KiB
webpack-dev-server | media/webfonts/fa-solid-900-7fb1cdd9.eot 190 KiB
webpack-dev-server | media/webfonts/fa-solid-900-93f28454.woff 96.7 KiB
webpack-dev-server | media/webfonts/fa-solid-900-f6121be5.woff2 74.3 KiB
webpack-dev-server |
webpack-dev-server | ERROR in ./app/javascript/web3/index.js 126:22-26
webpack-dev-server | "export 'default' (imported as 'Web3') was not found in 'web3'
webpack-dev-server | at HarmonyImportSpecifierDependency._getErrors (/app/node_modules/webpack/lib/dependencies/HarmonyImportSpecifierDependency.js:109:11)
webpack-dev-server | at HarmonyImportSpecifierDependency.getErrors (/app/node_modules/webpack/lib/dependencies/HarmonyImportSpecifierDependency.js:68:16)
webpack-dev-server | at Compilation.reportDependencyErrorsAndWarnings (/app/node_modules/webpack/lib/Compilation.js:1463:22)
webpack-dev-server | at /app/node_modules/webpack/lib/Compilation.js:1258:10
webpack-dev-server | at AsyncSeriesHook.eval [as callAsync] (eval at create (/app/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
webpack-dev-server | at AsyncSeriesHook.lazyCompileHook (/app/node_modules/tapable/lib/Hook.js:154:20)
webpack-dev-server | at Compilation.finish (/app/node_modules/webpack/lib/Compilation.js:1253:28)
webpack-dev-server | at /app/node_modules/webpack/lib/Compiler.js:672:17
webpack-dev-server | at _done (eval at create (/app/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:9:1)
webpack-dev-server | at eval (eval at create (/app/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:32:22)
webpack-dev-server |
webpack-dev-server | ERROR in ./app/javascript/web3/index.js 130:22-26
webpack-dev-server | "export 'default' (imported as 'Web3') was not found in 'web3'
webpack-dev-server | at HarmonyImportSpecifierDependency._getErrors (/app/node_modules/webpack/lib/dependencies/HarmonyImportSpecifierDependency.js:109:11)
webpack-dev-server | at HarmonyImportSpecifierDependency.getErrors (/app/node_modules/webpack/lib/dependencies/HarmonyImportSpecifierDependency.js:68:16)
webpack-dev-server | at Compilation.reportDependencyErrorsAndWarnings (/app/node_modules/webpack/lib/Compilation.js:1463:22)
webpack-dev-server | at /app/node_modules/webpack/lib/Compilation.js:1258:10
webpack-dev-server | at AsyncSeriesHook.eval [as callAsync] (eval at create (/app/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
webpack-dev-server | at AsyncSeriesHook.lazyCompileHook (/app/node_modules/tapable/lib/Hook.js:154:20)
webpack-dev-server | at Compilation.finish (/app/node_modules/webpack/lib/Compilation.js:1253:28)
webpack-dev-server | at /app/node_modules/webpack/lib/Compiler.js:672:17
webpack-dev-server | at _done (eval at create (/app/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:9:1)
webpack-dev-server | at eval (eval at create (/app/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:32:22)
webpack-dev-server |
webpack-dev-server | ERROR in ./app/javascript/web3/index.js 130:31-35
webpack-dev-server | "export 'default' (imported as 'Web3') was not found in 'web3'
webpack-dev-server | at HarmonyImportSpecifierDependency._getErrors (/app/node_modules/webpack/lib/dependencies/HarmonyImportSpecifierDependency.js:109:11)
webpack-dev-server | at HarmonyImportSpecifierDependency.getErrors (/app/node_modules/webpack/lib/dependencies/HarmonyImportSpecifierDependency.js:68:16)
webpack-dev-server | at Compilation.reportDependencyErrorsAndWarnings (/app/node_modules/webpack/lib/Compilation.js:1463:22)
webpack-dev-server | at /app/node_modules/webpack/lib/Compilation.js:1258:10
webpack-dev-server | at AsyncSeriesHook.eval [as callAsync] (eval at create (/app/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
webpack-dev-server | at AsyncSeriesHook.lazyCompileHook (/app/node_modules/tapable/lib/Hook.js:154:20)
webpack-dev-server | at Compilation.finish (/app/node_modules/webpack/lib/Compilation.js:1253:28)
webpack-dev-server | at /app/node_modules/webpack/lib/Compiler.js:672:17
webpack-dev-server | at _done (eval at create (/app/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:9:1)
webpack-dev-server | at eval (eval at create (/app/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:32:22)
webpack-dev-server | ℹ 「wdm」: Failed to compile.
Websearches have not unearthed any possible solutions, and I have not dug up any examples of using web3.js using Webpacker in Rails. Is it possible; any solutions or examples out there?
Thanks!
I think this is a naming conflict. You've named your own javascript file web3/index.js, which Webpack sees as web3; that conflicts with the node module you're trying to import by the same name. Try renaming your own javascript folder/file to something else. Related issue: https://github.com/webpack/webpack/issues/4817#issuecomment-316119100
I have a simple Grails app, which I am trying to set upo to use ElasticSearch.
I have a single-node ElasticSearch instance running on EC2, which is running happily enough. (For reference, I just followed the steps here: http://www.elasticsearch.org/tutorials/elasticsearch-on-ec2/), but using 0.90.7 and the cloud-aws plugin version 1.15.0)
I am using the Grails ElasticSearch GORM plugin (http://grails.org/plugin/elasticsearch-gorm) (Master branch) and i'm connecting to ES using the transport client mode (elasticSearch.client.mode = 'transport')
Here's where it gets really odd...
The first time I boot up my app, it will happily index my Domain data on ES, I can query, etc, no problems.
If I then restart my grails app, it won't launch at all. I get
Message: Error creating bean with name 'searchableClassMappingConfigurator': Invocation of init method failed; nested exception is org.elasticsearch.transport.TransportSerializationException: Failed to deserialize exception response from stream
Line | Method
->> 262 | run in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 724 | run in java.lang.Thread
Caused by TransportSerializationException: Failed to deserialize exception response from stream
->> 169 | handlerResponseError in org.elasticsearch.transport.netty.MessageChannelHandler
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 123 | messageReceived in ''
| 70 | handleUpstream in org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler
| 564 | sendUpstream in org.elasticsearch.common.netty.channel.DefaultChannelPipeline
| 791 | sendUpstream in org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext
| 296 | fireMessageReceived in org.elasticsearch.common.netty.channel.Channels
| 462 | unfoldAndFireMessageReceived in org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder
| 443 | callDecode in ''
| 310 | messageReceived in ''
| 70 | handleUpstream in org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler
| 564 | sendUpstream in org.elasticsearch.common.netty.channel.DefaultChannelPipeline
| 559 | sendUpstream in ''
| 268 | fireMessageReceived in org.elasticsearch.common.netty.channel.Channels
| 255 | fireMessageReceived in ''
| 88 | read . . in org.elasticsearch.common.netty.channel.socket.nio.NioWorker
| 108 | process in org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker
| 318 | run . . . in org.elasticsearch.common.netty.channel.socket.nio.AbstractNioSelector
| 89 | run in org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker
| 178 | run . . . in org.elasticsearch.common.netty.channel.socket.nio.NioWorker
| 108 | run in org.elasticsearch.common.netty.util.ThreadRenamingRunnable
| 42 | run . . . in org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 724 | run in java.lang.Thread
Caused by StreamCorruptedException: unexpected end of block data
->> 1370 | readObject0 in java.io.ObjectInputStream
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1989 | defaultReadFields in ''
| 499 | defaultReadObject in ''
| 914 | readObject in java.lang.Throwable
| 1017 | invokeReadObject in java.io.ObjectStreamClass
| 1891 | readSerialData in java.io.ObjectInputStream
| 1796 | readOrdinaryObject in ''
| 1348 | readObject0 in ''
| 1989 | defaultReadFields in ''
| 499 | defaultReadObject in ''
| 914 | readObject in java.lang.Throwable
| 1017 | invokeReadObject in java.io.ObjectStreamClass
| 1891 | readSerialData in java.io.ObjectInputStream
| 1796 | readOrdinaryObject in ''
| 1348 | readObject0 in ''
| 370 | readObject in ''
| 167 | handlerResponseError in org.elasticsearch.transport.netty.MessageChannelHandler
| 123 | messageReceived in ''
| 70 | handleUpstream in org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler
| 564 | sendUpstream in org.elasticsearch.common.netty.channel.DefaultChannelPipeline
| 791 | sendUpstream in org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext
| 296 | fireMessageReceived in org.elasticsearch.common.netty.channel.Channels
| 462 | unfoldAndFireMessageReceived in org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder
| 443 | callDecode in ''
| 310 | messageReceived in ''
| 70 | handleUpstream in org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler
| 564 | sendUpstream in org.elasticsearch.common.netty.channel.DefaultChannelPipeline
| 559 | sendUpstream in ''
| 268 | fireMessageReceived in org.elasticsearch.common.netty.channel.Channels
| 255 | fireMessageReceived in ''
| 88 | read . . in org.elasticsearch.common.netty.channel.socket.nio.NioWorker
| 108 | process in org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker
| 318 | run . . . in org.elasticsearch.common.netty.channel.socket.nio.AbstractNioSelector
| 89 | run in org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker
| 178 | run . . . in org.elasticsearch.common.netty.channel.socket.nio.NioWorker
| 108 | run in org.elasticsearch.common.netty.util.ThreadRenamingRunnable
| 42 | run . . . in org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 724 | run in java.lang.Thread
This happens until I change the elasticSearch host details - ie, I can't boot my ap at all, with the original host details, ever again.
Both the ES node and my Grails app are both using elasticSearch 0.90.7, my config for the ES plugin looks like so:#
elasticSearch.client.mode = 'transport'
elasticSearch.client.hosts = [[host:'<my EC2 DNS>', port:9300]]
elasticSearch.datastoreImpl = 'mongoDatastore'
elasticSearch.client.transport.sniff = true
The only domain object I am marking as 'searchable' is mapped with mongoDB, which looks like so:
class CompletedApplicationFormSearchEntry {
static searchable = true
Long formId
Long jobId
Long employerId
Long jobseekerId
Date applicationDate
static mapWith = "mongo"
static constraints = {
}
}
If I remove the searchable attribute from the domain class, then relaunch the app, it launches fine, so I assume that there's something going on in the bootstrapping process when the domain object is detected as being searchable, but of course, it only causes an issue when the app's been restarted.
There are a handful of threads kicking about where people are seeing similar issue,s where they have nodes running different ES versions, different JVM version,s etc. But in this case, I only have one node!
I am absolutely tearing my hair out over this - I just can't work out what on earth's going wrong. I've tried different plugin versions, elasticsearch versions, 32-bit EC2 instance, 64bit EC2 instance - no luck!
Not with grails es plugin, but I fixed similar issue by fixing the jvm versions in ide ( used by the es client) to be the same as es master running on different jvm version.
STEP 0 : Make sure api and actual es version are identical.
STEP 1 : check jvm versions used by the es nodes
In following case, I had two different jvm versions, as pointed by "jvm" json key of both es nodes.
$ curl -XGET "http://localhost:9200/_nodes?jvm=true&pretty=true"
{
"cluster_name" : "elasticsearch",
"nodes" : {
"A6PDUvlWSN-zN2GKRxrSHA" : {
"name" : "Madeline Joyce",
"transport_address" : "inet[/192.168.1.4:9301]",
"host" : "prayagupd",
"ip" : "127.0.1.1",
"version" : "1.3.2",
"build" : "dee175d",
"http_address" : "inet[/192.168.1.4:9201]",
"settings" : {
"path" : {
"logs" : "/usr/local/elasticsearch-1.3.2/logs",
"home" : "/usr/local/elasticsearch-1.3.2"
},
"cluster" : {
"name" : "elasticsearch"
},
"http" : {
"port" : "9201"
},
"transport" : {
"tcp" : {
"port" : "9301"
}
},
"foreground" : "yes",
"name" : "Madeline Joyce"
},
"os" : {
"refresh_interval_in_millis" : 1000,
"available_processors" : 4,
"cpu" : {
"vendor" : "Intel",
"model" : "Core(TM) i5 CPU M 480 # 2.67GHz",
"mhz" : 2667,
"total_cores" : 4,
"total_sockets" : 4,
"cores_per_socket" : 16,
"cache_size_in_bytes" : 3072
},
"mem" : {
"total_in_bytes" : 3803283456
},
"swap" : {
"total_in_bytes" : 5998899200
}
},
"process" : {
"refresh_interval_in_millis" : 1000,
"id" : 9036,
"max_file_descriptors" : 4096,
"mlockall" : false
},
"jvm" : {
"pid" : 9036,
"version" : "1.7.0_65",
"vm_name" : "Java HotSpot(TM) 64-Bit Server VM",
"vm_version" : "24.65-b04",
"vm_vendor" : "Oracle Corporation",
"start_time_in_millis" : 1421578674811,
"mem" : {
"heap_init_in_bytes" : 268435456,
"heap_max_in_bytes" : 1038876672,
"non_heap_init_in_bytes" : 24313856,
"non_heap_max_in_bytes" : 136314880,
"direct_max_in_bytes" : 1038876672
},
"gc_collectors" : [ "ParNew", "ConcurrentMarkSweep" ],
"memory_pools" : [ "Code Cache", "Par Eden Space", "Par Survivor Space", "CMS Old Gen", "CMS Perm Gen" ]
},
"thread_pool" : {
"generic" : {
"type" : "cached",
"keep_alive" : "30s",
"queue_size" : -1
},
"index" : {
"type" : "fixed",
"min" : 4,
"max" : 4,
"queue_size" : "200"
},
"snapshot_data" : {
"type" : "scaling",
"min" : 1,
"max" : 5,
"keep_alive" : "5m",
"queue_size" : -1
},
"bench" : {
"type" : "scaling",
"min" : 1,
"max" : 2,
"keep_alive" : "5m",
"queue_size" : -1
},
"get" : {
"type" : "fixed",
"min" : 4,
"max" : 4,
"queue_size" : "1k"
},
"snapshot" : {
"type" : "scaling",
"min" : 1,
"max" : 2,
"keep_alive" : "5m",
"queue_size" : -1
},
"merge" : {
"type" : "scaling",
"min" : 1,
"max" : 2,
"keep_alive" : "5m",
"queue_size" : -1
},
"suggest" : {
"type" : "fixed",
"min" : 4,
"max" : 4,
"queue_size" : "1k"
},
"bulk" : {
"type" : "fixed",
"min" : 4,
"max" : 4,
"queue_size" : "50"
},
"optimize" : {
"type" : "fixed",
"min" : 1,
"max" : 1,
"queue_size" : -1
},
"warmer" : {
"type" : "scaling",
"min" : 1,
"max" : 2,
"keep_alive" : "5m",
"queue_size" : -1
},
"flush" : {
"type" : "scaling",
"min" : 1,
"max" : 2,
"keep_alive" : "5m",
"queue_size" : -1
},
"search" : {
"type" : "fixed",
"min" : 12,
"max" : 12,
"queue_size" : "1k"
},
"percolate" : {
"type" : "fixed",
"min" : 4,
"max" : 4,
"queue_size" : "1k"
},
"management" : {
"type" : "scaling",
"min" : 1,
"max" : 5,
"keep_alive" : "5m",
"queue_size" : -1
},
"refresh" : {
"type" : "scaling",
"min" : 1,
"max" : 2,
"keep_alive" : "5m",
"queue_size" : -1
}
},
"network" : {
"refresh_interval_in_millis" : 5000,
"primary_interface" : {
"address" : "192.168.1.4",
"name" : "eth0",
"mac_address" : "20:6A:8A:2A:24:E6"
}
},
"transport" : {
"bound_address" : "inet[/0:0:0:0:0:0:0:0%0:9301]",
"publish_address" : "inet[/192.168.1.4:9301]"
},
"http" : {
"bound_address" : "inet[/0:0:0:0:0:0:0:0%0:9201]",
"publish_address" : "inet[/192.168.1.4:9201]",
"max_content_length_in_bytes" : 104857600
},
"plugins" : [ ]
},
"TWNkkYYZSWe8NnrOPU57mQ" : {
"name" : "Scarlet Spider",
"transport_address" : "inet[/192.168.1.4:9300]",
"host" : "prayagupd",
"ip" : "127.0.1.1",
"version" : "1.3.2",
"build" : "dee175d",
"http_address" : "inet[/192.168.1.4:9200]",
"attributes" : {
"client" : "true",
"data" : "false"
},
"settings" : {
"path" : {
"data" : "/var/lib/elasticsearch",
"work" : "/tmp/elasticsearch",
"conf" : "/etc/elasticsearch",
"logs" : "/var/log/elasticsearch"
},
"cluster" : {
"name" : "elasticsearch"
},
"node" : {
"client" : "true"
},
"name" : "Scarlet Spider"
},
"os" : {
"refresh_interval_in_millis" : 1000,
"available_processors" : 4
},
"process" : {
"refresh_interval_in_millis" : 1000,
"id" : 11028,
"max_file_descriptors" : 4096,
"mlockall" : false
},
"jvm" : {
"pid" : 11028,
"version" : "1.7.0_05",
"vm_name" : "Java HotSpot(TM) 64-Bit Server VM",
"vm_version" : "23.1-b03",
"vm_vendor" : "Oracle Corporation",
"start_time_in_millis" : 1421580829189,
"mem" : {
"heap_init_in_bytes" : 59426304,
"heap_max_in_bytes" : 846331904,
"non_heap_init_in_bytes" : 24313856,
"non_heap_max_in_bytes" : 136314880,
"direct_max_in_bytes" : 846331904
},
"gc_collectors" : [ "PS Scavenge", "PS MarkSweep" ],
"memory_pools" : [ "Code Cache", "PS Eden Space", "PS Survivor Space", "PS Old Gen", "PS Perm Gen" ]
},
"thread_pool" : {
"generic" : {
"type" : "cached",
"keep_alive" : "30s",
"queue_size" : -1
},
"index" : {
"type" : "fixed",
"min" : 4,
"max" : 4,
"queue_size" : "200"
},
"snapshot_data" : {
"type" : "scaling",
"min" : 1,
"max" : 5,
"keep_alive" : "5m",
"queue_size" : -1
},
"bench" : {
"type" : "scaling",
"min" : 1,
"max" : 2,
"keep_alive" : "5m",
"queue_size" : -1
},
"get" : {
"type" : "fixed",
"min" : 4,
"max" : 4,
"queue_size" : "1k"
},
"snapshot" : {
"type" : "scaling",
"min" : 1,
"max" : 2,
"keep_alive" : "5m",
"queue_size" : -1
},
"merge" : {
"type" : "scaling",
"min" : 1,
"max" : 2,
"keep_alive" : "5m",
"queue_size" : -1
},
"suggest" : {
"type" : "fixed",
"min" : 4,
"max" : 4,
"queue_size" : "1k"
},
"bulk" : {
"type" : "fixed",
"min" : 4,
"max" : 4,
"queue_size" : "50"
},
"optimize" : {
"type" : "fixed",
"min" : 1,
"max" : 1,
"queue_size" : -1
},
"warmer" : {
"type" : "scaling",
"min" : 1,
"max" : 2,
"keep_alive" : "5m",
"queue_size" : -1
},
"flush" : {
"type" : "scaling",
"min" : 1,
"max" : 2,
"keep_alive" : "5m",
"queue_size" : -1
},
"search" : {
"type" : "fixed",
"min" : 12,
"max" : 12,
"queue_size" : "1k"
},
"percolate" : {
"type" : "fixed",
"min" : 4,
"max" : 4,
"queue_size" : "1k"
},
"management" : {
"type" : "scaling",
"min" : 1,
"max" : 5,
"keep_alive" : "5m",
"queue_size" : -1
},
"refresh" : {
"type" : "scaling",
"min" : 1,
"max" : 2,
"keep_alive" : "5m",
"queue_size" : -1
}
},
"network" : {
"refresh_interval_in_millis" : 5000
},
"transport" : {
"bound_address" : "inet[/0:0:0:0:0:0:0:0:9300]",
"publish_address" : "inet[/192.168.1.4:9300]"
},
"http" : {
"bound_address" : "inet[/0:0:0:0:0:0:0:0:9200]",
"publish_address" : "inet[/192.168.1.4:9200]",
"max_content_length_in_bytes" : 104857600
},
"plugins" : [ ]
}
}
}
STEP 2: update jvm version in ide (following shows for intellij ide)
Update to required jvm version, and add to project,
STEP 3 : Run both es nodes, the problem of TransportSerializationException should get fixed
$ curl -XGET "http://localhost:9200/_nodes?jvm=true&pretty=true"
{
"cluster_name": "elasticsearch",
"nodes": {
"GeRZFRiDSje8zLM_m90WRw": {
"name" : "Dougboy",
"jvm": {
"pid": 15223,
"version": "1.7.0_65",
"vm_name": "Java HotSpot(TM) 64-Bit Server VM",
"vm_version": "24.65-b04",
"vm_vendor": "Oracle Corporation",
"start_time_in_millis": 1421586819876,
"mem": {
"heap_init_in_bytes": 59426304,
"heap_max_in_bytes": 846200832,
"non_heap_init_in_bytes": 24576000,
"non_heap_max_in_bytes": 136314880,
"direct_max_in_bytes": 846200832
}
}
},
"A6PDUvlWSN-zN2GKRxrSHA": {
"name": "Madeline Joyce",
"jvm": {
"pid": 9036,
"version": "1.7.0_65",
"vm_name": "Java HotSpot(TM) 64-Bit Server VM",
"vm_version": "24.65-b04",
"vm_vendor": "Oracle Corporation",
"start_time_in_millis": 1421578674811,
"mem": {
"heap_init_in_bytes": 268435456,
"heap_max_in_bytes": 1038876672,
"non_heap_init_in_bytes": 24313856,
"non_heap_max_in_bytes": 136314880,
"direct_max_in_bytes": 1038876672
}
}
}
}
}
Reference
Java Client TransportSerializationException #3835, Oct 6, 2013
Looks like it was an issue with the plugin with Elasticsearch 0.90.7 throwing an exception which wasn't caught by the plugin.
Pull request here: https://github.com/mstein/elasticsearch-grails-plugin/pull/74 has a fix and includes ES 0.90.7