qid
int64 1
74.7M
| question
stringlengths 17
39.2k
| date
stringlengths 10
10
| metadata
list | response_j
stringlengths 2
41.1k
| response_k
stringlengths 2
47.9k
|
---|---|---|---|---|---|
24,284,666 | Okay guys, so I have a problem with WPF application. So far I managed to make a window with transparent background ( + no brush ). Also I added function, if my window is focused. So obviously my window should never been focused (because of transparency). This is working, but when I add lets say rectangle (on Canvas):
```
Rectangle testRectangleForText = new Rectangle();
testRectangleForText.Stroke = Brushes.Black;
testRectangleForText.StrokeThickness = 5;
testRectangleForText.Fill = null;
testRectangleForText.Height = 300;
testRectangleForText.Width = 300;
Canvas.SetLeft(testRectangleForText, 0);
Canvas.SetTop(testRectangleForText, 20);
myCanvas.Children.Add(testRectangleForText);
```
The rectangle is clickable and if I click on it, my app is focused (applicationFocus function display messageBox) and I don't want that. I already found solution for Win forms, but not for WPF, thats why I'm asking this here. Solution for win forms is here: [WINFORM SOLUTION](https://stackoverflow.com/questions/1524035/topmost-form-clicking-through-possible?lq=1)
Okay now example what I'm trying to achieve:
[example image](https://i.stack.imgur.com/9mLac.jpg)
So the red zone is my window (WPF APP) size. Background is transparent (obviously). Background application is notepad. We can see text and rectangle on Canvas.
Now, if I click on 1.(first) arrow, this is btw transparent area, nothing happens (thats good). If I click on 2.(second) arrow, MessageBox appear, which means that my WPF APP is focused and that is what I dont want. | 2014/06/18 | [
"https://Stackoverflow.com/questions/24284666",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3748605/"
]
| This worked for me:
From here: <https://social.msdn.microsoft.com/Forums/vstudio/en-US/41ca3605-247c-4c5b-ac5d-74ce5abd7b92/making-a-window-invisible-to-mouse-events-ishittestvisiblefalse-not-working?forum=wpf>
I've figured out how to do this. The key being the WS\_EX\_TRANSPARENT flag for the window's extended style.You can set the topmost property like you normally would, then this code takes care of making the window transparent to mouse clicks:
Code Snippet
```
public const int WS_EX_TRANSPARENT = 0x00000020;
public const int GWL_EXSTYLE = (-20);
[DllImport("user32.dll")]
public static extern int GetWindowLong(IntPtr hwnd, int index);
[DllImport("user32.dll")]
public static extern int SetWindowLong(IntPtr hwnd, int index, int newStyle);
protected override void OnSourceInitialized(EventArgs e)
{
base.OnSourceInitialized(e);
// Get this window's handle
IntPtr hwnd = new WindowInteropHelper(this).Handle;
// Change the extended window style to include WS_EX_TRANSPARENT
int extendedStyle = GetWindowLong(hwnd, GWL_EXSTYLE);
SetWindowLong(hwnd, GWL_EXSTYLE, extendedStyle | WS_EX_TRANSPARENT);
}
``` | Try to set the `Focusable` attribute in your XAML-Code:
```
<Window ... Focusable="False">
< ... />
</Window>
``` |
52,067,136 | I'm sure this must've been asked before, but I couldn't find anything like that, sorry.
Let's say I have a list of numbers `[1..24]`:
```
numbers = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24]
```
I want to make a function that accepts two integers: `mynum` which is a number in the list and `modifier`. It will then find `mynum` in the list and then cycle through the list `modifier` number of positions (right if positive, left if negative). If it reaches the end of the list, it will loop to the other side.
What I want now is to basically shift the number `mynum` based on the input, within the list.
Example:
```
shift_function(2, 1) # returns 3
shift_function(23, 3) # returns 2
shift_function(4, -8) # returns 20
shift_function(15, 51) # returns 18
```
How can I cycle through the ends of a list like this?
I thought of using the `time` module to get a time with `mynum` as current hour and then add/subtract `modifier` hours to it. This will work with my `[1..24]` range but I'm looking for a more general solution to this what seems to be a simple problem.
**Edit:** To clearify further, I simply want to count through a list of numbers. If the end is reached, start over from the beginning, same backwards.
**Edit2:** I don't know how much more clear I have to be. Imagine you have big numbers on your desk: 3,4,5,6,7. And then you start at the 5 and take `modifier` steps to the right, let's say 3 steps. So you count: "six, seven, three", starting over from the beginning again. If `modifier` is negative, you count backwards. E.g. with `-4` you count: "four, three, seven, six".
I can't see how this is so hard to get. Seems like a very simple and common problem to me. | 2018/08/28 | [
"https://Stackoverflow.com/questions/52067136",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9138821/"
]
| Looks like this function does what you want:
```
def shift_function(n, shift):
return numbers[(numbers.index(n) + shift) % len(numbers)]
``` | You can do this with `numpy`, using [`np.roll`](https://docs.scipy.org/doc/numpy/reference/generated/numpy.roll.html). Just be aware that the negative is actually inverse relative to what you want, so you can use `-modifier` instead:
```
import numpy as np
numbers = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24]
mynum = 4
modifier = -8
>>> np.roll(numbers,-modifier)[numbers.index(mynum)]
20
mynum = 15
modifier = 51
>>> np.roll(numbers,-modifier)[numbers.index(mynum)]
18
``` |
54,900,709 | I am using python with firebase, and have a table, I need to update all items that have a specific value in a field, I found out how to query for all the items having that value [here](https://firebase.google.com/docs/firestore/query-data/queries) and [here](https://stackoverflow.com/questions/49140166/query-a-firebase-firestore-db-where-collection-have-an-object-with-references)
Now I need to update all the items that I get in return.
What I would like to do, is to use a single query to perform a single operation that will find the correct items using the where query, and update a certain field to a certain value, I need that functionality in order to keep some data consistent.
Thanks | 2019/02/27 | [
"https://Stackoverflow.com/questions/54900709",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4406595/"
]
| It is possible to do it, but in more steps:
```py
# the usual preparation
import firebase_admin
from firebase_admin import credentials, firestore
databaseURL = {'databaseURL': "https://<YOUR-DB>.firebaseio.com"}
cred = credentials.Certificate("<YOUR-SERVICE-KEY>.json")
firebase_admin.initialize_app(cred, databaseURL)
database = firestore.client()
col_ref = database.collection('<YOUR-COLLECTION>')
# Query generator for the documents; get all people named Pepe
results = col_ref.where('name', '==', 'Pepe').get()
# Update Pepe to José
field_updates = {"name": "José"}
for item in results:
doc = col_ref.document(item.id)
doc.update(field_updates)
```
(I use Cloud Firestore, maybe it is different in Realtime Database) | You can iterate through the query and find the DocumentReference in each iteration.
```
db = firestore.client()
a= request_json['message']['a']
b= request_json['message']['b']
ref = db.collection('doc').where(a'', u'==', u'a').stream()
for i in ref:
i.reference.update({"c":"c"}) # get the document reference and use it to update\delete ...
``` |
44,953,138 | I have two domains.
In domain A, I have a PHP web site and in domain B, I have Java Website.
Now I want to use both database from both site.
How can I do that? I am using MySql 5.7.17 | 2017/07/06 | [
"https://Stackoverflow.com/questions/44953138",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8188370/"
]
| >
> Is there a way I can get git to tell me this information without actually performing the rebase?
>
>
>
The short answer is "no". The long answer is longer but ends with "no" :-) ... you could get pretty close by writing a lot of code but to get the full correct answer you must do all the commit-copying steps of the rebase, at which point you might as well just run the rebase.
>
> Failing that, what is the simplest way to detect if a rebase failed before `git rebase --abort`ing it?
>
>
>
The `git rebase` command returns a success (zero) exit code if the rebase completes successfully, and a failure (nonzero) exit code if not. In shell script, you can just use `git rebase $args || git rebase --abort`. | You could use a custom pre-rebase hook to do any checks that you need before the rebase begins. There's a sample pre-rebase hook here: <https://github.com/git/git/blob/master/templates/hooks--pre-rebase.sample>
In the pre-rebase hook code, you could diff the changed files and check for conflicts and stop the rebase. |
44,953,138 | I have two domains.
In domain A, I have a PHP web site and in domain B, I have Java Website.
Now I want to use both database from both site.
How can I do that? I am using MySql 5.7.17 | 2017/07/06 | [
"https://Stackoverflow.com/questions/44953138",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8188370/"
]
| >
> Failing that, what is the simplest way to detect if a rebase failed before git rebase --aborting it?
>
>
>
`git rebase` returns a falsy status when it fails, so you could do something like
```
git rebase feature && echo "Success" || echo "fail" && git rebase --abort
```
This will, however, perform the actual rebase when it is successful.
If you want to *test* if a rebase *would* be successful without actually performing it, I'm afraid my only idea is to checkout another branch, check if the rebase is successful and switch back, for example:
```
branch=$(git branch | grep '* .*' | sed s/..//); git checkout -b $branch-rebase > /dev/null ; git rebase test-2 > /dev/null && result="Success" || result="fail" ; git rebase --abort ; git checkout $branch ; git branch -D $branch-rebase ; echo $result
```
I first remember the current branch in a variable (if anyone has a better solution for determining the current branch, let me know), switch to *branchname-rebase*, perform the rebase, checkout the original branch and delete the test branch before I echo the result. Hacky, but depending on your usecase, this might work. | You could use a custom pre-rebase hook to do any checks that you need before the rebase begins. There's a sample pre-rebase hook here: <https://github.com/git/git/blob/master/templates/hooks--pre-rebase.sample>
In the pre-rebase hook code, you could diff the changed files and check for conflicts and stop the rebase. |
44,953,138 | I have two domains.
In domain A, I have a PHP web site and in domain B, I have Java Website.
Now I want to use both database from both site.
How can I do that? I am using MySql 5.7.17 | 2017/07/06 | [
"https://Stackoverflow.com/questions/44953138",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8188370/"
]
| The closest thing to a "dry run" of a rebase would be to run the rebase from detached HEAD state (so that no refs are actually modified). So instead of
```
git rebase develop feature_X
```
you might do
```
git rebase develop `git rev-parse feature_x`
```
and check the exit status. The problems with this approach are:
1) It's time consuming. Basically for any branch that *doesn't* conflict, the entire rebase will run. (And it's hard to imagine how you could do much less work and still accurately know whether the rebase would succeed anyway.)
2) It creates redundant objects (dangling commits and their dependencies), which won't be *visible* but will nonetheless hang around taking up space in your local repo until you either knock the dangling commits out of the reflog and run `gc`, or create a fresh clone. If you do this often, the wasted space could really add up.
I'm also not sure how much utility this has. Just because `feature_X` and `feature_Y` would each rebase cleanly onto `develop`, doesn't mean that the sequence of "rebase `featureX` then rebase `featureY`" will necessarily complete cleanly. And while it doesn't seem like it should be the case, after some things I've seen recently I wouldn't be shocked to learn of some edge case where the order of rebases determines whether there's a conflict.
So at best you'll get the "low hanging fruit" - "I know for a fact these have conflicts". But hey, you know, if that's the code you need, then that's the code you need. | You could use a custom pre-rebase hook to do any checks that you need before the rebase begins. There's a sample pre-rebase hook here: <https://github.com/git/git/blob/master/templates/hooks--pre-rebase.sample>
In the pre-rebase hook code, you could diff the changed files and check for conflicts and stop the rebase. |
44,953,138 | I have two domains.
In domain A, I have a PHP web site and in domain B, I have Java Website.
Now I want to use both database from both site.
How can I do that? I am using MySql 5.7.17 | 2017/07/06 | [
"https://Stackoverflow.com/questions/44953138",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8188370/"
]
| Based on the [answer of SVSchmidt](https://stackoverflow.com/a/44954783/1406321), you could extend his first command to revert even in the case of success:
```
git rebase master && (echo "Success" && git reset --hard ORIG_HEAD) || (echo "Fail" && git rebase --abort)
```
This will still run the rebase, however in the case of success reset your `HEAD` back to the old `HEAD` of before the rebase. Produced commits and changes of the reflog will remain, only the reference of your branch is resetted.
You might want to add redirections for the output of the commands to avoid unneeded output. When doing so keep in mind that the rebase might fail due to other circumstances than merge conflicts, e.g. unstaged changes in the working directory. | You could use a custom pre-rebase hook to do any checks that you need before the rebase begins. There's a sample pre-rebase hook here: <https://github.com/git/git/blob/master/templates/hooks--pre-rebase.sample>
In the pre-rebase hook code, you could diff the changed files and check for conflicts and stop the rebase. |
44,953,138 | I have two domains.
In domain A, I have a PHP web site and in domain B, I have Java Website.
Now I want to use both database from both site.
How can I do that? I am using MySql 5.7.17 | 2017/07/06 | [
"https://Stackoverflow.com/questions/44953138",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8188370/"
]
| >
> Is there a way I can get git to tell me this information without actually performing the rebase?
>
>
>
The short answer is "no". The long answer is longer but ends with "no" :-) ... you could get pretty close by writing a lot of code but to get the full correct answer you must do all the commit-copying steps of the rebase, at which point you might as well just run the rebase.
>
> Failing that, what is the simplest way to detect if a rebase failed before `git rebase --abort`ing it?
>
>
>
The `git rebase` command returns a success (zero) exit code if the rebase completes successfully, and a failure (nonzero) exit code if not. In shell script, you can just use `git rebase $args || git rebase --abort`. | >
> Failing that, what is the simplest way to detect if a rebase failed before git rebase --aborting it?
>
>
>
`git rebase` returns a falsy status when it fails, so you could do something like
```
git rebase feature && echo "Success" || echo "fail" && git rebase --abort
```
This will, however, perform the actual rebase when it is successful.
If you want to *test* if a rebase *would* be successful without actually performing it, I'm afraid my only idea is to checkout another branch, check if the rebase is successful and switch back, for example:
```
branch=$(git branch | grep '* .*' | sed s/..//); git checkout -b $branch-rebase > /dev/null ; git rebase test-2 > /dev/null && result="Success" || result="fail" ; git rebase --abort ; git checkout $branch ; git branch -D $branch-rebase ; echo $result
```
I first remember the current branch in a variable (if anyone has a better solution for determining the current branch, let me know), switch to *branchname-rebase*, perform the rebase, checkout the original branch and delete the test branch before I echo the result. Hacky, but depending on your usecase, this might work. |
44,953,138 | I have two domains.
In domain A, I have a PHP web site and in domain B, I have Java Website.
Now I want to use both database from both site.
How can I do that? I am using MySql 5.7.17 | 2017/07/06 | [
"https://Stackoverflow.com/questions/44953138",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8188370/"
]
| >
> Is there a way I can get git to tell me this information without actually performing the rebase?
>
>
>
The short answer is "no". The long answer is longer but ends with "no" :-) ... you could get pretty close by writing a lot of code but to get the full correct answer you must do all the commit-copying steps of the rebase, at which point you might as well just run the rebase.
>
> Failing that, what is the simplest way to detect if a rebase failed before `git rebase --abort`ing it?
>
>
>
The `git rebase` command returns a success (zero) exit code if the rebase completes successfully, and a failure (nonzero) exit code if not. In shell script, you can just use `git rebase $args || git rebase --abort`. | The closest thing to a "dry run" of a rebase would be to run the rebase from detached HEAD state (so that no refs are actually modified). So instead of
```
git rebase develop feature_X
```
you might do
```
git rebase develop `git rev-parse feature_x`
```
and check the exit status. The problems with this approach are:
1) It's time consuming. Basically for any branch that *doesn't* conflict, the entire rebase will run. (And it's hard to imagine how you could do much less work and still accurately know whether the rebase would succeed anyway.)
2) It creates redundant objects (dangling commits and their dependencies), which won't be *visible* but will nonetheless hang around taking up space in your local repo until you either knock the dangling commits out of the reflog and run `gc`, or create a fresh clone. If you do this often, the wasted space could really add up.
I'm also not sure how much utility this has. Just because `feature_X` and `feature_Y` would each rebase cleanly onto `develop`, doesn't mean that the sequence of "rebase `featureX` then rebase `featureY`" will necessarily complete cleanly. And while it doesn't seem like it should be the case, after some things I've seen recently I wouldn't be shocked to learn of some edge case where the order of rebases determines whether there's a conflict.
So at best you'll get the "low hanging fruit" - "I know for a fact these have conflicts". But hey, you know, if that's the code you need, then that's the code you need. |
44,953,138 | I have two domains.
In domain A, I have a PHP web site and in domain B, I have Java Website.
Now I want to use both database from both site.
How can I do that? I am using MySql 5.7.17 | 2017/07/06 | [
"https://Stackoverflow.com/questions/44953138",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8188370/"
]
| >
> Is there a way I can get git to tell me this information without actually performing the rebase?
>
>
>
The short answer is "no". The long answer is longer but ends with "no" :-) ... you could get pretty close by writing a lot of code but to get the full correct answer you must do all the commit-copying steps of the rebase, at which point you might as well just run the rebase.
>
> Failing that, what is the simplest way to detect if a rebase failed before `git rebase --abort`ing it?
>
>
>
The `git rebase` command returns a success (zero) exit code if the rebase completes successfully, and a failure (nonzero) exit code if not. In shell script, you can just use `git rebase $args || git rebase --abort`. | Based on the [answer of SVSchmidt](https://stackoverflow.com/a/44954783/1406321), you could extend his first command to revert even in the case of success:
```
git rebase master && (echo "Success" && git reset --hard ORIG_HEAD) || (echo "Fail" && git rebase --abort)
```
This will still run the rebase, however in the case of success reset your `HEAD` back to the old `HEAD` of before the rebase. Produced commits and changes of the reflog will remain, only the reference of your branch is resetted.
You might want to add redirections for the output of the commands to avoid unneeded output. When doing so keep in mind that the rebase might fail due to other circumstances than merge conflicts, e.g. unstaged changes in the working directory. |
28,499,167 | I want to use capital letters in android project package name.
So can we use capital letters in package name? | 2015/02/13 | [
"https://Stackoverflow.com/questions/28499167",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4562860/"
]
| In my opinion, you should not use capital letters in package name.
You will not be able to build the application with package name having capital letters in MAC and Windows.
So always use small letters for package name. | Yes you can.
>
> A full Java-language-style package name for the application. The name should be unique. The name may contain uppercase or lowercase letters ('A' through 'Z'), numbers, and underscores ('\_'). However, individual package name parts may only start with letters.
>
>
>
For more detailed information, click [here](http://developer.android.com/guide/topics/manifest/manifest-element.html). |
28,499,167 | I want to use capital letters in android project package name.
So can we use capital letters in package name? | 2015/02/13 | [
"https://Stackoverflow.com/questions/28499167",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4562860/"
]
| In my opinion, you should not use capital letters in package name.
You will not be able to build the application with package name having capital letters in MAC and Windows.
So always use small letters for package name. | You can, but trust me you don't want to. Not only does it break convention, it can cause real problems. For example in android, android studio won't support it. This means if you switch IDEs, your code might not compile.
Best practice is to just stick to lower case and convention. |
6,040 | When I'm editing a Vim command, I would like to use [the same shortcuts](http://www.bigsmoke.us/readline/shortcuts) as in Bash and every other REPL: `M-b` to go back a word, `M-Backspace` to delete a previous word, `M-u` to convert the word to uppercase, `C-k` to cut until the end of the line, etc. I have been able to configure some of the commands, using `:cmap`, but not all.
Is there a plugin or setting which provides this?
I know about [`cedit`](http://vimhelp.appspot.com/options.txt.html#%27cedit%27), but I find it cumbersome when all I need is to enter a quick command. | 2016/01/05 | [
"https://vi.stackexchange.com/questions/6040",
"https://vi.stackexchange.com",
"https://vi.stackexchange.com/users/5899/"
]
| >
> Is there a plugin or setting which provides this?
>
>
>
Yes, [rsi.vim plugin](https://github.com/tpope/vim-rsi):
>
> **Features**
>
>
> * Readline mappings are provided in insert mode and command line mode. Normal mode is deliberately omitted.
> * Important Vim key bindings (like insert mode's C-n and C-p completion) are not overridden.
> * Meta key bindings are provided in a way that works in the terminal without the perils of remapping escape.
> * C-d, C-e, and C-f are mapped such that they perform the Readline behavior in the middle of the line and the Vim behavior at the end.
> (Think about it.)
>
>
> | >
> Is there a plugin or setting which provides this?
>
>
>
There is also [readline.vim](https://github.com/ryvnf/readline.vim).
It is a newer plug-in which focuses purely on the command-line. It also implements a larger subset of the Readline shortcuts and has the goal of implementing each shortcut exactly like in Readline.
>
> What makes this plugin different from similar plugins is that it implements a
> larger subset of the Readline mappings, and that it does a better job of
> mimicking the Readline behavior for each command.
>
>
> The word movement and deletion commands have different behavior between Vim
> and Readline. The biggest difference is that in Readline punctuation is
> always skipped when searching for a word boundary. Another difference is that
> \_ (underscore) is treated as a word delimiter. This plugin implements the
> Readline behavior for word movement and deletion commands.
>
>
> |
6,040 | When I'm editing a Vim command, I would like to use [the same shortcuts](http://www.bigsmoke.us/readline/shortcuts) as in Bash and every other REPL: `M-b` to go back a word, `M-Backspace` to delete a previous word, `M-u` to convert the word to uppercase, `C-k` to cut until the end of the line, etc. I have been able to configure some of the commands, using `:cmap`, but not all.
Is there a plugin or setting which provides this?
I know about [`cedit`](http://vimhelp.appspot.com/options.txt.html#%27cedit%27), but I find it cumbersome when all I need is to enter a quick command. | 2016/01/05 | [
"https://vi.stackexchange.com/questions/6040",
"https://vi.stackexchange.com",
"https://vi.stackexchange.com/users/5899/"
]
| >
> Is there a plugin or setting which provides this?
>
>
>
Yes, [rsi.vim plugin](https://github.com/tpope/vim-rsi):
>
> **Features**
>
>
> * Readline mappings are provided in insert mode and command line mode. Normal mode is deliberately omitted.
> * Important Vim key bindings (like insert mode's C-n and C-p completion) are not overridden.
> * Meta key bindings are provided in a way that works in the terminal without the perils of remapping escape.
> * C-d, C-e, and C-f are mapped such that they perform the Readline behavior in the middle of the line and the Vim behavior at the end.
> (Think about it.)
>
>
> | I’ll add my most common alternatives:
* Use the default `:`-editing bindings (`:help commandline-editing` or something similar, if anyone has the reference offhand feel free to edit). `<C-b>` is beginning, `<C-e>` is end, and there are others
* Use the wonderful `<C-f>` if you started a `:`, `?`, or `/` and want to edit like it’s a normal vim buffer.
* Use `q:`, `q?`, or `q/` if you know you need this when you start.
I have `<leader>;` mapped to `q:` so a vim-edited command-line is very quick access. (I prefer not to switch `;` and `:` in my everyday editing, but I’m considering it.) |
6,040 | When I'm editing a Vim command, I would like to use [the same shortcuts](http://www.bigsmoke.us/readline/shortcuts) as in Bash and every other REPL: `M-b` to go back a word, `M-Backspace` to delete a previous word, `M-u` to convert the word to uppercase, `C-k` to cut until the end of the line, etc. I have been able to configure some of the commands, using `:cmap`, but not all.
Is there a plugin or setting which provides this?
I know about [`cedit`](http://vimhelp.appspot.com/options.txt.html#%27cedit%27), but I find it cumbersome when all I need is to enter a quick command. | 2016/01/05 | [
"https://vi.stackexchange.com/questions/6040",
"https://vi.stackexchange.com",
"https://vi.stackexchange.com/users/5899/"
]
| >
> Is there a plugin or setting which provides this?
>
>
>
Yes, [rsi.vim plugin](https://github.com/tpope/vim-rsi):
>
> **Features**
>
>
> * Readline mappings are provided in insert mode and command line mode. Normal mode is deliberately omitted.
> * Important Vim key bindings (like insert mode's C-n and C-p completion) are not overridden.
> * Meta key bindings are provided in a way that works in the terminal without the perils of remapping escape.
> * C-d, C-e, and C-f are mapped such that they perform the Readline behavior in the middle of the line and the Vim behavior at the end.
> (Think about it.)
>
>
> | For Neovim users, there is also <https://github.com/linty-org/readline.nvim>.
Disclaimer: I'm the author. |
6,040 | When I'm editing a Vim command, I would like to use [the same shortcuts](http://www.bigsmoke.us/readline/shortcuts) as in Bash and every other REPL: `M-b` to go back a word, `M-Backspace` to delete a previous word, `M-u` to convert the word to uppercase, `C-k` to cut until the end of the line, etc. I have been able to configure some of the commands, using `:cmap`, but not all.
Is there a plugin or setting which provides this?
I know about [`cedit`](http://vimhelp.appspot.com/options.txt.html#%27cedit%27), but I find it cumbersome when all I need is to enter a quick command. | 2016/01/05 | [
"https://vi.stackexchange.com/questions/6040",
"https://vi.stackexchange.com",
"https://vi.stackexchange.com/users/5899/"
]
| >
> Is there a plugin or setting which provides this?
>
>
>
There is also [readline.vim](https://github.com/ryvnf/readline.vim).
It is a newer plug-in which focuses purely on the command-line. It also implements a larger subset of the Readline shortcuts and has the goal of implementing each shortcut exactly like in Readline.
>
> What makes this plugin different from similar plugins is that it implements a
> larger subset of the Readline mappings, and that it does a better job of
> mimicking the Readline behavior for each command.
>
>
> The word movement and deletion commands have different behavior between Vim
> and Readline. The biggest difference is that in Readline punctuation is
> always skipped when searching for a word boundary. Another difference is that
> \_ (underscore) is treated as a word delimiter. This plugin implements the
> Readline behavior for word movement and deletion commands.
>
>
> | I’ll add my most common alternatives:
* Use the default `:`-editing bindings (`:help commandline-editing` or something similar, if anyone has the reference offhand feel free to edit). `<C-b>` is beginning, `<C-e>` is end, and there are others
* Use the wonderful `<C-f>` if you started a `:`, `?`, or `/` and want to edit like it’s a normal vim buffer.
* Use `q:`, `q?`, or `q/` if you know you need this when you start.
I have `<leader>;` mapped to `q:` so a vim-edited command-line is very quick access. (I prefer not to switch `;` and `:` in my everyday editing, but I’m considering it.) |
6,040 | When I'm editing a Vim command, I would like to use [the same shortcuts](http://www.bigsmoke.us/readline/shortcuts) as in Bash and every other REPL: `M-b` to go back a word, `M-Backspace` to delete a previous word, `M-u` to convert the word to uppercase, `C-k` to cut until the end of the line, etc. I have been able to configure some of the commands, using `:cmap`, but not all.
Is there a plugin or setting which provides this?
I know about [`cedit`](http://vimhelp.appspot.com/options.txt.html#%27cedit%27), but I find it cumbersome when all I need is to enter a quick command. | 2016/01/05 | [
"https://vi.stackexchange.com/questions/6040",
"https://vi.stackexchange.com",
"https://vi.stackexchange.com/users/5899/"
]
| >
> Is there a plugin or setting which provides this?
>
>
>
There is also [readline.vim](https://github.com/ryvnf/readline.vim).
It is a newer plug-in which focuses purely on the command-line. It also implements a larger subset of the Readline shortcuts and has the goal of implementing each shortcut exactly like in Readline.
>
> What makes this plugin different from similar plugins is that it implements a
> larger subset of the Readline mappings, and that it does a better job of
> mimicking the Readline behavior for each command.
>
>
> The word movement and deletion commands have different behavior between Vim
> and Readline. The biggest difference is that in Readline punctuation is
> always skipped when searching for a word boundary. Another difference is that
> \_ (underscore) is treated as a word delimiter. This plugin implements the
> Readline behavior for word movement and deletion commands.
>
>
> | For Neovim users, there is also <https://github.com/linty-org/readline.nvim>.
Disclaimer: I'm the author. |
6,040 | When I'm editing a Vim command, I would like to use [the same shortcuts](http://www.bigsmoke.us/readline/shortcuts) as in Bash and every other REPL: `M-b` to go back a word, `M-Backspace` to delete a previous word, `M-u` to convert the word to uppercase, `C-k` to cut until the end of the line, etc. I have been able to configure some of the commands, using `:cmap`, but not all.
Is there a plugin or setting which provides this?
I know about [`cedit`](http://vimhelp.appspot.com/options.txt.html#%27cedit%27), but I find it cumbersome when all I need is to enter a quick command. | 2016/01/05 | [
"https://vi.stackexchange.com/questions/6040",
"https://vi.stackexchange.com",
"https://vi.stackexchange.com/users/5899/"
]
| I’ll add my most common alternatives:
* Use the default `:`-editing bindings (`:help commandline-editing` or something similar, if anyone has the reference offhand feel free to edit). `<C-b>` is beginning, `<C-e>` is end, and there are others
* Use the wonderful `<C-f>` if you started a `:`, `?`, or `/` and want to edit like it’s a normal vim buffer.
* Use `q:`, `q?`, or `q/` if you know you need this when you start.
I have `<leader>;` mapped to `q:` so a vim-edited command-line is very quick access. (I prefer not to switch `;` and `:` in my everyday editing, but I’m considering it.) | For Neovim users, there is also <https://github.com/linty-org/readline.nvim>.
Disclaimer: I'm the author. |
3,779,815 | In order to sketch a graph of $x=f(y)$ when we know the graph of $y=f(x)$ We can exchange the axes of coordinates (and sketch the same graph of $y=f(x)$ on the other axis) I want use this method to sketch graph of $x=y^3$ (we know it is the grapgh of $y=\sqrt[3]{x}$). I get this graph:
[](https://i.stack.imgur.com/mvSjj.png)
I used the method and I rotated $x$ and $y$ axis $90^\circ$ clockwise in my head and draw the graph ( I showed where $x$ and $y$ axis are positive or negative after rotation ). But this graph is wrong and I realized that $x^+ , x^-$ are misplaced and should be exchanged.
Can you explain what is wrong with the argument that We should visualize rotating x and y axes and then sketch the graph normally instead of considering $x^+$ as the upper ray.
Thank you. | 2020/08/04 | [
"https://math.stackexchange.com/questions/3779815",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/716242/"
]
| What you want is to *reflect* about the line $y=x$. | after studying answers I finally conclude :
We Have graph of $y=f(x)$ and want to sketch the graph of $x=f(y)$. As we interchanged $x$ and $y$ in the equations we should interchange name of the $x,y$ axis too. So in the diagram of the question, $x^+$ should be at the up of $y$ axis and $x^-$ should be on the down of the $y$ axis.
So if I insist on sketching the graph by the method I mentioned in the question, the final step is reflecting the graph about the $x$ axis to correct the sign of $x$. |
3,779,815 | In order to sketch a graph of $x=f(y)$ when we know the graph of $y=f(x)$ We can exchange the axes of coordinates (and sketch the same graph of $y=f(x)$ on the other axis) I want use this method to sketch graph of $x=y^3$ (we know it is the grapgh of $y=\sqrt[3]{x}$). I get this graph:
[](https://i.stack.imgur.com/mvSjj.png)
I used the method and I rotated $x$ and $y$ axis $90^\circ$ clockwise in my head and draw the graph ( I showed where $x$ and $y$ axis are positive or negative after rotation ). But this graph is wrong and I realized that $x^+ , x^-$ are misplaced and should be exchanged.
Can you explain what is wrong with the argument that We should visualize rotating x and y axes and then sketch the graph normally instead of considering $x^+$ as the upper ray.
Thank you. | 2020/08/04 | [
"https://math.stackexchange.com/questions/3779815",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/716242/"
]
| To see what is wrong with your approach, look at the following (admittedly not very good quickly put together in paint) diagram:
[](https://i.stack.imgur.com/C19GS.png)
You want to draw ${x}$ as a function of $y$, then do some form of rotation to get back to the standard "${y}$ as a function of ${x}$" graph - rotate each of these pictures by ${360}$ degrees in your head. You will see that at no point during the rotation do you get the other. And so there does not exist a rotation that gets you from one state to the other. As others have pointed out - you must reflect. We can get close though - a rotation by ${270}$ degrees clockwise of the "${x}$ as a function of ${y}$" diagram would give you
[](https://i.stack.imgur.com/SfhKU.png)
But this isn't the same as the "${y}$ as a function of ${x}$" graph - it's actually "${y}$ as a function of ${-x}$". Hope that helps
**Edit**: @b00n heT has made a lovely comment I'd like to just point out - the problem is that any rotation on the "${y}$ as a function of ${x}$" graph will preserve the fact that the ${x}$ axis remains to the right of the ${y}$ axis. In the "${x}$ as a function of ${y}$" graph - the $x$ axis is to the **left** of the $y$ axis - and so it is clear no rotation on one will give you the other. | after studying answers I finally conclude :
We Have graph of $y=f(x)$ and want to sketch the graph of $x=f(y)$. As we interchanged $x$ and $y$ in the equations we should interchange name of the $x,y$ axis too. So in the diagram of the question, $x^+$ should be at the up of $y$ axis and $x^-$ should be on the down of the $y$ axis.
So if I insist on sketching the graph by the method I mentioned in the question, the final step is reflecting the graph about the $x$ axis to correct the sign of $x$. |
48,016,618 | Do I need Android permission(READ\_EXTERNAL\_STORAGE) for calling exists() method?
When I tested it, I can get true or false in internal storage without permission.
What if in External storage like sdcard?
Thank you. | 2017/12/29 | [
"https://Stackoverflow.com/questions/48016618",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3509081/"
]
| No.
I tested,no matter `READ/WRITE_EXTERNAL_STORAGE` granted or not, even user clicked the `never ask again` to refuse read/write permission. the `File.exists()` still can work properly.
tested on Android 8.1.0 | Yes.
see this > <https://developer.android.com/guide/topics/data/data-storage.html>
In order to read or write files on the external storage, your app must acquire the `READ_EXTERNAL_STORAGE` or `WRITE_EXTERNAL_STORAGE` system permissions. |
31,256,462 | I have database with an non-validated year field. Most of the entries are 4-digit years but about 10% of the entries are "whatever." This has led me down the rabbit hole of regular expressions to little avail. Getting better results than what I have is progress, even if I don't extract 100%.
```
#what a mess
yearEntries <- c("79, 80, 99","07-26-08","07-26-2008","'96 ","Early 70's","93/95","late 70's","15","late 60s","Late 70's",NA,"2013","1992-1993")
#does a good job with any string containing a 4-digit year
as.numeric(sub('\\D*(\\d{4}).*', '\\1', yearEntries))
#does a good job with any string containing a 2-digit year, nought else
as.numeric(sub('\\D*(\\d{2}).*', '\\1', yearEntries))
```
The desired output is to grab the first readable year, so 1992-1993 would be 1992 and "the 70s" would be 1970.
How can I improve my parsing accuracy? Thanks!
EDIT: Pursuant to garyh's answer this gets me much closer:
```
sub("\\D*((?<!\\d)\\d{2}(?!\\-|\\d)|\\d{4}).*","\\1",yearEntries,perl=TRUE)
# [1] "79" "07-2608" "07-262008" "96" "70" "93" "70" "15" "60" "70" NA "2013" "1992"
```
but note that, while the dates with dashes in them work with garyh's regex101.com demo, they don't work with R, keeping the month and day values, and the first dash.
Also I realize I didn't include an example date with slashes rather dashes. Another term in the regex should handle that but again, with R, it doesn't not produce the same [(correct) result](https://regex101.com/r/dQ4vR2/3) that regex101.com does.
```
sub("\\D*((?<!\\d)\\d{2}(?!\\-|\\/|\\d)|\\d{4}).*","\\1","07/09/13",perl=TRUE)
# [1] "07/0913"
```
These negative lookbacks and lookaheads are very powerful but stretch my feeble brain. | 2015/07/06 | [
"https://Stackoverflow.com/questions/31256462",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4634335/"
]
| Not sure what flavour of regex R uses but this seems to get all the years in the string
```
/((?<!\d)\d{2}(?!\-|\d)|\d{4})/g
```
This is matching any 4 digits *or* any 2 digits provided they're not followed by a dash `-` or digit, or preceded by another digit
see [demo here](https://regex101.com/r/dQ4vR2/2) | You're going to need some elbow grease and do something like:
```
library(lubridate)
yearEntries <- c("79, 80, 99","07-26-08","07-26-2008","'96 ","Early 70's","93/95","late 70's","15","late 60s","Late 70's",NA,"2013","1992-1993")
x <- yearEntries
x <- gsub("(late|early)", "", x, ignore.case=TRUE)
x <- gsub("[']*[s]*", "", x)
x <- gsub(",.*$", "", x)
x <- gsub(" ", "", x)
x <- ifelse(nchar(x)==9 | nchar(x)<8, gsub("[-/]+[[:digit:]]+$", "", x), x)
x <- ifelse(nchar(x)==4, gsub("^[[:digit:]]{2}", "", x), x)
y <- format(parse_date_time(x, "%m-%d-%y!"), "%y")
yearEntries <-ifelse(!is.na(y), y, x)
yearEntries
## [1] "79" "08" "08" "96" "70" "93" "70" "15" "60" "70" NA "13" "92"
```
We have no idea *which* year you need from ranged entries, but this should get you started. |
31,256,462 | I have database with an non-validated year field. Most of the entries are 4-digit years but about 10% of the entries are "whatever." This has led me down the rabbit hole of regular expressions to little avail. Getting better results than what I have is progress, even if I don't extract 100%.
```
#what a mess
yearEntries <- c("79, 80, 99","07-26-08","07-26-2008","'96 ","Early 70's","93/95","late 70's","15","late 60s","Late 70's",NA,"2013","1992-1993")
#does a good job with any string containing a 4-digit year
as.numeric(sub('\\D*(\\d{4}).*', '\\1', yearEntries))
#does a good job with any string containing a 2-digit year, nought else
as.numeric(sub('\\D*(\\d{2}).*', '\\1', yearEntries))
```
The desired output is to grab the first readable year, so 1992-1993 would be 1992 and "the 70s" would be 1970.
How can I improve my parsing accuracy? Thanks!
EDIT: Pursuant to garyh's answer this gets me much closer:
```
sub("\\D*((?<!\\d)\\d{2}(?!\\-|\\d)|\\d{4}).*","\\1",yearEntries,perl=TRUE)
# [1] "79" "07-2608" "07-262008" "96" "70" "93" "70" "15" "60" "70" NA "2013" "1992"
```
but note that, while the dates with dashes in them work with garyh's regex101.com demo, they don't work with R, keeping the month and day values, and the first dash.
Also I realize I didn't include an example date with slashes rather dashes. Another term in the regex should handle that but again, with R, it doesn't not produce the same [(correct) result](https://regex101.com/r/dQ4vR2/3) that regex101.com does.
```
sub("\\D*((?<!\\d)\\d{2}(?!\\-|\\/|\\d)|\\d{4}).*","\\1","07/09/13",perl=TRUE)
# [1] "07/0913"
```
These negative lookbacks and lookaheads are very powerful but stretch my feeble brain. | 2015/07/06 | [
"https://Stackoverflow.com/questions/31256462",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4634335/"
]
| You're going to need some elbow grease and do something like:
```
library(lubridate)
yearEntries <- c("79, 80, 99","07-26-08","07-26-2008","'96 ","Early 70's","93/95","late 70's","15","late 60s","Late 70's",NA,"2013","1992-1993")
x <- yearEntries
x <- gsub("(late|early)", "", x, ignore.case=TRUE)
x <- gsub("[']*[s]*", "", x)
x <- gsub(",.*$", "", x)
x <- gsub(" ", "", x)
x <- ifelse(nchar(x)==9 | nchar(x)<8, gsub("[-/]+[[:digit:]]+$", "", x), x)
x <- ifelse(nchar(x)==4, gsub("^[[:digit:]]{2}", "", x), x)
y <- format(parse_date_time(x, "%m-%d-%y!"), "%y")
yearEntries <-ifelse(!is.na(y), y, x)
yearEntries
## [1] "79" "08" "08" "96" "70" "93" "70" "15" "60" "70" NA "13" "92"
```
We have no idea *which* year you need from ranged entries, but this should get you started. | I found a very simple way to get a good result (though I would not claim it is bullet proof). It grabs the last readable year, which is okay too.
```
yearEntries <- c("79, 80, 99","07/26/08","07-26-2008","'96 ","Early 70's","93/95","15",NA,"2013","1992-1993","ongoing")
# assume last two digits present in any string represent a 2-digit year
a<-sub(".*(\\d{2}).*$","\\1",yearEntries)
# [1] "99" "08" "08" "96" "70" "95" "15" "ongoing" NA "13" "93"
# change to numeric, strip NAs and add 2000
b<-na.omit(as.numeric(a))+2000
# [1] 2099 2008 2008 2096 2070 2095 2015 2013 2093
# assume any greater than present is last century
b[b>2015]<-b[b>2015]-100
# [1] 1999 2008 2008 1996 1970 1995 2015 2013 1993
```
...and Bob's your uncle! |
31,256,462 | I have database with an non-validated year field. Most of the entries are 4-digit years but about 10% of the entries are "whatever." This has led me down the rabbit hole of regular expressions to little avail. Getting better results than what I have is progress, even if I don't extract 100%.
```
#what a mess
yearEntries <- c("79, 80, 99","07-26-08","07-26-2008","'96 ","Early 70's","93/95","late 70's","15","late 60s","Late 70's",NA,"2013","1992-1993")
#does a good job with any string containing a 4-digit year
as.numeric(sub('\\D*(\\d{4}).*', '\\1', yearEntries))
#does a good job with any string containing a 2-digit year, nought else
as.numeric(sub('\\D*(\\d{2}).*', '\\1', yearEntries))
```
The desired output is to grab the first readable year, so 1992-1993 would be 1992 and "the 70s" would be 1970.
How can I improve my parsing accuracy? Thanks!
EDIT: Pursuant to garyh's answer this gets me much closer:
```
sub("\\D*((?<!\\d)\\d{2}(?!\\-|\\d)|\\d{4}).*","\\1",yearEntries,perl=TRUE)
# [1] "79" "07-2608" "07-262008" "96" "70" "93" "70" "15" "60" "70" NA "2013" "1992"
```
but note that, while the dates with dashes in them work with garyh's regex101.com demo, they don't work with R, keeping the month and day values, and the first dash.
Also I realize I didn't include an example date with slashes rather dashes. Another term in the regex should handle that but again, with R, it doesn't not produce the same [(correct) result](https://regex101.com/r/dQ4vR2/3) that regex101.com does.
```
sub("\\D*((?<!\\d)\\d{2}(?!\\-|\\/|\\d)|\\d{4}).*","\\1","07/09/13",perl=TRUE)
# [1] "07/0913"
```
These negative lookbacks and lookaheads are very powerful but stretch my feeble brain. | 2015/07/06 | [
"https://Stackoverflow.com/questions/31256462",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4634335/"
]
| You're going to need some elbow grease and do something like:
```
library(lubridate)
yearEntries <- c("79, 80, 99","07-26-08","07-26-2008","'96 ","Early 70's","93/95","late 70's","15","late 60s","Late 70's",NA,"2013","1992-1993")
x <- yearEntries
x <- gsub("(late|early)", "", x, ignore.case=TRUE)
x <- gsub("[']*[s]*", "", x)
x <- gsub(",.*$", "", x)
x <- gsub(" ", "", x)
x <- ifelse(nchar(x)==9 | nchar(x)<8, gsub("[-/]+[[:digit:]]+$", "", x), x)
x <- ifelse(nchar(x)==4, gsub("^[[:digit:]]{2}", "", x), x)
y <- format(parse_date_time(x, "%m-%d-%y!"), "%y")
yearEntries <-ifelse(!is.na(y), y, x)
yearEntries
## [1] "79" "08" "08" "96" "70" "93" "70" "15" "60" "70" NA "13" "92"
```
We have no idea *which* year you need from ranged entries, but this should get you started. | @garyth's regex work well actually if you use the `regmatches`/`grexpr`combo to extract the pattern instead of `sub`:
```
regmatches(yearEntries,
gregexpr("(?<!\\d)\\d{2}(?!-|\\/|\\d)|\\d{4}",yearEntries,perl=TRUE))
[[1]]
[1] "79" "80" "99"
[[2]]
[1] "08"
[[3]]
[1] "2008"
[[4]]
[1] "96"
[[5]]
[1] "70"
[[6]]
[1] "95"
[[7]]
[1] "70"
[[8]]
[1] "15"
[[9]]
[1] "60"
[[10]]
[1] "70"
[[11]]
character(0)
[[12]]
[1] "2013"
[[13]]
[1] "1992" "1993"
```
To only keep the first matching pattern:
```
sapply(regmatches(yearEntries,gregexpr("(?<!\\d)\\d{2}(?!-|\\/|\\d)|\\d{4}",yearEntries,perl=TRUE)),`[`,1)
[1] "79" "08" "2008" "96" "70" "95" "70" "15" "60" "70" NA "2013" "1992"
regmatches("07/09/13",gregexpr("(?<!\\d)\\d{2}(?!-|\\/|\\d)|\\d{4}","07/09/13",perl=TRUE))
[[1]]
[1] "13"
``` |
31,256,462 | I have database with an non-validated year field. Most of the entries are 4-digit years but about 10% of the entries are "whatever." This has led me down the rabbit hole of regular expressions to little avail. Getting better results than what I have is progress, even if I don't extract 100%.
```
#what a mess
yearEntries <- c("79, 80, 99","07-26-08","07-26-2008","'96 ","Early 70's","93/95","late 70's","15","late 60s","Late 70's",NA,"2013","1992-1993")
#does a good job with any string containing a 4-digit year
as.numeric(sub('\\D*(\\d{4}).*', '\\1', yearEntries))
#does a good job with any string containing a 2-digit year, nought else
as.numeric(sub('\\D*(\\d{2}).*', '\\1', yearEntries))
```
The desired output is to grab the first readable year, so 1992-1993 would be 1992 and "the 70s" would be 1970.
How can I improve my parsing accuracy? Thanks!
EDIT: Pursuant to garyh's answer this gets me much closer:
```
sub("\\D*((?<!\\d)\\d{2}(?!\\-|\\d)|\\d{4}).*","\\1",yearEntries,perl=TRUE)
# [1] "79" "07-2608" "07-262008" "96" "70" "93" "70" "15" "60" "70" NA "2013" "1992"
```
but note that, while the dates with dashes in them work with garyh's regex101.com demo, they don't work with R, keeping the month and day values, and the first dash.
Also I realize I didn't include an example date with slashes rather dashes. Another term in the regex should handle that but again, with R, it doesn't not produce the same [(correct) result](https://regex101.com/r/dQ4vR2/3) that regex101.com does.
```
sub("\\D*((?<!\\d)\\d{2}(?!\\-|\\/|\\d)|\\d{4}).*","\\1","07/09/13",perl=TRUE)
# [1] "07/0913"
```
These negative lookbacks and lookaheads are very powerful but stretch my feeble brain. | 2015/07/06 | [
"https://Stackoverflow.com/questions/31256462",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4634335/"
]
| Not sure what flavour of regex R uses but this seems to get all the years in the string
```
/((?<!\d)\d{2}(?!\-|\d)|\d{4})/g
```
This is matching any 4 digits *or* any 2 digits provided they're not followed by a dash `-` or digit, or preceded by another digit
see [demo here](https://regex101.com/r/dQ4vR2/2) | I found a very simple way to get a good result (though I would not claim it is bullet proof). It grabs the last readable year, which is okay too.
```
yearEntries <- c("79, 80, 99","07/26/08","07-26-2008","'96 ","Early 70's","93/95","15",NA,"2013","1992-1993","ongoing")
# assume last two digits present in any string represent a 2-digit year
a<-sub(".*(\\d{2}).*$","\\1",yearEntries)
# [1] "99" "08" "08" "96" "70" "95" "15" "ongoing" NA "13" "93"
# change to numeric, strip NAs and add 2000
b<-na.omit(as.numeric(a))+2000
# [1] 2099 2008 2008 2096 2070 2095 2015 2013 2093
# assume any greater than present is last century
b[b>2015]<-b[b>2015]-100
# [1] 1999 2008 2008 1996 1970 1995 2015 2013 1993
```
...and Bob's your uncle! |
31,256,462 | I have database with an non-validated year field. Most of the entries are 4-digit years but about 10% of the entries are "whatever." This has led me down the rabbit hole of regular expressions to little avail. Getting better results than what I have is progress, even if I don't extract 100%.
```
#what a mess
yearEntries <- c("79, 80, 99","07-26-08","07-26-2008","'96 ","Early 70's","93/95","late 70's","15","late 60s","Late 70's",NA,"2013","1992-1993")
#does a good job with any string containing a 4-digit year
as.numeric(sub('\\D*(\\d{4}).*', '\\1', yearEntries))
#does a good job with any string containing a 2-digit year, nought else
as.numeric(sub('\\D*(\\d{2}).*', '\\1', yearEntries))
```
The desired output is to grab the first readable year, so 1992-1993 would be 1992 and "the 70s" would be 1970.
How can I improve my parsing accuracy? Thanks!
EDIT: Pursuant to garyh's answer this gets me much closer:
```
sub("\\D*((?<!\\d)\\d{2}(?!\\-|\\d)|\\d{4}).*","\\1",yearEntries,perl=TRUE)
# [1] "79" "07-2608" "07-262008" "96" "70" "93" "70" "15" "60" "70" NA "2013" "1992"
```
but note that, while the dates with dashes in them work with garyh's regex101.com demo, they don't work with R, keeping the month and day values, and the first dash.
Also I realize I didn't include an example date with slashes rather dashes. Another term in the regex should handle that but again, with R, it doesn't not produce the same [(correct) result](https://regex101.com/r/dQ4vR2/3) that regex101.com does.
```
sub("\\D*((?<!\\d)\\d{2}(?!\\-|\\/|\\d)|\\d{4}).*","\\1","07/09/13",perl=TRUE)
# [1] "07/0913"
```
These negative lookbacks and lookaheads are very powerful but stretch my feeble brain. | 2015/07/06 | [
"https://Stackoverflow.com/questions/31256462",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4634335/"
]
| Not sure what flavour of regex R uses but this seems to get all the years in the string
```
/((?<!\d)\d{2}(?!\-|\d)|\d{4})/g
```
This is matching any 4 digits *or* any 2 digits provided they're not followed by a dash `-` or digit, or preceded by another digit
see [demo here](https://regex101.com/r/dQ4vR2/2) | @garyth's regex work well actually if you use the `regmatches`/`grexpr`combo to extract the pattern instead of `sub`:
```
regmatches(yearEntries,
gregexpr("(?<!\\d)\\d{2}(?!-|\\/|\\d)|\\d{4}",yearEntries,perl=TRUE))
[[1]]
[1] "79" "80" "99"
[[2]]
[1] "08"
[[3]]
[1] "2008"
[[4]]
[1] "96"
[[5]]
[1] "70"
[[6]]
[1] "95"
[[7]]
[1] "70"
[[8]]
[1] "15"
[[9]]
[1] "60"
[[10]]
[1] "70"
[[11]]
character(0)
[[12]]
[1] "2013"
[[13]]
[1] "1992" "1993"
```
To only keep the first matching pattern:
```
sapply(regmatches(yearEntries,gregexpr("(?<!\\d)\\d{2}(?!-|\\/|\\d)|\\d{4}",yearEntries,perl=TRUE)),`[`,1)
[1] "79" "08" "2008" "96" "70" "95" "70" "15" "60" "70" NA "2013" "1992"
regmatches("07/09/13",gregexpr("(?<!\\d)\\d{2}(?!-|\\/|\\d)|\\d{4}","07/09/13",perl=TRUE))
[[1]]
[1] "13"
``` |
59,054,820 | From two equal shaped dataframes like the following:
```
1 11 22
2 330 440
3 55 66
4 770 880
5 99 0
1 110 220
2 33 44
3 550 660
4 77 88
5 990 0
```
I need a dataframe like the following
```
1 11 22
2 33 44
3 55 66
4 77 88
5 99 0
```
That is: the minimun for each of the cells | 2019/11/26 | [
"https://Stackoverflow.com/questions/59054820",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2132478/"
]
| Using [`np.minimum`](https://docs.scipy.org/doc/numpy/reference/generated/numpy.minimum.html)
```
np.minimum(df1, df2)
```
```
col1 col2 col3
0 1 11 22
1 2 33 44
2 3 55 66
3 4 77 88
4 5 99 0
``` | Probably:
```
np.where(df1 < df2, df1, df2)
```
Or if you want a DataFrame
```
pd.DataFrame(np.where(df1 < df2, df1, df2),
index=df1.index,
columns=df1.columns)
``` |
59,054,820 | From two equal shaped dataframes like the following:
```
1 11 22
2 330 440
3 55 66
4 770 880
5 99 0
1 110 220
2 33 44
3 550 660
4 77 88
5 990 0
```
I need a dataframe like the following
```
1 11 22
2 33 44
3 55 66
4 77 88
5 99 0
```
That is: the minimun for each of the cells | 2019/11/26 | [
"https://Stackoverflow.com/questions/59054820",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2132478/"
]
| Let do with `pandas`
```
pd.concat([df1,df2]).min(level=0)
Out[189]:
1 2
1 11 22
2 33 44
3 55 66
4 77 88
5 99 0
``` | Probably:
```
np.where(df1 < df2, df1, df2)
```
Or if you want a DataFrame
```
pd.DataFrame(np.where(df1 < df2, df1, df2),
index=df1.index,
columns=df1.columns)
``` |
59,054,820 | From two equal shaped dataframes like the following:
```
1 11 22
2 330 440
3 55 66
4 770 880
5 99 0
1 110 220
2 33 44
3 550 660
4 77 88
5 990 0
```
I need a dataframe like the following
```
1 11 22
2 33 44
3 55 66
4 77 88
5 99 0
```
That is: the minimun for each of the cells | 2019/11/26 | [
"https://Stackoverflow.com/questions/59054820",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2132478/"
]
| Using [`np.minimum`](https://docs.scipy.org/doc/numpy/reference/generated/numpy.minimum.html)
```
np.minimum(df1, df2)
```
```
col1 col2 col3
0 1 11 22
1 2 33 44
2 3 55 66
3 4 77 88
4 5 99 0
``` | Let do with `pandas`
```
pd.concat([df1,df2]).min(level=0)
Out[189]:
1 2
1 11 22
2 33 44
3 55 66
4 77 88
5 99 0
``` |
59,054,820 | From two equal shaped dataframes like the following:
```
1 11 22
2 330 440
3 55 66
4 770 880
5 99 0
1 110 220
2 33 44
3 550 660
4 77 88
5 990 0
```
I need a dataframe like the following
```
1 11 22
2 33 44
3 55 66
4 77 88
5 99 0
```
That is: the minimun for each of the cells | 2019/11/26 | [
"https://Stackoverflow.com/questions/59054820",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2132478/"
]
| Using [`np.minimum`](https://docs.scipy.org/doc/numpy/reference/generated/numpy.minimum.html)
```
np.minimum(df1, df2)
```
```
col1 col2 col3
0 1 11 22
1 2 33 44
2 3 55 66
3 4 77 88
4 5 99 0
``` | We can use [`DataFrame.where`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.where.html)
```
df1.where(df1<df2,df2)
```
We can also use [`DataFrame.mask`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.mask.html)
```
df1.mask(df1>df2,df2)
```
---
**Other method** [`DataFrame.combine`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.combine.html):
```
df1.combine(df2, np.minimum)
```
**Output**
```
col1 col2 col3
0 1 11 22
1 2 33 44
2 3 55 66
3 4 77 88
4 5 99 0
``` |
59,054,820 | From two equal shaped dataframes like the following:
```
1 11 22
2 330 440
3 55 66
4 770 880
5 99 0
1 110 220
2 33 44
3 550 660
4 77 88
5 990 0
```
I need a dataframe like the following
```
1 11 22
2 33 44
3 55 66
4 77 88
5 99 0
```
That is: the minimun for each of the cells | 2019/11/26 | [
"https://Stackoverflow.com/questions/59054820",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2132478/"
]
| Let do with `pandas`
```
pd.concat([df1,df2]).min(level=0)
Out[189]:
1 2
1 11 22
2 33 44
3 55 66
4 77 88
5 99 0
``` | We can use [`DataFrame.where`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.where.html)
```
df1.where(df1<df2,df2)
```
We can also use [`DataFrame.mask`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.mask.html)
```
df1.mask(df1>df2,df2)
```
---
**Other method** [`DataFrame.combine`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.combine.html):
```
df1.combine(df2, np.minimum)
```
**Output**
```
col1 col2 col3
0 1 11 22
1 2 33 44
2 3 55 66
3 4 77 88
4 5 99 0
``` |
576,162 | Okay I'm trying to rotate a Java Polygon based on it's original position of angle 0. x, and y end up being converted to an int at the end of me using them, so I could understand not seeing some change, but when the difference in angles is big like 0 to 180 I think I should see **something**.
I've been at this for a little while and can't think of what it is. Here's the method. (Sorry if it messes up in the code tags, my firefox messes them up.)
```
public void rotate(double x, double y, obj o1)
{
double dist = Math.sqrt(Math.pow(x - (o1.x + (o1.w/2)), 2) + Math.pow(y - (o1.y + (o1.h/2)),2));
x += (Math.sin(Math.toRadians(o1.a)) * dist);
y -= (Math.cos(Math.toRadians(o1.a)) * dist);
}
``` | 2009/02/23 | [
"https://Stackoverflow.com/questions/576162",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/62122/"
]
| FYI: Rotating shapes and points has been implemented in [java.awt.geom.AffineTransform](http://java.sun.com/j2se/1.4.2/docs/api/java/awt/geom/AffineTransform.html) | You're performing a [2D rotational transformation](http://en.wikipedia.org/wiki/Rotation_matrix).
It ought to look something like this:
```
xnew = xold*cos(t) - yold*sin(t)
ynew = xold*sin(t) + yold*cos(t)
```
The rotation angle t must be in radians, of course. It's zero at the x-axis, and increased in the anti-clockwise direction.
Both the old and new points need to be expressed relative to the origin you're rotating about. |
576,162 | Okay I'm trying to rotate a Java Polygon based on it's original position of angle 0. x, and y end up being converted to an int at the end of me using them, so I could understand not seeing some change, but when the difference in angles is big like 0 to 180 I think I should see **something**.
I've been at this for a little while and can't think of what it is. Here's the method. (Sorry if it messes up in the code tags, my firefox messes them up.)
```
public void rotate(double x, double y, obj o1)
{
double dist = Math.sqrt(Math.pow(x - (o1.x + (o1.w/2)), 2) + Math.pow(y - (o1.y + (o1.h/2)),2));
x += (Math.sin(Math.toRadians(o1.a)) * dist);
y -= (Math.cos(Math.toRadians(o1.a)) * dist);
}
``` | 2009/02/23 | [
"https://Stackoverflow.com/questions/576162",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/62122/"
]
| The values of `x` and `y` that are being manipulated in the `rotate` method will not be seen in the method that is calling it because [Java passes method arguments by value](http://javadude.com/articles/passbyvalue.htm).
Therefore, the `x` and `y` values that are being changed in the `rotate` method is a local copy, so once it goes out of scope (i.e. returning from the `rotate` method to its calling method), the values of `x` and `y` will disappear.
So currently, what is happening is:
```
x = 10;
y = 10;
o1 = new obj();
o1.a = 100;
rotate(x, y, obj);
System.out.println(x); // Still prints 10
System.out.println(y); // Still prints 10
```
The only way to get multiple values back from a method in Java is to pass an object, and manipulate the object that is passed in. (Actually, a copy of the reference to the object is passed in when an method call is made.)
For example, redefining `rotate` to return a `Point`:
```
public Point rotate(int x, int y, double angle)
{
// Do rotation.
return new Point(newX, newY);
}
public void callingMethod()
{
int x = 10;
int y = 10;
p = rotate(x, y, 45);
System.out.println(x); // Should print something other than 10.
System.out.println(y); // Should print something other than 10.
}
```
That said, as [Pierre suggests](https://stackoverflow.com/questions/576162/math-help-cant-rotate-something-knowing-java-would-be-a-plus/576168#576168), using the [AffineTransform](http://java.sun.com/javase/6/docs/api/java/awt/geom/AffineTransform.html) would be much easier in my opinion.
For example, creating a [`Rectangle`](http://java.sun.com/javase/6/docs/api/java/awt/Rectangle.html) object and rotating it using `AffineTransform` can be performed by the following:
```
Rectangle rect = new Rectangle(0, 0, 10, 10);
AffineTransform at = new AffineTransform();
at.rotate(Math.toRadians(45));
Shape rotatedRect = at.createTransformedShape(rect);
```
`AffineTransform` can be applied to classes which implement the [`Shape`](http://java.sun.com/javase/6/docs/api/java/awt/Shape.html) interface. A list of classes implementing `Shape` can be found in the linked Java API specifications for the `Shape` interface.
For more information on how to use `AffineTransform` and Java 2D:
* [Trail: 2D Graphics](http://java.sun.com/docs/books/tutorial/2d/index.html)
* [Lesson: Advanced Topics in Java2D](http://java.sun.com/docs/books/tutorial/2d/advanced/index.html)
+ [Transforming Shapes, Text, and Images](http://java.sun.com/docs/books/tutorial/2d/advanced/transforming.html) | FYI: Rotating shapes and points has been implemented in [java.awt.geom.AffineTransform](http://java.sun.com/j2se/1.4.2/docs/api/java/awt/geom/AffineTransform.html) |
576,162 | Okay I'm trying to rotate a Java Polygon based on it's original position of angle 0. x, and y end up being converted to an int at the end of me using them, so I could understand not seeing some change, but when the difference in angles is big like 0 to 180 I think I should see **something**.
I've been at this for a little while and can't think of what it is. Here's the method. (Sorry if it messes up in the code tags, my firefox messes them up.)
```
public void rotate(double x, double y, obj o1)
{
double dist = Math.sqrt(Math.pow(x - (o1.x + (o1.w/2)), 2) + Math.pow(y - (o1.y + (o1.h/2)),2));
x += (Math.sin(Math.toRadians(o1.a)) * dist);
y -= (Math.cos(Math.toRadians(o1.a)) * dist);
}
``` | 2009/02/23 | [
"https://Stackoverflow.com/questions/576162",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/62122/"
]
| The values of `x` and `y` that are being manipulated in the `rotate` method will not be seen in the method that is calling it because [Java passes method arguments by value](http://javadude.com/articles/passbyvalue.htm).
Therefore, the `x` and `y` values that are being changed in the `rotate` method is a local copy, so once it goes out of scope (i.e. returning from the `rotate` method to its calling method), the values of `x` and `y` will disappear.
So currently, what is happening is:
```
x = 10;
y = 10;
o1 = new obj();
o1.a = 100;
rotate(x, y, obj);
System.out.println(x); // Still prints 10
System.out.println(y); // Still prints 10
```
The only way to get multiple values back from a method in Java is to pass an object, and manipulate the object that is passed in. (Actually, a copy of the reference to the object is passed in when an method call is made.)
For example, redefining `rotate` to return a `Point`:
```
public Point rotate(int x, int y, double angle)
{
// Do rotation.
return new Point(newX, newY);
}
public void callingMethod()
{
int x = 10;
int y = 10;
p = rotate(x, y, 45);
System.out.println(x); // Should print something other than 10.
System.out.println(y); // Should print something other than 10.
}
```
That said, as [Pierre suggests](https://stackoverflow.com/questions/576162/math-help-cant-rotate-something-knowing-java-would-be-a-plus/576168#576168), using the [AffineTransform](http://java.sun.com/javase/6/docs/api/java/awt/geom/AffineTransform.html) would be much easier in my opinion.
For example, creating a [`Rectangle`](http://java.sun.com/javase/6/docs/api/java/awt/Rectangle.html) object and rotating it using `AffineTransform` can be performed by the following:
```
Rectangle rect = new Rectangle(0, 0, 10, 10);
AffineTransform at = new AffineTransform();
at.rotate(Math.toRadians(45));
Shape rotatedRect = at.createTransformedShape(rect);
```
`AffineTransform` can be applied to classes which implement the [`Shape`](http://java.sun.com/javase/6/docs/api/java/awt/Shape.html) interface. A list of classes implementing `Shape` can be found in the linked Java API specifications for the `Shape` interface.
For more information on how to use `AffineTransform` and Java 2D:
* [Trail: 2D Graphics](http://java.sun.com/docs/books/tutorial/2d/index.html)
* [Lesson: Advanced Topics in Java2D](http://java.sun.com/docs/books/tutorial/2d/advanced/index.html)
+ [Transforming Shapes, Text, and Images](http://java.sun.com/docs/books/tutorial/2d/advanced/transforming.html) | You're performing a [2D rotational transformation](http://en.wikipedia.org/wiki/Rotation_matrix).
It ought to look something like this:
```
xnew = xold*cos(t) - yold*sin(t)
ynew = xold*sin(t) + yold*cos(t)
```
The rotation angle t must be in radians, of course. It's zero at the x-axis, and increased in the anti-clockwise direction.
Both the old and new points need to be expressed relative to the origin you're rotating about. |
27,351,812 | I want to set a variable in a module from one calling module and want to retrieve that value inanother calling module.
I have done something line this:
```
package Test;
our $data = undef;
sub set_data
{
$data = shift @_;
}
sub get_data
{
return $data
}
```
I am setting the data as :
```
package Mod1;
use Test;
Test::set_data(1);
```
I am retrieving the data as:
```
package Mod2;
use Test;
print Test::get_data();
```
But I am getting undef while retrieving the value.
What is wrong in my implementation? | 2014/12/08 | [
"https://Stackoverflow.com/questions/27351812",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/495600/"
]
| I have figured out the problem. The setter code
```
package Mod1;
use Test;
Test::set_data(1);
```
is running in a threaded function.
I figured out that inside the function the state of the variable is getting changed as expected and I can also access the latest data.
Once I am out of the threaded function the value of the variable no more persists. What I mean by out of the threaded function is after I joined all the running threads. | Add some debugging (e.g. `warn "setting data to $data";` at the end of set\_data and `warn "getting data: $data";` at the beginning of get\_data) and verify things are happening in the order you think they are.
Note that the main code of a module (which both your get\_data and set\_data calls are) runs when the module is loaded at compile time; if you are depending on something else that happens at run time to get the value, that won't work.
If all else fails, strip out as much of your code as you can and still have it fail and show us the compete failing case (including whatever loads Mod1 and Mod2). |
27,351,812 | I want to set a variable in a module from one calling module and want to retrieve that value inanother calling module.
I have done something line this:
```
package Test;
our $data = undef;
sub set_data
{
$data = shift @_;
}
sub get_data
{
return $data
}
```
I am setting the data as :
```
package Mod1;
use Test;
Test::set_data(1);
```
I am retrieving the data as:
```
package Mod2;
use Test;
print Test::get_data();
```
But I am getting undef while retrieving the value.
What is wrong in my implementation? | 2014/12/08 | [
"https://Stackoverflow.com/questions/27351812",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/495600/"
]
| I have figured out the problem. The setter code
```
package Mod1;
use Test;
Test::set_data(1);
```
is running in a threaded function.
I figured out that inside the function the state of the variable is getting changed as expected and I can also access the latest data.
Once I am out of the threaded function the value of the variable no more persists. What I mean by out of the threaded function is after I joined all the running threads. | When I have to do something like that I usually take help of [**Storable**](https://metacpan.org/module/Storable). You can use that method.
See this answer (<https://stackoverflow.com/a/17082242/257635>) for an example. |
37,379 | To my limited knowledge there is no such thing as "[abrogation](http://en.wikipedia.org/wiki/Abrogation)" within the Tanach. Such would *seem* to defeat the immutability of G-d's Law. This issue of abrogation comes up a lot in both Christian and Muslim circles, since many interpreters of the Christian bible and the Quran posit some sort of abrogation of previous scriptures (the Christians often claim aspects of Torah Law were abrogated and the Muslims have, even within their own canon, laws that are *seemingly* abrogated, although different jurists rule variably on this latter case).
Am I correct and, equally as important, what are the best verses in the Tanach which proclaim the changeless reality of G-d's Law? | 2014/04/23 | [
"https://judaism.stackexchange.com/questions/37379",
"https://judaism.stackexchange.com",
"https://judaism.stackexchange.com/users/5306/"
]
| Textual indicators abound for the eternal and immutable nature of the Torah. Besides examples provided in other answers, here are a couple more examples:
>
> Even all that the LORD hath commanded you by the hand of Moses, from the day that the LORD gave commandment, and onward throughout your generations ([*B'midbar* 15:23](http://www.mechon-mamre.org/p/pt/pt0415.htm#23)).
>
>
> And thou shalt keep His statutes, and His commandments, which I command thee this day, that it may go well with thee, and with thy children after thee, and that thou mayest prolong thy days upon the land, which the LORD thy G-d giveth thee, for ever ([*D'varim* 4:40](http://www.mechon-mamre.org/p/pt/pt0504.htm#40)).
>
>
> Of old have I known from Thy testimonies that Thou hast founded them for ever ([*T'hillim* 119:152](http://www.mechon-mamre.org/p/pt/pt26b9.htm#152)).
>
>
> All this word which I command you, that shall ye observe to do; thou shalt not add thereto, nor diminish from it ([*D'varim* 13:1](http://www.mechon-mamre.org/p/pt/pt0513.htm#1)).
>
>
>
Another approach, mentioned by the Rambam (*Moreh N'vuchim* 2:39), is that the perfect nature of the Torah precludes the possibility that it could be replaced with something that would necessarily be less perfect. Regarding this nature of the Torah, the Rambam cites such verses as:
>
> The law of the LORD is perfect ([*P'salms* 19:8](http://www.mechon-mamre.org/p/pt/pt2619.htm#8)).
>
>
>
More broadly speaking, other verses indicate that the Almighty's will is immutable and that He does not change His word:
>
> G-d is not a man, that He should lie; neither the son of man, that He should repent: when He hath said, will He not do it? or when He hath spoken, will He not fulfill it ([B'midbar 23:19](http://www.mechon-mamre.org/p/pt/pt0423.htm#19))?
>
>
> And also the Glory of Israel will not lie nor repent; for He is not a man, that He should repent ([Sh'mu'el I 15:29](http://www.mechon-mamre.org/p/pt/pt08a15.htm#29)).
>
>
>
The Ibn Ezra (*Sh'mos* 32:14) demonstrates that instances of the Almighty's regret as described elsewhere (e.g. *B'reishis* 6:6, *Sh'mos* 32:14, and *Sh'mu'el* I 15:11) are anthropopathic, and He does not actually change His mind:
>
> וינחם: חלילה להנחם השם, רק דברה תורה כלשון בני אדם, כמו ויעל (ברא' לה, יג), וירד (שם יא, ה), ישמח ד' במעשיו (תה' קד, לא), ויתעצב אל לבו (ברא' ו, ו). והנה שמואל אמר, וגם נצח ישראל לא ישקר ולא ינחם (ש"א טו, כט), ושם כתוב נחמתי שם, י.
>
>
> | Although all agree that the Torah, as a practical matter, will not change, there is a disagreement between the Rambam and others (e.g. Sefer HaIkkarim 3:16) if this is an inherent quality, and thus a fundamental aspect of belief, or just something that G-d decided.
In addition, within G-d's commandments, there is a concept of [ניתנה תורה, ונתחדשה הלכה](http://www.mechon-mamre.org/i/e401.htm) - when the Torah was given, there was a new Law - even according to the Rambam.
So even according the accepted view of the Rambam that the Torah is inherently eternal that does not preclude G-d from commanding something on a circumstantial or provisional basis.
One of the Rambam's proofs (Yisodei Hatorah 9:1) for the eternal nature of the Torah is [Devarim 29:28](http://www.chabad.org/library/bible_cdo/aid/9993/jewish/Chapter-29.htm#showrashi=true&v=28).
>
> The hidden things belong to the Lord, our God, but the revealed things apply to us and to our children forever: that we must fulfill all the words of this Torah.
>
>
>
The term "forever" there always (according to the Rambam - Moreh Nevuchim 2:28) connotates eternity (for the length existence of the world). |
37,379 | To my limited knowledge there is no such thing as "[abrogation](http://en.wikipedia.org/wiki/Abrogation)" within the Tanach. Such would *seem* to defeat the immutability of G-d's Law. This issue of abrogation comes up a lot in both Christian and Muslim circles, since many interpreters of the Christian bible and the Quran posit some sort of abrogation of previous scriptures (the Christians often claim aspects of Torah Law were abrogated and the Muslims have, even within their own canon, laws that are *seemingly* abrogated, although different jurists rule variably on this latter case).
Am I correct and, equally as important, what are the best verses in the Tanach which proclaim the changeless reality of G-d's Law? | 2014/04/23 | [
"https://judaism.stackexchange.com/questions/37379",
"https://judaism.stackexchange.com",
"https://judaism.stackexchange.com/users/5306/"
]
| Although all agree that the Torah, as a practical matter, will not change, there is a disagreement between the Rambam and others (e.g. Sefer HaIkkarim 3:16) if this is an inherent quality, and thus a fundamental aspect of belief, or just something that G-d decided.
In addition, within G-d's commandments, there is a concept of [ניתנה תורה, ונתחדשה הלכה](http://www.mechon-mamre.org/i/e401.htm) - when the Torah was given, there was a new Law - even according to the Rambam.
So even according the accepted view of the Rambam that the Torah is inherently eternal that does not preclude G-d from commanding something on a circumstantial or provisional basis.
One of the Rambam's proofs (Yisodei Hatorah 9:1) for the eternal nature of the Torah is [Devarim 29:28](http://www.chabad.org/library/bible_cdo/aid/9993/jewish/Chapter-29.htm#showrashi=true&v=28).
>
> The hidden things belong to the Lord, our God, but the revealed things apply to us and to our children forever: that we must fulfill all the words of this Torah.
>
>
>
The term "forever" there always (according to the Rambam - Moreh Nevuchim 2:28) connotates eternity (for the length existence of the world). | End of Malachi and the final word of the prophets to keep in mind before the arrival of Eliyahu:
>
> "Remember the Torah of Moshe my servant, which I enjoined on him at
> Horev (Sinai), laws and rulings for all Israel. 5 Look, I will send to you
> Eliyahu the prophet before the coming of the great and terrible Day of
> God. 6 He will turn the hearts of the fathers to the children and the
> hearts of the children to their fathers; otherwise I will come and
> strike the land with complete destruction." Look, I will send to you
> Eliyahu the prophet before the coming of the great and terrible Day of
> God."
>
>
>
this implies that the Torah of Moshe will be valid until the end of days |
37,379 | To my limited knowledge there is no such thing as "[abrogation](http://en.wikipedia.org/wiki/Abrogation)" within the Tanach. Such would *seem* to defeat the immutability of G-d's Law. This issue of abrogation comes up a lot in both Christian and Muslim circles, since many interpreters of the Christian bible and the Quran posit some sort of abrogation of previous scriptures (the Christians often claim aspects of Torah Law were abrogated and the Muslims have, even within their own canon, laws that are *seemingly* abrogated, although different jurists rule variably on this latter case).
Am I correct and, equally as important, what are the best verses in the Tanach which proclaim the changeless reality of G-d's Law? | 2014/04/23 | [
"https://judaism.stackexchange.com/questions/37379",
"https://judaism.stackexchange.com",
"https://judaism.stackexchange.com/users/5306/"
]
| Although all agree that the Torah, as a practical matter, will not change, there is a disagreement between the Rambam and others (e.g. Sefer HaIkkarim 3:16) if this is an inherent quality, and thus a fundamental aspect of belief, or just something that G-d decided.
In addition, within G-d's commandments, there is a concept of [ניתנה תורה, ונתחדשה הלכה](http://www.mechon-mamre.org/i/e401.htm) - when the Torah was given, there was a new Law - even according to the Rambam.
So even according the accepted view of the Rambam that the Torah is inherently eternal that does not preclude G-d from commanding something on a circumstantial or provisional basis.
One of the Rambam's proofs (Yisodei Hatorah 9:1) for the eternal nature of the Torah is [Devarim 29:28](http://www.chabad.org/library/bible_cdo/aid/9993/jewish/Chapter-29.htm#showrashi=true&v=28).
>
> The hidden things belong to the Lord, our God, but the revealed things apply to us and to our children forever: that we must fulfill all the words of this Torah.
>
>
>
The term "forever" there always (according to the Rambam - Moreh Nevuchim 2:28) connotates eternity (for the length existence of the world). | In addition to everything else stated here, the Rambam in his introduction to the last chapter of Sanhedrin, where he develops his 13 foundations of Jewish belief, explains the immutability of the Torah as the 9th foundation, and quotes the verse "You shall not add onto [the Torah] or subtract from it" (Deuteronomy 13:1) as the source of this central belief.
In Yesodei HaTorah 9:1 the Rambam also brings this verse
>
> דבר ברור ומפורש בתורה, שהיא מצוה עומדת לעולם ולעולמי עולמים: אין לה לא שינוי, ולא גירעון ולא תוספת, שנאמר "את כל הדבר, אשר אנוכי מצווה אתכם--אותו תשמרו, לעשות: לא תוסף עליו, ולא תגרע ממנו
>
>
> הא למדת שכל דברי תורה, מצווין אנו לעשותן עד עולם
>
>
> It is explicit in the Torah that it is an eternal law forever, not subject to change, neither subtractions or additions, as it says "All the matters which I have commanded you, keep it to do perform; do not add onto it nor subtract from it."
>
>
> You have hereby learned that we are commanded to keep the entire Torah forever.
>
>
> |
37,379 | To my limited knowledge there is no such thing as "[abrogation](http://en.wikipedia.org/wiki/Abrogation)" within the Tanach. Such would *seem* to defeat the immutability of G-d's Law. This issue of abrogation comes up a lot in both Christian and Muslim circles, since many interpreters of the Christian bible and the Quran posit some sort of abrogation of previous scriptures (the Christians often claim aspects of Torah Law were abrogated and the Muslims have, even within their own canon, laws that are *seemingly* abrogated, although different jurists rule variably on this latter case).
Am I correct and, equally as important, what are the best verses in the Tanach which proclaim the changeless reality of G-d's Law? | 2014/04/23 | [
"https://judaism.stackexchange.com/questions/37379",
"https://judaism.stackexchange.com",
"https://judaism.stackexchange.com/users/5306/"
]
| Textual indicators abound for the eternal and immutable nature of the Torah. Besides examples provided in other answers, here are a couple more examples:
>
> Even all that the LORD hath commanded you by the hand of Moses, from the day that the LORD gave commandment, and onward throughout your generations ([*B'midbar* 15:23](http://www.mechon-mamre.org/p/pt/pt0415.htm#23)).
>
>
> And thou shalt keep His statutes, and His commandments, which I command thee this day, that it may go well with thee, and with thy children after thee, and that thou mayest prolong thy days upon the land, which the LORD thy G-d giveth thee, for ever ([*D'varim* 4:40](http://www.mechon-mamre.org/p/pt/pt0504.htm#40)).
>
>
> Of old have I known from Thy testimonies that Thou hast founded them for ever ([*T'hillim* 119:152](http://www.mechon-mamre.org/p/pt/pt26b9.htm#152)).
>
>
> All this word which I command you, that shall ye observe to do; thou shalt not add thereto, nor diminish from it ([*D'varim* 13:1](http://www.mechon-mamre.org/p/pt/pt0513.htm#1)).
>
>
>
Another approach, mentioned by the Rambam (*Moreh N'vuchim* 2:39), is that the perfect nature of the Torah precludes the possibility that it could be replaced with something that would necessarily be less perfect. Regarding this nature of the Torah, the Rambam cites such verses as:
>
> The law of the LORD is perfect ([*P'salms* 19:8](http://www.mechon-mamre.org/p/pt/pt2619.htm#8)).
>
>
>
More broadly speaking, other verses indicate that the Almighty's will is immutable and that He does not change His word:
>
> G-d is not a man, that He should lie; neither the son of man, that He should repent: when He hath said, will He not do it? or when He hath spoken, will He not fulfill it ([B'midbar 23:19](http://www.mechon-mamre.org/p/pt/pt0423.htm#19))?
>
>
> And also the Glory of Israel will not lie nor repent; for He is not a man, that He should repent ([Sh'mu'el I 15:29](http://www.mechon-mamre.org/p/pt/pt08a15.htm#29)).
>
>
>
The Ibn Ezra (*Sh'mos* 32:14) demonstrates that instances of the Almighty's regret as described elsewhere (e.g. *B'reishis* 6:6, *Sh'mos* 32:14, and *Sh'mu'el* I 15:11) are anthropopathic, and He does not actually change His mind:
>
> וינחם: חלילה להנחם השם, רק דברה תורה כלשון בני אדם, כמו ויעל (ברא' לה, יג), וירד (שם יא, ה), ישמח ד' במעשיו (תה' קד, לא), ויתעצב אל לבו (ברא' ו, ו). והנה שמואל אמר, וגם נצח ישראל לא ישקר ולא ינחם (ש"א טו, כט), ושם כתוב נחמתי שם, י.
>
>
> | The most explicit place in the Torah is Deuteronomy 13:2-6:
>
> יג,ב כִּי-יָקוּם בְּקִרְבְּךָ נָבִיא, אוֹ חֹלֵם חֲלוֹם; וְנָתַן אֵלֶיךָ אוֹת, אוֹ מוֹפֵת. יג,ג וּבָא הָאוֹת וְהַמּוֹפֵת, אֲשֶׁר-דִּבֶּר אֵלֶיךָ לֵאמֹר: נֵלְכָה אַחֲרֵי אֱלֹהִים אֲחֵרִים, אֲשֶׁר לֹא-יְדַעְתָּם--וְנָעָבְדֵם. יג,ד לֹא תִשְׁמַע, אֶל-דִּבְרֵי הַנָּבִיא הַהוּא, אוֹ אֶל-חוֹלֵם הַחֲלוֹם, הַהוּא: כִּי מְנַסֶּה יְהוָה אֱלֹהֵיכֶם, אֶתְכֶם, לָדַעַת הֲיִשְׁכֶם אֹהֲבִים אֶת-יְהוָה אֱלֹהֵיכֶם, בְּכָל-לְבַבְכֶם וּבְכָל-נַפְשְׁכֶם. יג,ה אַחֲרֵי יְהוָה אֱלֹהֵיכֶם תֵּלֵכוּ, וְאֹתוֹ תִירָאוּ; וְאֶת-מִצְוֹתָיו תִּשְׁמֹרוּ וּבְקֹלוֹ תִשְׁמָעוּ, וְאֹתוֹ תַעֲבֹדוּ וּבוֹ תִדְבָּקוּן. יג,ו וְהַנָּבִיא הַהוּא אוֹ חֹלֵם הַחֲלוֹם הַהוּא יוּמָת, כִּי דִבֶּר-סָרָה עַל-יְהוָה אֱלֹהֵיכֶם הַמּוֹצִיא אֶתְכֶם מֵאֶרֶץ מִצְרַיִם וְהַפֹּדְךָ מִבֵּית עֲבָדִים--לְהַדִּיחֲךָ מִן-הַדֶּרֶךְ, אֲשֶׁר צִוְּךָ יְהוָה אֱלֹהֶיךָ לָלֶכֶת בָּהּ; וּבִעַרְתָּ הָרָע, מִקִּרְבֶּךָ.
>
>
>
Translation ([Mechon Mamre](http://mechon-mamre.org/p/pt/pt0513.htm)):
>
> 2 If there arise in the midst of thee a prophet, or a dreamer of dreams--and he give thee a sign or a wonder, 3 and the sign or the wonder come to pass, whereof he spoke unto thee--saying: 'Let us go after other gods, which thou hast not known, and let us serve them'; 4 thou shalt not hearken unto the words of that prophet, or unto that dreamer of dreams; for the LORD your God putteth you to proof, to know whether ye do love the LORD your God with all your heart and with all your soul. 5 After the LORD your God shall ye walk, and Him shall ye fear, and His commandments shall ye keep, and unto His voice shall ye hearken, and Him shall ye serve, and unto Him shall ye cleave. 6 And that prophet, or that dreamer of dreams, shall be put to death; because he hath spoken perversion against the LORD your God, who brought you out of the land of Egypt, and redeemed thee out of the house of bondage, to draw thee aside out of the way which the LORD thy God commanded thee to walk in. So shalt thou put away the evil from the midst of thee.
>
>
>
It is fairly clear from these verses that God will never change His commandment prohibiting idolatry. The oral tradition extends this to all other permanent changes (temporary changes are permitted on a case-by-case basis). |
37,379 | To my limited knowledge there is no such thing as "[abrogation](http://en.wikipedia.org/wiki/Abrogation)" within the Tanach. Such would *seem* to defeat the immutability of G-d's Law. This issue of abrogation comes up a lot in both Christian and Muslim circles, since many interpreters of the Christian bible and the Quran posit some sort of abrogation of previous scriptures (the Christians often claim aspects of Torah Law were abrogated and the Muslims have, even within their own canon, laws that are *seemingly* abrogated, although different jurists rule variably on this latter case).
Am I correct and, equally as important, what are the best verses in the Tanach which proclaim the changeless reality of G-d's Law? | 2014/04/23 | [
"https://judaism.stackexchange.com/questions/37379",
"https://judaism.stackexchange.com",
"https://judaism.stackexchange.com/users/5306/"
]
| The most explicit place in the Torah is Deuteronomy 13:2-6:
>
> יג,ב כִּי-יָקוּם בְּקִרְבְּךָ נָבִיא, אוֹ חֹלֵם חֲלוֹם; וְנָתַן אֵלֶיךָ אוֹת, אוֹ מוֹפֵת. יג,ג וּבָא הָאוֹת וְהַמּוֹפֵת, אֲשֶׁר-דִּבֶּר אֵלֶיךָ לֵאמֹר: נֵלְכָה אַחֲרֵי אֱלֹהִים אֲחֵרִים, אֲשֶׁר לֹא-יְדַעְתָּם--וְנָעָבְדֵם. יג,ד לֹא תִשְׁמַע, אֶל-דִּבְרֵי הַנָּבִיא הַהוּא, אוֹ אֶל-חוֹלֵם הַחֲלוֹם, הַהוּא: כִּי מְנַסֶּה יְהוָה אֱלֹהֵיכֶם, אֶתְכֶם, לָדַעַת הֲיִשְׁכֶם אֹהֲבִים אֶת-יְהוָה אֱלֹהֵיכֶם, בְּכָל-לְבַבְכֶם וּבְכָל-נַפְשְׁכֶם. יג,ה אַחֲרֵי יְהוָה אֱלֹהֵיכֶם תֵּלֵכוּ, וְאֹתוֹ תִירָאוּ; וְאֶת-מִצְוֹתָיו תִּשְׁמֹרוּ וּבְקֹלוֹ תִשְׁמָעוּ, וְאֹתוֹ תַעֲבֹדוּ וּבוֹ תִדְבָּקוּן. יג,ו וְהַנָּבִיא הַהוּא אוֹ חֹלֵם הַחֲלוֹם הַהוּא יוּמָת, כִּי דִבֶּר-סָרָה עַל-יְהוָה אֱלֹהֵיכֶם הַמּוֹצִיא אֶתְכֶם מֵאֶרֶץ מִצְרַיִם וְהַפֹּדְךָ מִבֵּית עֲבָדִים--לְהַדִּיחֲךָ מִן-הַדֶּרֶךְ, אֲשֶׁר צִוְּךָ יְהוָה אֱלֹהֶיךָ לָלֶכֶת בָּהּ; וּבִעַרְתָּ הָרָע, מִקִּרְבֶּךָ.
>
>
>
Translation ([Mechon Mamre](http://mechon-mamre.org/p/pt/pt0513.htm)):
>
> 2 If there arise in the midst of thee a prophet, or a dreamer of dreams--and he give thee a sign or a wonder, 3 and the sign or the wonder come to pass, whereof he spoke unto thee--saying: 'Let us go after other gods, which thou hast not known, and let us serve them'; 4 thou shalt not hearken unto the words of that prophet, or unto that dreamer of dreams; for the LORD your God putteth you to proof, to know whether ye do love the LORD your God with all your heart and with all your soul. 5 After the LORD your God shall ye walk, and Him shall ye fear, and His commandments shall ye keep, and unto His voice shall ye hearken, and Him shall ye serve, and unto Him shall ye cleave. 6 And that prophet, or that dreamer of dreams, shall be put to death; because he hath spoken perversion against the LORD your God, who brought you out of the land of Egypt, and redeemed thee out of the house of bondage, to draw thee aside out of the way which the LORD thy God commanded thee to walk in. So shalt thou put away the evil from the midst of thee.
>
>
>
It is fairly clear from these verses that God will never change His commandment prohibiting idolatry. The oral tradition extends this to all other permanent changes (temporary changes are permitted on a case-by-case basis). | End of Malachi and the final word of the prophets to keep in mind before the arrival of Eliyahu:
>
> "Remember the Torah of Moshe my servant, which I enjoined on him at
> Horev (Sinai), laws and rulings for all Israel. 5 Look, I will send to you
> Eliyahu the prophet before the coming of the great and terrible Day of
> God. 6 He will turn the hearts of the fathers to the children and the
> hearts of the children to their fathers; otherwise I will come and
> strike the land with complete destruction." Look, I will send to you
> Eliyahu the prophet before the coming of the great and terrible Day of
> God."
>
>
>
this implies that the Torah of Moshe will be valid until the end of days |
37,379 | To my limited knowledge there is no such thing as "[abrogation](http://en.wikipedia.org/wiki/Abrogation)" within the Tanach. Such would *seem* to defeat the immutability of G-d's Law. This issue of abrogation comes up a lot in both Christian and Muslim circles, since many interpreters of the Christian bible and the Quran posit some sort of abrogation of previous scriptures (the Christians often claim aspects of Torah Law were abrogated and the Muslims have, even within their own canon, laws that are *seemingly* abrogated, although different jurists rule variably on this latter case).
Am I correct and, equally as important, what are the best verses in the Tanach which proclaim the changeless reality of G-d's Law? | 2014/04/23 | [
"https://judaism.stackexchange.com/questions/37379",
"https://judaism.stackexchange.com",
"https://judaism.stackexchange.com/users/5306/"
]
| The most explicit place in the Torah is Deuteronomy 13:2-6:
>
> יג,ב כִּי-יָקוּם בְּקִרְבְּךָ נָבִיא, אוֹ חֹלֵם חֲלוֹם; וְנָתַן אֵלֶיךָ אוֹת, אוֹ מוֹפֵת. יג,ג וּבָא הָאוֹת וְהַמּוֹפֵת, אֲשֶׁר-דִּבֶּר אֵלֶיךָ לֵאמֹר: נֵלְכָה אַחֲרֵי אֱלֹהִים אֲחֵרִים, אֲשֶׁר לֹא-יְדַעְתָּם--וְנָעָבְדֵם. יג,ד לֹא תִשְׁמַע, אֶל-דִּבְרֵי הַנָּבִיא הַהוּא, אוֹ אֶל-חוֹלֵם הַחֲלוֹם, הַהוּא: כִּי מְנַסֶּה יְהוָה אֱלֹהֵיכֶם, אֶתְכֶם, לָדַעַת הֲיִשְׁכֶם אֹהֲבִים אֶת-יְהוָה אֱלֹהֵיכֶם, בְּכָל-לְבַבְכֶם וּבְכָל-נַפְשְׁכֶם. יג,ה אַחֲרֵי יְהוָה אֱלֹהֵיכֶם תֵּלֵכוּ, וְאֹתוֹ תִירָאוּ; וְאֶת-מִצְוֹתָיו תִּשְׁמֹרוּ וּבְקֹלוֹ תִשְׁמָעוּ, וְאֹתוֹ תַעֲבֹדוּ וּבוֹ תִדְבָּקוּן. יג,ו וְהַנָּבִיא הַהוּא אוֹ חֹלֵם הַחֲלוֹם הַהוּא יוּמָת, כִּי דִבֶּר-סָרָה עַל-יְהוָה אֱלֹהֵיכֶם הַמּוֹצִיא אֶתְכֶם מֵאֶרֶץ מִצְרַיִם וְהַפֹּדְךָ מִבֵּית עֲבָדִים--לְהַדִּיחֲךָ מִן-הַדֶּרֶךְ, אֲשֶׁר צִוְּךָ יְהוָה אֱלֹהֶיךָ לָלֶכֶת בָּהּ; וּבִעַרְתָּ הָרָע, מִקִּרְבֶּךָ.
>
>
>
Translation ([Mechon Mamre](http://mechon-mamre.org/p/pt/pt0513.htm)):
>
> 2 If there arise in the midst of thee a prophet, or a dreamer of dreams--and he give thee a sign or a wonder, 3 and the sign or the wonder come to pass, whereof he spoke unto thee--saying: 'Let us go after other gods, which thou hast not known, and let us serve them'; 4 thou shalt not hearken unto the words of that prophet, or unto that dreamer of dreams; for the LORD your God putteth you to proof, to know whether ye do love the LORD your God with all your heart and with all your soul. 5 After the LORD your God shall ye walk, and Him shall ye fear, and His commandments shall ye keep, and unto His voice shall ye hearken, and Him shall ye serve, and unto Him shall ye cleave. 6 And that prophet, or that dreamer of dreams, shall be put to death; because he hath spoken perversion against the LORD your God, who brought you out of the land of Egypt, and redeemed thee out of the house of bondage, to draw thee aside out of the way which the LORD thy God commanded thee to walk in. So shalt thou put away the evil from the midst of thee.
>
>
>
It is fairly clear from these verses that God will never change His commandment prohibiting idolatry. The oral tradition extends this to all other permanent changes (temporary changes are permitted on a case-by-case basis). | In addition to everything else stated here, the Rambam in his introduction to the last chapter of Sanhedrin, where he develops his 13 foundations of Jewish belief, explains the immutability of the Torah as the 9th foundation, and quotes the verse "You shall not add onto [the Torah] or subtract from it" (Deuteronomy 13:1) as the source of this central belief.
In Yesodei HaTorah 9:1 the Rambam also brings this verse
>
> דבר ברור ומפורש בתורה, שהיא מצוה עומדת לעולם ולעולמי עולמים: אין לה לא שינוי, ולא גירעון ולא תוספת, שנאמר "את כל הדבר, אשר אנוכי מצווה אתכם--אותו תשמרו, לעשות: לא תוסף עליו, ולא תגרע ממנו
>
>
> הא למדת שכל דברי תורה, מצווין אנו לעשותן עד עולם
>
>
> It is explicit in the Torah that it is an eternal law forever, not subject to change, neither subtractions or additions, as it says "All the matters which I have commanded you, keep it to do perform; do not add onto it nor subtract from it."
>
>
> You have hereby learned that we are commanded to keep the entire Torah forever.
>
>
> |
37,379 | To my limited knowledge there is no such thing as "[abrogation](http://en.wikipedia.org/wiki/Abrogation)" within the Tanach. Such would *seem* to defeat the immutability of G-d's Law. This issue of abrogation comes up a lot in both Christian and Muslim circles, since many interpreters of the Christian bible and the Quran posit some sort of abrogation of previous scriptures (the Christians often claim aspects of Torah Law were abrogated and the Muslims have, even within their own canon, laws that are *seemingly* abrogated, although different jurists rule variably on this latter case).
Am I correct and, equally as important, what are the best verses in the Tanach which proclaim the changeless reality of G-d's Law? | 2014/04/23 | [
"https://judaism.stackexchange.com/questions/37379",
"https://judaism.stackexchange.com",
"https://judaism.stackexchange.com/users/5306/"
]
| Textual indicators abound for the eternal and immutable nature of the Torah. Besides examples provided in other answers, here are a couple more examples:
>
> Even all that the LORD hath commanded you by the hand of Moses, from the day that the LORD gave commandment, and onward throughout your generations ([*B'midbar* 15:23](http://www.mechon-mamre.org/p/pt/pt0415.htm#23)).
>
>
> And thou shalt keep His statutes, and His commandments, which I command thee this day, that it may go well with thee, and with thy children after thee, and that thou mayest prolong thy days upon the land, which the LORD thy G-d giveth thee, for ever ([*D'varim* 4:40](http://www.mechon-mamre.org/p/pt/pt0504.htm#40)).
>
>
> Of old have I known from Thy testimonies that Thou hast founded them for ever ([*T'hillim* 119:152](http://www.mechon-mamre.org/p/pt/pt26b9.htm#152)).
>
>
> All this word which I command you, that shall ye observe to do; thou shalt not add thereto, nor diminish from it ([*D'varim* 13:1](http://www.mechon-mamre.org/p/pt/pt0513.htm#1)).
>
>
>
Another approach, mentioned by the Rambam (*Moreh N'vuchim* 2:39), is that the perfect nature of the Torah precludes the possibility that it could be replaced with something that would necessarily be less perfect. Regarding this nature of the Torah, the Rambam cites such verses as:
>
> The law of the LORD is perfect ([*P'salms* 19:8](http://www.mechon-mamre.org/p/pt/pt2619.htm#8)).
>
>
>
More broadly speaking, other verses indicate that the Almighty's will is immutable and that He does not change His word:
>
> G-d is not a man, that He should lie; neither the son of man, that He should repent: when He hath said, will He not do it? or when He hath spoken, will He not fulfill it ([B'midbar 23:19](http://www.mechon-mamre.org/p/pt/pt0423.htm#19))?
>
>
> And also the Glory of Israel will not lie nor repent; for He is not a man, that He should repent ([Sh'mu'el I 15:29](http://www.mechon-mamre.org/p/pt/pt08a15.htm#29)).
>
>
>
The Ibn Ezra (*Sh'mos* 32:14) demonstrates that instances of the Almighty's regret as described elsewhere (e.g. *B'reishis* 6:6, *Sh'mos* 32:14, and *Sh'mu'el* I 15:11) are anthropopathic, and He does not actually change His mind:
>
> וינחם: חלילה להנחם השם, רק דברה תורה כלשון בני אדם, כמו ויעל (ברא' לה, יג), וירד (שם יא, ה), ישמח ד' במעשיו (תה' קד, לא), ויתעצב אל לבו (ברא' ו, ו). והנה שמואל אמר, וגם נצח ישראל לא ישקר ולא ינחם (ש"א טו, כט), ושם כתוב נחמתי שם, י.
>
>
> | End of Malachi and the final word of the prophets to keep in mind before the arrival of Eliyahu:
>
> "Remember the Torah of Moshe my servant, which I enjoined on him at
> Horev (Sinai), laws and rulings for all Israel. 5 Look, I will send to you
> Eliyahu the prophet before the coming of the great and terrible Day of
> God. 6 He will turn the hearts of the fathers to the children and the
> hearts of the children to their fathers; otherwise I will come and
> strike the land with complete destruction." Look, I will send to you
> Eliyahu the prophet before the coming of the great and terrible Day of
> God."
>
>
>
this implies that the Torah of Moshe will be valid until the end of days |
37,379 | To my limited knowledge there is no such thing as "[abrogation](http://en.wikipedia.org/wiki/Abrogation)" within the Tanach. Such would *seem* to defeat the immutability of G-d's Law. This issue of abrogation comes up a lot in both Christian and Muslim circles, since many interpreters of the Christian bible and the Quran posit some sort of abrogation of previous scriptures (the Christians often claim aspects of Torah Law were abrogated and the Muslims have, even within their own canon, laws that are *seemingly* abrogated, although different jurists rule variably on this latter case).
Am I correct and, equally as important, what are the best verses in the Tanach which proclaim the changeless reality of G-d's Law? | 2014/04/23 | [
"https://judaism.stackexchange.com/questions/37379",
"https://judaism.stackexchange.com",
"https://judaism.stackexchange.com/users/5306/"
]
| Textual indicators abound for the eternal and immutable nature of the Torah. Besides examples provided in other answers, here are a couple more examples:
>
> Even all that the LORD hath commanded you by the hand of Moses, from the day that the LORD gave commandment, and onward throughout your generations ([*B'midbar* 15:23](http://www.mechon-mamre.org/p/pt/pt0415.htm#23)).
>
>
> And thou shalt keep His statutes, and His commandments, which I command thee this day, that it may go well with thee, and with thy children after thee, and that thou mayest prolong thy days upon the land, which the LORD thy G-d giveth thee, for ever ([*D'varim* 4:40](http://www.mechon-mamre.org/p/pt/pt0504.htm#40)).
>
>
> Of old have I known from Thy testimonies that Thou hast founded them for ever ([*T'hillim* 119:152](http://www.mechon-mamre.org/p/pt/pt26b9.htm#152)).
>
>
> All this word which I command you, that shall ye observe to do; thou shalt not add thereto, nor diminish from it ([*D'varim* 13:1](http://www.mechon-mamre.org/p/pt/pt0513.htm#1)).
>
>
>
Another approach, mentioned by the Rambam (*Moreh N'vuchim* 2:39), is that the perfect nature of the Torah precludes the possibility that it could be replaced with something that would necessarily be less perfect. Regarding this nature of the Torah, the Rambam cites such verses as:
>
> The law of the LORD is perfect ([*P'salms* 19:8](http://www.mechon-mamre.org/p/pt/pt2619.htm#8)).
>
>
>
More broadly speaking, other verses indicate that the Almighty's will is immutable and that He does not change His word:
>
> G-d is not a man, that He should lie; neither the son of man, that He should repent: when He hath said, will He not do it? or when He hath spoken, will He not fulfill it ([B'midbar 23:19](http://www.mechon-mamre.org/p/pt/pt0423.htm#19))?
>
>
> And also the Glory of Israel will not lie nor repent; for He is not a man, that He should repent ([Sh'mu'el I 15:29](http://www.mechon-mamre.org/p/pt/pt08a15.htm#29)).
>
>
>
The Ibn Ezra (*Sh'mos* 32:14) demonstrates that instances of the Almighty's regret as described elsewhere (e.g. *B'reishis* 6:6, *Sh'mos* 32:14, and *Sh'mu'el* I 15:11) are anthropopathic, and He does not actually change His mind:
>
> וינחם: חלילה להנחם השם, רק דברה תורה כלשון בני אדם, כמו ויעל (ברא' לה, יג), וירד (שם יא, ה), ישמח ד' במעשיו (תה' קד, לא), ויתעצב אל לבו (ברא' ו, ו). והנה שמואל אמר, וגם נצח ישראל לא ישקר ולא ינחם (ש"א טו, כט), ושם כתוב נחמתי שם, י.
>
>
> | In addition to everything else stated here, the Rambam in his introduction to the last chapter of Sanhedrin, where he develops his 13 foundations of Jewish belief, explains the immutability of the Torah as the 9th foundation, and quotes the verse "You shall not add onto [the Torah] or subtract from it" (Deuteronomy 13:1) as the source of this central belief.
In Yesodei HaTorah 9:1 the Rambam also brings this verse
>
> דבר ברור ומפורש בתורה, שהיא מצוה עומדת לעולם ולעולמי עולמים: אין לה לא שינוי, ולא גירעון ולא תוספת, שנאמר "את כל הדבר, אשר אנוכי מצווה אתכם--אותו תשמרו, לעשות: לא תוסף עליו, ולא תגרע ממנו
>
>
> הא למדת שכל דברי תורה, מצווין אנו לעשותן עד עולם
>
>
> It is explicit in the Torah that it is an eternal law forever, not subject to change, neither subtractions or additions, as it says "All the matters which I have commanded you, keep it to do perform; do not add onto it nor subtract from it."
>
>
> You have hereby learned that we are commanded to keep the entire Torah forever.
>
>
> |
39,945,881 | In class, our assignment is to create a two-dimensional array and create a tic-tac-toe game around it. I have everything done except displaying when the whole board is full and the game is a draw. I have tried a few things but I have not found the solution and I need some help... Here is my code:
```
import java.util.Scanner;
public class TicTacToe {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int row, column;
char player = 'X';
//create 2 dimensional array for tic tac toe board
char[][] board = new char[3][3];
char ch = '1';
for (int i = 0; i < 3; i++){
for (int j = 0; j < 3; j++) {
board[i][j] = ch++;
}
}
displayBoard(board);
while(!winner(board) == true){
//get input for row/column
System.out.println("Enter a row and column (0, 1, or 2); for player " + player + ":");
row = in.nextInt();
column = in.nextInt();
//occupied
while (board[row][column] == 'X' || board[row][column] == 'O') {
System.out.println("This spot is occupied. Please try again");
}
//place the X
board[row][column] = player;
displayBoard(board);
if (winner(board)){
System.out.println("Player " + player + " is the winner!");
}
//time to swap players after each go.
if (player == 'O') {
player = 'X';
}
else {
player = 'O';
}
if (winner(board) == false) {
System.out.println("The game is a draw. Please try again.");
}
}
private static void displayBoard(char[][] board) {
for (int i = 0; i < board.length; i++) {
for (int j = 0; j < board[i].length; j++) {
if (j == board[i].length - 1) System.out.print(board[i][j]);
else System.out.print( board[i][j] + " | ");
}
System.out.println();
}
}
//method to determine whether there is an x or an o in the spot
public static Boolean winner(char[][] board){
for (int i = 0; i< board.length; i++) {
for (int j = 0; j < board[0].length; j++) {
if (board[i][j] == 'O' || board[i][j] == 'X') {
return false;
}
}
}
return (board[0][0] == board [0][1] && board[0][0] == board [0][2]) ||
(board[0][0] == board [1][1] && board[0][0] == board [2][2]) ||
(board[0][0] == board [1][0] && board[0][0] == board [2][0]) ||
(board[2][0] == board [2][1] && board[2][0] == board [2][2]) ||
(board[2][0] == board [1][1] && board[0][0] == board [0][2]) ||
(board[0][2] == board [1][2] && board[0][2] == board [2][2]) ||
(board[0][1] == board [1][1] && board[0][1] == board [2][1]) ||
(board[1][0] == board [1][1] && board[1][0] == board [1][2]);
}
}
```
I want output saying that the board is full when it's full but I get nothing. This is the last line of my output and as you can see, my current strategy is not working as it continues to ask for input. -->
Enter a row and column (0, 1, or 2); for player X:
2 0
X | O | X
O | O | X
X | X | O
Enter a row and column (0, 1, or 2); for player O: | 2016/10/09 | [
"https://Stackoverflow.com/questions/39945881",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6791413/"
]
| First off:
```
while (board[row][column] == 'X' || board[row][column] == 'O') {
System.out.println("This spot is occupied. Please try again");
}
```
This will create a infinite loop because `row` and `column` shouldn't change you should ask for new input!
Also
```
public static Boolean winner(char[][] board){
for (int i = 0; i< board.length; i++) {
for (int j = 0; j < board[0].length; j++) {
if (board[i][j] == 'O' || board[i][j] == 'X') {
return false;
}
}
}
```
As soon you hit 'O' or 'X' you will exit the Method with a false (no winner)
What you probably want to check is if every spot is occupied
```
public static Boolean winner(char[][] board){
//Boolean which is true until there is a empty spot
boolean occupied = true;
//loop and check if there is empty space or if its a draw
for (int i = 0; i< board.length; i++) {
for (int j = 0; j < board[0].length; j++) {
//Check if spot is not 'O' or not 'X' => empty
if (board[i][j] != 'O' || board[i][j] != 'X') {
occupied = false;
}
}
}
if(occupied)
return false;
//Check if someone won
return (board[0][0] == board [0][1] && board[0][0] == board [0][2]) ||
(board[0][0] == board [1][1] && board[0][0] == board [2][2]) ||
(board[0][0] == board [1][0] && board[0][0] == board [2][0]) ||
(board[2][0] == board [2][1] && board[2][0] == board [2][2]) ||
(board[2][0] == board [1][1] && board[0][0] == board [0][2]) ||
(board[0][2] == board [1][2] && board[0][2] == board [2][2]) ||
(board[0][1] == board [1][1] && board[0][1] == board [2][1]) ||
(board[1][0] == board [1][1] && board[1][0] == board [1][2]);
}
```
This would now check if there is a winner or its a tie
```
Occupied == true == tie == return false
Winner == return true
```
But you have three states:
* Win
* Tie
* NotFinished
With the changed Method you will NOT finish the game until you win.
Reason:
```
while(!winner(board) == true)
```
This makes the game run as long as there is NO winner
(winner() will be false because everything is occupied or there is no winner)
```
while(!false==true) => while(true)
```
You could write a method similar to winner but it only checks if the board has empty spots:
```
public static Boolean hasEmptySpot(char[][] board){
//loop and check if there is empty space
for (int i = 0; i< board.length; i++) {
for (int j = 0; j < board[0].length; j++) {
if (board[i][j] != 'O' && board[i][j] != 'X') {
return true;
}
}
}
return false;
}
//New code
while(hasEmptySpot(board) || !winner(board)){
//Your code for the game here
....
}
```
this would end the game when there is no empty spot left
After you finished the game you can call winner(board) and it will return if you tied or won!
By creating `hasEmptySpot()` you could change your winner method to
```
public static Boolean winner(char[][] board){
return (board[0][0] == board [0][1] && board[0][0] == board [0][2]) ||
(board[0][0] == board [1][1] && board[0][0] == board [2][2]) ||
(board[0][0] == board [1][0] && board[0][0] == board [2][0]) ||
(board[2][0] == board [2][1] && board[2][0] == board [2][2]) ||
(board[2][0] == board [1][1] && board[0][0] == board [0][2]) ||
(board[0][2] == board [1][2] && board[0][2] == board [2][2]) ||
(board[0][1] == board [1][1] && board[0][1] == board [2][1]) ||
(board[1][0] == board [1][1] && board[1][0] == board [1][2]);
}
```
Why?
Because you finished the game and you know there are only two possible outcomes Win or Tie.
I hope this helped you a little bit.
**EDIT**
Had a logic error myself!
**First mistake:**
you still need to check if there is a winner while the game is running forgot that point!
```
while(hasEmptySpot(board) || !winner(board)){
}
```
Now this will quit the game loop when there is a winner or no empty spots is left
**Second mistake:**
In hasEmptySpot()
```
if (board[i][j] != 'O' && board[i][j] != 'X') {
return true;
```
not
```
if (board[i][j] != 'O' || board[i][j] != 'X') {
return true;
```
Fixed it in the upper examples.
I'm sorry for the inconvenience! | You could try to incorporate a new method such as the following:
```
public Boolean boardFull()
{
short count = 0;
for(short i = 0; i < 3; i++){
for(short j = 0; j < 3; j++){
if(board[i][j] == ‘O’ || board[i][j] == ’X’){
count++;
} else {
continue;
}
}
}
if(count == 9){
return true;
} else {
return false;
}
}
```
You could use an if statement to see if it returns true and then print something out if it does. |
39,945,881 | In class, our assignment is to create a two-dimensional array and create a tic-tac-toe game around it. I have everything done except displaying when the whole board is full and the game is a draw. I have tried a few things but I have not found the solution and I need some help... Here is my code:
```
import java.util.Scanner;
public class TicTacToe {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int row, column;
char player = 'X';
//create 2 dimensional array for tic tac toe board
char[][] board = new char[3][3];
char ch = '1';
for (int i = 0; i < 3; i++){
for (int j = 0; j < 3; j++) {
board[i][j] = ch++;
}
}
displayBoard(board);
while(!winner(board) == true){
//get input for row/column
System.out.println("Enter a row and column (0, 1, or 2); for player " + player + ":");
row = in.nextInt();
column = in.nextInt();
//occupied
while (board[row][column] == 'X' || board[row][column] == 'O') {
System.out.println("This spot is occupied. Please try again");
}
//place the X
board[row][column] = player;
displayBoard(board);
if (winner(board)){
System.out.println("Player " + player + " is the winner!");
}
//time to swap players after each go.
if (player == 'O') {
player = 'X';
}
else {
player = 'O';
}
if (winner(board) == false) {
System.out.println("The game is a draw. Please try again.");
}
}
private static void displayBoard(char[][] board) {
for (int i = 0; i < board.length; i++) {
for (int j = 0; j < board[i].length; j++) {
if (j == board[i].length - 1) System.out.print(board[i][j]);
else System.out.print( board[i][j] + " | ");
}
System.out.println();
}
}
//method to determine whether there is an x or an o in the spot
public static Boolean winner(char[][] board){
for (int i = 0; i< board.length; i++) {
for (int j = 0; j < board[0].length; j++) {
if (board[i][j] == 'O' || board[i][j] == 'X') {
return false;
}
}
}
return (board[0][0] == board [0][1] && board[0][0] == board [0][2]) ||
(board[0][0] == board [1][1] && board[0][0] == board [2][2]) ||
(board[0][0] == board [1][0] && board[0][0] == board [2][0]) ||
(board[2][0] == board [2][1] && board[2][0] == board [2][2]) ||
(board[2][0] == board [1][1] && board[0][0] == board [0][2]) ||
(board[0][2] == board [1][2] && board[0][2] == board [2][2]) ||
(board[0][1] == board [1][1] && board[0][1] == board [2][1]) ||
(board[1][0] == board [1][1] && board[1][0] == board [1][2]);
}
}
```
I want output saying that the board is full when it's full but I get nothing. This is the last line of my output and as you can see, my current strategy is not working as it continues to ask for input. -->
Enter a row and column (0, 1, or 2); for player X:
2 0
X | O | X
O | O | X
X | X | O
Enter a row and column (0, 1, or 2); for player O: | 2016/10/09 | [
"https://Stackoverflow.com/questions/39945881",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6791413/"
]
| The most efficient way to do this is to keep a running count of how many spaces have been filled previously and increment that count each time a space is occupied. The board can be considered full when that count reaches 9.
If you're familiar with object-oriented programming, I think you'll find this easier to implement if you wrap your 2D array in a Board class.
Example:
```
public static class Board {
private char[][] spaces = new char[3][3];
private int numMoves = 0;
public void makeMove(int row, int col, char player) {
if (spaces[row][col] == 'X' || spaces[row][col] == 'O') {
System.out.println("This spot is occupied. Please try again");
} else {
spaces[row][col] = player;
numMoves++;
}
}
public boolean isFull() {
return numMoves == 9;
}
public boolean hasWinner() {
...
}
public void display() {
...
}
}
``` | You could try to incorporate a new method such as the following:
```
public Boolean boardFull()
{
short count = 0;
for(short i = 0; i < 3; i++){
for(short j = 0; j < 3; j++){
if(board[i][j] == ‘O’ || board[i][j] == ’X’){
count++;
} else {
continue;
}
}
}
if(count == 9){
return true;
} else {
return false;
}
}
```
You could use an if statement to see if it returns true and then print something out if it does. |
39,945,881 | In class, our assignment is to create a two-dimensional array and create a tic-tac-toe game around it. I have everything done except displaying when the whole board is full and the game is a draw. I have tried a few things but I have not found the solution and I need some help... Here is my code:
```
import java.util.Scanner;
public class TicTacToe {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int row, column;
char player = 'X';
//create 2 dimensional array for tic tac toe board
char[][] board = new char[3][3];
char ch = '1';
for (int i = 0; i < 3; i++){
for (int j = 0; j < 3; j++) {
board[i][j] = ch++;
}
}
displayBoard(board);
while(!winner(board) == true){
//get input for row/column
System.out.println("Enter a row and column (0, 1, or 2); for player " + player + ":");
row = in.nextInt();
column = in.nextInt();
//occupied
while (board[row][column] == 'X' || board[row][column] == 'O') {
System.out.println("This spot is occupied. Please try again");
}
//place the X
board[row][column] = player;
displayBoard(board);
if (winner(board)){
System.out.println("Player " + player + " is the winner!");
}
//time to swap players after each go.
if (player == 'O') {
player = 'X';
}
else {
player = 'O';
}
if (winner(board) == false) {
System.out.println("The game is a draw. Please try again.");
}
}
private static void displayBoard(char[][] board) {
for (int i = 0; i < board.length; i++) {
for (int j = 0; j < board[i].length; j++) {
if (j == board[i].length - 1) System.out.print(board[i][j]);
else System.out.print( board[i][j] + " | ");
}
System.out.println();
}
}
//method to determine whether there is an x or an o in the spot
public static Boolean winner(char[][] board){
for (int i = 0; i< board.length; i++) {
for (int j = 0; j < board[0].length; j++) {
if (board[i][j] == 'O' || board[i][j] == 'X') {
return false;
}
}
}
return (board[0][0] == board [0][1] && board[0][0] == board [0][2]) ||
(board[0][0] == board [1][1] && board[0][0] == board [2][2]) ||
(board[0][0] == board [1][0] && board[0][0] == board [2][0]) ||
(board[2][0] == board [2][1] && board[2][0] == board [2][2]) ||
(board[2][0] == board [1][1] && board[0][0] == board [0][2]) ||
(board[0][2] == board [1][2] && board[0][2] == board [2][2]) ||
(board[0][1] == board [1][1] && board[0][1] == board [2][1]) ||
(board[1][0] == board [1][1] && board[1][0] == board [1][2]);
}
}
```
I want output saying that the board is full when it's full but I get nothing. This is the last line of my output and as you can see, my current strategy is not working as it continues to ask for input. -->
Enter a row and column (0, 1, or 2); for player X:
2 0
X | O | X
O | O | X
X | X | O
Enter a row and column (0, 1, or 2); for player O: | 2016/10/09 | [
"https://Stackoverflow.com/questions/39945881",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6791413/"
]
| First off:
```
while (board[row][column] == 'X' || board[row][column] == 'O') {
System.out.println("This spot is occupied. Please try again");
}
```
This will create a infinite loop because `row` and `column` shouldn't change you should ask for new input!
Also
```
public static Boolean winner(char[][] board){
for (int i = 0; i< board.length; i++) {
for (int j = 0; j < board[0].length; j++) {
if (board[i][j] == 'O' || board[i][j] == 'X') {
return false;
}
}
}
```
As soon you hit 'O' or 'X' you will exit the Method with a false (no winner)
What you probably want to check is if every spot is occupied
```
public static Boolean winner(char[][] board){
//Boolean which is true until there is a empty spot
boolean occupied = true;
//loop and check if there is empty space or if its a draw
for (int i = 0; i< board.length; i++) {
for (int j = 0; j < board[0].length; j++) {
//Check if spot is not 'O' or not 'X' => empty
if (board[i][j] != 'O' || board[i][j] != 'X') {
occupied = false;
}
}
}
if(occupied)
return false;
//Check if someone won
return (board[0][0] == board [0][1] && board[0][0] == board [0][2]) ||
(board[0][0] == board [1][1] && board[0][0] == board [2][2]) ||
(board[0][0] == board [1][0] && board[0][0] == board [2][0]) ||
(board[2][0] == board [2][1] && board[2][0] == board [2][2]) ||
(board[2][0] == board [1][1] && board[0][0] == board [0][2]) ||
(board[0][2] == board [1][2] && board[0][2] == board [2][2]) ||
(board[0][1] == board [1][1] && board[0][1] == board [2][1]) ||
(board[1][0] == board [1][1] && board[1][0] == board [1][2]);
}
```
This would now check if there is a winner or its a tie
```
Occupied == true == tie == return false
Winner == return true
```
But you have three states:
* Win
* Tie
* NotFinished
With the changed Method you will NOT finish the game until you win.
Reason:
```
while(!winner(board) == true)
```
This makes the game run as long as there is NO winner
(winner() will be false because everything is occupied or there is no winner)
```
while(!false==true) => while(true)
```
You could write a method similar to winner but it only checks if the board has empty spots:
```
public static Boolean hasEmptySpot(char[][] board){
//loop and check if there is empty space
for (int i = 0; i< board.length; i++) {
for (int j = 0; j < board[0].length; j++) {
if (board[i][j] != 'O' && board[i][j] != 'X') {
return true;
}
}
}
return false;
}
//New code
while(hasEmptySpot(board) || !winner(board)){
//Your code for the game here
....
}
```
this would end the game when there is no empty spot left
After you finished the game you can call winner(board) and it will return if you tied or won!
By creating `hasEmptySpot()` you could change your winner method to
```
public static Boolean winner(char[][] board){
return (board[0][0] == board [0][1] && board[0][0] == board [0][2]) ||
(board[0][0] == board [1][1] && board[0][0] == board [2][2]) ||
(board[0][0] == board [1][0] && board[0][0] == board [2][0]) ||
(board[2][0] == board [2][1] && board[2][0] == board [2][2]) ||
(board[2][0] == board [1][1] && board[0][0] == board [0][2]) ||
(board[0][2] == board [1][2] && board[0][2] == board [2][2]) ||
(board[0][1] == board [1][1] && board[0][1] == board [2][1]) ||
(board[1][0] == board [1][1] && board[1][0] == board [1][2]);
}
```
Why?
Because you finished the game and you know there are only two possible outcomes Win or Tie.
I hope this helped you a little bit.
**EDIT**
Had a logic error myself!
**First mistake:**
you still need to check if there is a winner while the game is running forgot that point!
```
while(hasEmptySpot(board) || !winner(board)){
}
```
Now this will quit the game loop when there is a winner or no empty spots is left
**Second mistake:**
In hasEmptySpot()
```
if (board[i][j] != 'O' && board[i][j] != 'X') {
return true;
```
not
```
if (board[i][j] != 'O' || board[i][j] != 'X') {
return true;
```
Fixed it in the upper examples.
I'm sorry for the inconvenience! | Solution
========
The code that's not working is your `winner()` method. It is always returning `false` if there is at least one cell occupied. You could proceed based on the last part of [Nordiii's answer](https://stackoverflow.com/questions/39945881/java-tic-tac-toe-game-using-2-dimensional-array/39946445#39946445).
Extra problems
==============
### Cell-checking loop
Your code to check if a cell is occupied is going infinitely. You need to use an 'if' statement instead of a 'while' loop:
```
if(board[row][column] == 'X' || board[row][column] == 'O'){
System.out.println("This spot is occupied. Please try again");
continue;
}
```
Your old code got stuck always checking if 1 cell was occupied and it always returned `true`, which kept the loop alive and flooded your console. The `continue` statement will exit the current iteration of your other 'while' loop and start a new iteration, thus asking for new input.
### Exceptions
Man, that's a lot of uncaught exceptions! If I mess up my input, pow! The whole thing fails. Just put a `try` block for your input-checking code:
```
try {
row = in.nextInt();
column = in.nextInt();
// Attempt to place player (an ArrayOutOfBoundsException could be thrown)
if(board[row][column] == 'X' || board[row][column] == 'O'){
System.out.println("This spot is occupied. Please try again");
continue;
}
board[row][column] = player;
} catch(Exception e){
System.out.println("I'm sorry, I didn't get that.");
continue;
}
```
This attempts to execute the code inside the `try` statement, and if someone inputs something incorrect, the exception gets 'caught' and a new iteration is created. Genius! |
39,945,881 | In class, our assignment is to create a two-dimensional array and create a tic-tac-toe game around it. I have everything done except displaying when the whole board is full and the game is a draw. I have tried a few things but I have not found the solution and I need some help... Here is my code:
```
import java.util.Scanner;
public class TicTacToe {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int row, column;
char player = 'X';
//create 2 dimensional array for tic tac toe board
char[][] board = new char[3][3];
char ch = '1';
for (int i = 0; i < 3; i++){
for (int j = 0; j < 3; j++) {
board[i][j] = ch++;
}
}
displayBoard(board);
while(!winner(board) == true){
//get input for row/column
System.out.println("Enter a row and column (0, 1, or 2); for player " + player + ":");
row = in.nextInt();
column = in.nextInt();
//occupied
while (board[row][column] == 'X' || board[row][column] == 'O') {
System.out.println("This spot is occupied. Please try again");
}
//place the X
board[row][column] = player;
displayBoard(board);
if (winner(board)){
System.out.println("Player " + player + " is the winner!");
}
//time to swap players after each go.
if (player == 'O') {
player = 'X';
}
else {
player = 'O';
}
if (winner(board) == false) {
System.out.println("The game is a draw. Please try again.");
}
}
private static void displayBoard(char[][] board) {
for (int i = 0; i < board.length; i++) {
for (int j = 0; j < board[i].length; j++) {
if (j == board[i].length - 1) System.out.print(board[i][j]);
else System.out.print( board[i][j] + " | ");
}
System.out.println();
}
}
//method to determine whether there is an x or an o in the spot
public static Boolean winner(char[][] board){
for (int i = 0; i< board.length; i++) {
for (int j = 0; j < board[0].length; j++) {
if (board[i][j] == 'O' || board[i][j] == 'X') {
return false;
}
}
}
return (board[0][0] == board [0][1] && board[0][0] == board [0][2]) ||
(board[0][0] == board [1][1] && board[0][0] == board [2][2]) ||
(board[0][0] == board [1][0] && board[0][0] == board [2][0]) ||
(board[2][0] == board [2][1] && board[2][0] == board [2][2]) ||
(board[2][0] == board [1][1] && board[0][0] == board [0][2]) ||
(board[0][2] == board [1][2] && board[0][2] == board [2][2]) ||
(board[0][1] == board [1][1] && board[0][1] == board [2][1]) ||
(board[1][0] == board [1][1] && board[1][0] == board [1][2]);
}
}
```
I want output saying that the board is full when it's full but I get nothing. This is the last line of my output and as you can see, my current strategy is not working as it continues to ask for input. -->
Enter a row and column (0, 1, or 2); for player X:
2 0
X | O | X
O | O | X
X | X | O
Enter a row and column (0, 1, or 2); for player O: | 2016/10/09 | [
"https://Stackoverflow.com/questions/39945881",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6791413/"
]
| First off:
```
while (board[row][column] == 'X' || board[row][column] == 'O') {
System.out.println("This spot is occupied. Please try again");
}
```
This will create a infinite loop because `row` and `column` shouldn't change you should ask for new input!
Also
```
public static Boolean winner(char[][] board){
for (int i = 0; i< board.length; i++) {
for (int j = 0; j < board[0].length; j++) {
if (board[i][j] == 'O' || board[i][j] == 'X') {
return false;
}
}
}
```
As soon you hit 'O' or 'X' you will exit the Method with a false (no winner)
What you probably want to check is if every spot is occupied
```
public static Boolean winner(char[][] board){
//Boolean which is true until there is a empty spot
boolean occupied = true;
//loop and check if there is empty space or if its a draw
for (int i = 0; i< board.length; i++) {
for (int j = 0; j < board[0].length; j++) {
//Check if spot is not 'O' or not 'X' => empty
if (board[i][j] != 'O' || board[i][j] != 'X') {
occupied = false;
}
}
}
if(occupied)
return false;
//Check if someone won
return (board[0][0] == board [0][1] && board[0][0] == board [0][2]) ||
(board[0][0] == board [1][1] && board[0][0] == board [2][2]) ||
(board[0][0] == board [1][0] && board[0][0] == board [2][0]) ||
(board[2][0] == board [2][1] && board[2][0] == board [2][2]) ||
(board[2][0] == board [1][1] && board[0][0] == board [0][2]) ||
(board[0][2] == board [1][2] && board[0][2] == board [2][2]) ||
(board[0][1] == board [1][1] && board[0][1] == board [2][1]) ||
(board[1][0] == board [1][1] && board[1][0] == board [1][2]);
}
```
This would now check if there is a winner or its a tie
```
Occupied == true == tie == return false
Winner == return true
```
But you have three states:
* Win
* Tie
* NotFinished
With the changed Method you will NOT finish the game until you win.
Reason:
```
while(!winner(board) == true)
```
This makes the game run as long as there is NO winner
(winner() will be false because everything is occupied or there is no winner)
```
while(!false==true) => while(true)
```
You could write a method similar to winner but it only checks if the board has empty spots:
```
public static Boolean hasEmptySpot(char[][] board){
//loop and check if there is empty space
for (int i = 0; i< board.length; i++) {
for (int j = 0; j < board[0].length; j++) {
if (board[i][j] != 'O' && board[i][j] != 'X') {
return true;
}
}
}
return false;
}
//New code
while(hasEmptySpot(board) || !winner(board)){
//Your code for the game here
....
}
```
this would end the game when there is no empty spot left
After you finished the game you can call winner(board) and it will return if you tied or won!
By creating `hasEmptySpot()` you could change your winner method to
```
public static Boolean winner(char[][] board){
return (board[0][0] == board [0][1] && board[0][0] == board [0][2]) ||
(board[0][0] == board [1][1] && board[0][0] == board [2][2]) ||
(board[0][0] == board [1][0] && board[0][0] == board [2][0]) ||
(board[2][0] == board [2][1] && board[2][0] == board [2][2]) ||
(board[2][0] == board [1][1] && board[0][0] == board [0][2]) ||
(board[0][2] == board [1][2] && board[0][2] == board [2][2]) ||
(board[0][1] == board [1][1] && board[0][1] == board [2][1]) ||
(board[1][0] == board [1][1] && board[1][0] == board [1][2]);
}
```
Why?
Because you finished the game and you know there are only two possible outcomes Win or Tie.
I hope this helped you a little bit.
**EDIT**
Had a logic error myself!
**First mistake:**
you still need to check if there is a winner while the game is running forgot that point!
```
while(hasEmptySpot(board) || !winner(board)){
}
```
Now this will quit the game loop when there is a winner or no empty spots is left
**Second mistake:**
In hasEmptySpot()
```
if (board[i][j] != 'O' && board[i][j] != 'X') {
return true;
```
not
```
if (board[i][j] != 'O' || board[i][j] != 'X') {
return true;
```
Fixed it in the upper examples.
I'm sorry for the inconvenience! | The most efficient way to do this is to keep a running count of how many spaces have been filled previously and increment that count each time a space is occupied. The board can be considered full when that count reaches 9.
If you're familiar with object-oriented programming, I think you'll find this easier to implement if you wrap your 2D array in a Board class.
Example:
```
public static class Board {
private char[][] spaces = new char[3][3];
private int numMoves = 0;
public void makeMove(int row, int col, char player) {
if (spaces[row][col] == 'X' || spaces[row][col] == 'O') {
System.out.println("This spot is occupied. Please try again");
} else {
spaces[row][col] = player;
numMoves++;
}
}
public boolean isFull() {
return numMoves == 9;
}
public boolean hasWinner() {
...
}
public void display() {
...
}
}
``` |
39,945,881 | In class, our assignment is to create a two-dimensional array and create a tic-tac-toe game around it. I have everything done except displaying when the whole board is full and the game is a draw. I have tried a few things but I have not found the solution and I need some help... Here is my code:
```
import java.util.Scanner;
public class TicTacToe {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int row, column;
char player = 'X';
//create 2 dimensional array for tic tac toe board
char[][] board = new char[3][3];
char ch = '1';
for (int i = 0; i < 3; i++){
for (int j = 0; j < 3; j++) {
board[i][j] = ch++;
}
}
displayBoard(board);
while(!winner(board) == true){
//get input for row/column
System.out.println("Enter a row and column (0, 1, or 2); for player " + player + ":");
row = in.nextInt();
column = in.nextInt();
//occupied
while (board[row][column] == 'X' || board[row][column] == 'O') {
System.out.println("This spot is occupied. Please try again");
}
//place the X
board[row][column] = player;
displayBoard(board);
if (winner(board)){
System.out.println("Player " + player + " is the winner!");
}
//time to swap players after each go.
if (player == 'O') {
player = 'X';
}
else {
player = 'O';
}
if (winner(board) == false) {
System.out.println("The game is a draw. Please try again.");
}
}
private static void displayBoard(char[][] board) {
for (int i = 0; i < board.length; i++) {
for (int j = 0; j < board[i].length; j++) {
if (j == board[i].length - 1) System.out.print(board[i][j]);
else System.out.print( board[i][j] + " | ");
}
System.out.println();
}
}
//method to determine whether there is an x or an o in the spot
public static Boolean winner(char[][] board){
for (int i = 0; i< board.length; i++) {
for (int j = 0; j < board[0].length; j++) {
if (board[i][j] == 'O' || board[i][j] == 'X') {
return false;
}
}
}
return (board[0][0] == board [0][1] && board[0][0] == board [0][2]) ||
(board[0][0] == board [1][1] && board[0][0] == board [2][2]) ||
(board[0][0] == board [1][0] && board[0][0] == board [2][0]) ||
(board[2][0] == board [2][1] && board[2][0] == board [2][2]) ||
(board[2][0] == board [1][1] && board[0][0] == board [0][2]) ||
(board[0][2] == board [1][2] && board[0][2] == board [2][2]) ||
(board[0][1] == board [1][1] && board[0][1] == board [2][1]) ||
(board[1][0] == board [1][1] && board[1][0] == board [1][2]);
}
}
```
I want output saying that the board is full when it's full but I get nothing. This is the last line of my output and as you can see, my current strategy is not working as it continues to ask for input. -->
Enter a row and column (0, 1, or 2); for player X:
2 0
X | O | X
O | O | X
X | X | O
Enter a row and column (0, 1, or 2); for player O: | 2016/10/09 | [
"https://Stackoverflow.com/questions/39945881",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6791413/"
]
| First off:
```
while (board[row][column] == 'X' || board[row][column] == 'O') {
System.out.println("This spot is occupied. Please try again");
}
```
This will create a infinite loop because `row` and `column` shouldn't change you should ask for new input!
Also
```
public static Boolean winner(char[][] board){
for (int i = 0; i< board.length; i++) {
for (int j = 0; j < board[0].length; j++) {
if (board[i][j] == 'O' || board[i][j] == 'X') {
return false;
}
}
}
```
As soon you hit 'O' or 'X' you will exit the Method with a false (no winner)
What you probably want to check is if every spot is occupied
```
public static Boolean winner(char[][] board){
//Boolean which is true until there is a empty spot
boolean occupied = true;
//loop and check if there is empty space or if its a draw
for (int i = 0; i< board.length; i++) {
for (int j = 0; j < board[0].length; j++) {
//Check if spot is not 'O' or not 'X' => empty
if (board[i][j] != 'O' || board[i][j] != 'X') {
occupied = false;
}
}
}
if(occupied)
return false;
//Check if someone won
return (board[0][0] == board [0][1] && board[0][0] == board [0][2]) ||
(board[0][0] == board [1][1] && board[0][0] == board [2][2]) ||
(board[0][0] == board [1][0] && board[0][0] == board [2][0]) ||
(board[2][0] == board [2][1] && board[2][0] == board [2][2]) ||
(board[2][0] == board [1][1] && board[0][0] == board [0][2]) ||
(board[0][2] == board [1][2] && board[0][2] == board [2][2]) ||
(board[0][1] == board [1][1] && board[0][1] == board [2][1]) ||
(board[1][0] == board [1][1] && board[1][0] == board [1][2]);
}
```
This would now check if there is a winner or its a tie
```
Occupied == true == tie == return false
Winner == return true
```
But you have three states:
* Win
* Tie
* NotFinished
With the changed Method you will NOT finish the game until you win.
Reason:
```
while(!winner(board) == true)
```
This makes the game run as long as there is NO winner
(winner() will be false because everything is occupied or there is no winner)
```
while(!false==true) => while(true)
```
You could write a method similar to winner but it only checks if the board has empty spots:
```
public static Boolean hasEmptySpot(char[][] board){
//loop and check if there is empty space
for (int i = 0; i< board.length; i++) {
for (int j = 0; j < board[0].length; j++) {
if (board[i][j] != 'O' && board[i][j] != 'X') {
return true;
}
}
}
return false;
}
//New code
while(hasEmptySpot(board) || !winner(board)){
//Your code for the game here
....
}
```
this would end the game when there is no empty spot left
After you finished the game you can call winner(board) and it will return if you tied or won!
By creating `hasEmptySpot()` you could change your winner method to
```
public static Boolean winner(char[][] board){
return (board[0][0] == board [0][1] && board[0][0] == board [0][2]) ||
(board[0][0] == board [1][1] && board[0][0] == board [2][2]) ||
(board[0][0] == board [1][0] && board[0][0] == board [2][0]) ||
(board[2][0] == board [2][1] && board[2][0] == board [2][2]) ||
(board[2][0] == board [1][1] && board[0][0] == board [0][2]) ||
(board[0][2] == board [1][2] && board[0][2] == board [2][2]) ||
(board[0][1] == board [1][1] && board[0][1] == board [2][1]) ||
(board[1][0] == board [1][1] && board[1][0] == board [1][2]);
}
```
Why?
Because you finished the game and you know there are only two possible outcomes Win or Tie.
I hope this helped you a little bit.
**EDIT**
Had a logic error myself!
**First mistake:**
you still need to check if there is a winner while the game is running forgot that point!
```
while(hasEmptySpot(board) || !winner(board)){
}
```
Now this will quit the game loop when there is a winner or no empty spots is left
**Second mistake:**
In hasEmptySpot()
```
if (board[i][j] != 'O' && board[i][j] != 'X') {
return true;
```
not
```
if (board[i][j] != 'O' || board[i][j] != 'X') {
return true;
```
Fixed it in the upper examples.
I'm sorry for the inconvenience! | Although there are already some great answers I'd like to post another solution that is more generic in its logic to determine the winner. Currently you've hard-coded your some of the possible winning scenarios when you could write more generic logic for this.
As other answers have pointed out you want a method to check for unoccupied spaces in the board and this will tell you if there is a tie. I have implemented such a method in the code below along with the more generic winner logic.
Note that some methods are public to make it easier to test, they do not necessarily have to remain public.
```
import java.util.Scanner;
public class TicTacToe {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int row, column;
char player = 'X';
//create 2 dimensional array for tic tac toe board
char[][] board = new char[3][3];
char ch = '1';
for (int i = 0; i < 3; i++){
for (int j = 0; j < 3; j++) {
board[i][j] = ch++;
}
}
displayBoard(board);
while(!winner(board) == true){
//get input for row/column
System.out.println("Enter a row and column (0, 1, or 2); for player " + player + ":");
row = in.nextInt();
column = in.nextInt();
//occupied
while (board[row][column] == 'X' || board[row][column] == 'O') {
System.out.println("This spot is occupied. Please try again");
}
//place the X
board[row][column] = player;
displayBoard(board);
if (winner(board)){
System.out.println("Player " + player + " is the winner!");
}
//time to swap players after each go.
if (player == 'O') {
player = 'X';
}
else {
player = 'O';
}
if (winner(board) == false && !hasFreeSpace(board)) {
System.out.println("The game is a draw. Please try again.");
}
}
//Don't forget to close the scanner.
in.close();
}
public static void displayBoard(char[][] board) {
for (int i = 0; i < board.length; i++) {
for (int j = 0; j < board[i].length; j++) {
if (j == board[i].length - 1) System.out.print(board[i][j]);
else System.out.print( board[i][j] + " | ");
}
System.out.println();
}
}
/**
* Determines whether the board is completely occupied by X and O characters
* @param board the board to search through
* @return true if entire board is populated by X or O, false otherwise.
*/
public static boolean hasFreeSpace(char[][] board){
for (int i = 0; i< board.length; i++) {
for (int j = 0; j < board[0].length; j++) {
if (board[i][j] != 'O' && board[i][j] != 'X') {
return true;
}
}
}
return false;
}
//method to determine whether there is a winner
public static boolean winner(char[][] board){
return isHorizontalWin(board) || isVerticalWin(board) || isDiagonalWin(board);
}
/**
* Determines if there is a winner by checking each row for consecutive
* matching tokens.
* @return true if there is a winner horizontally, false otherwise.
*/
private static boolean isHorizontalWin(char[][] board) {
for(int row = 0; row < board.length; row++){
if(isWin(board[row]))
return true;
}
return false;
}
/**
* Determines whether all of the buttons in the specified array have the
* same text and that the text is not empty string.
* @param lineToProcess an array of buttons representing a line in the grid
* @return true if all buttons in the array have the same non-empty text, false otherwise.
*/
private static boolean isWin(char[] lineToProcess) {
boolean foundWin = true;
char prevChar = '-';
for(char character: lineToProcess) {
if(prevChar == '-')
prevChar = character;
if ('O' != character && 'X' != character) {
foundWin = false;
break;
} else if (prevChar != character) {
foundWin = false;
break;
}
}
return foundWin;
}
/**
* Determines whether there is a winner by checking column for consecutive
* matching tokens.
* @return true if there is a vertical winner, false otherwise.
*/
private static boolean isVerticalWin(char[][] board) {
char[] column = null;
//assuming all rows have same legnth (same number of cols in each row), use first row
for(int col = 0; col < board[0].length; col++){
column = new char[board[0].length];
for(int row = 0; row < column.length; row++){
column[row] = board[row][col];
}
if(isWin(column))
return true;
}
return false;
}
/**
* Determines if there is a winner by checking each diagonal for consecutive
* matching tokens.
* @return true if a diagonal winner exists, false otherwise.
*/
private static boolean isDiagonalWin(char[][] board) {
int row = 0, col = 0;
int cols = board.length;
int rows = board[0].length; //assuming all rows are equal length so just use the first one
//Create a one-dimensional array to represent the diagonal. Use the lesser
// of the rows or columns to set its size. If the grid is rectangular then
// a diagonal will always be the size of the lesser of its two dimensions.
int size = rows < cols ? rows : cols;
char[] diagonal = new char[size];
//Since we know the grid is a square we really could just check one of
// these - either row or col, but I left both in here anyway.
while (row < rows && col < cols) {
diagonal[col] = board[row][col];
row++;
col++;
}
if (isWin(diagonal)) {
return true;
}
row = rows - 1;
col = 0;
diagonal = new char[size];
while (row >=0 && col < cols) {
diagonal[col] = board[row][col];
row--;
col++;
}
return isWin(diagonal);
}
}
``` |
39,945,881 | In class, our assignment is to create a two-dimensional array and create a tic-tac-toe game around it. I have everything done except displaying when the whole board is full and the game is a draw. I have tried a few things but I have not found the solution and I need some help... Here is my code:
```
import java.util.Scanner;
public class TicTacToe {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int row, column;
char player = 'X';
//create 2 dimensional array for tic tac toe board
char[][] board = new char[3][3];
char ch = '1';
for (int i = 0; i < 3; i++){
for (int j = 0; j < 3; j++) {
board[i][j] = ch++;
}
}
displayBoard(board);
while(!winner(board) == true){
//get input for row/column
System.out.println("Enter a row and column (0, 1, or 2); for player " + player + ":");
row = in.nextInt();
column = in.nextInt();
//occupied
while (board[row][column] == 'X' || board[row][column] == 'O') {
System.out.println("This spot is occupied. Please try again");
}
//place the X
board[row][column] = player;
displayBoard(board);
if (winner(board)){
System.out.println("Player " + player + " is the winner!");
}
//time to swap players after each go.
if (player == 'O') {
player = 'X';
}
else {
player = 'O';
}
if (winner(board) == false) {
System.out.println("The game is a draw. Please try again.");
}
}
private static void displayBoard(char[][] board) {
for (int i = 0; i < board.length; i++) {
for (int j = 0; j < board[i].length; j++) {
if (j == board[i].length - 1) System.out.print(board[i][j]);
else System.out.print( board[i][j] + " | ");
}
System.out.println();
}
}
//method to determine whether there is an x or an o in the spot
public static Boolean winner(char[][] board){
for (int i = 0; i< board.length; i++) {
for (int j = 0; j < board[0].length; j++) {
if (board[i][j] == 'O' || board[i][j] == 'X') {
return false;
}
}
}
return (board[0][0] == board [0][1] && board[0][0] == board [0][2]) ||
(board[0][0] == board [1][1] && board[0][0] == board [2][2]) ||
(board[0][0] == board [1][0] && board[0][0] == board [2][0]) ||
(board[2][0] == board [2][1] && board[2][0] == board [2][2]) ||
(board[2][0] == board [1][1] && board[0][0] == board [0][2]) ||
(board[0][2] == board [1][2] && board[0][2] == board [2][2]) ||
(board[0][1] == board [1][1] && board[0][1] == board [2][1]) ||
(board[1][0] == board [1][1] && board[1][0] == board [1][2]);
}
}
```
I want output saying that the board is full when it's full but I get nothing. This is the last line of my output and as you can see, my current strategy is not working as it continues to ask for input. -->
Enter a row and column (0, 1, or 2); for player X:
2 0
X | O | X
O | O | X
X | X | O
Enter a row and column (0, 1, or 2); for player O: | 2016/10/09 | [
"https://Stackoverflow.com/questions/39945881",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6791413/"
]
| The most efficient way to do this is to keep a running count of how many spaces have been filled previously and increment that count each time a space is occupied. The board can be considered full when that count reaches 9.
If you're familiar with object-oriented programming, I think you'll find this easier to implement if you wrap your 2D array in a Board class.
Example:
```
public static class Board {
private char[][] spaces = new char[3][3];
private int numMoves = 0;
public void makeMove(int row, int col, char player) {
if (spaces[row][col] == 'X' || spaces[row][col] == 'O') {
System.out.println("This spot is occupied. Please try again");
} else {
spaces[row][col] = player;
numMoves++;
}
}
public boolean isFull() {
return numMoves == 9;
}
public boolean hasWinner() {
...
}
public void display() {
...
}
}
``` | Solution
========
The code that's not working is your `winner()` method. It is always returning `false` if there is at least one cell occupied. You could proceed based on the last part of [Nordiii's answer](https://stackoverflow.com/questions/39945881/java-tic-tac-toe-game-using-2-dimensional-array/39946445#39946445).
Extra problems
==============
### Cell-checking loop
Your code to check if a cell is occupied is going infinitely. You need to use an 'if' statement instead of a 'while' loop:
```
if(board[row][column] == 'X' || board[row][column] == 'O'){
System.out.println("This spot is occupied. Please try again");
continue;
}
```
Your old code got stuck always checking if 1 cell was occupied and it always returned `true`, which kept the loop alive and flooded your console. The `continue` statement will exit the current iteration of your other 'while' loop and start a new iteration, thus asking for new input.
### Exceptions
Man, that's a lot of uncaught exceptions! If I mess up my input, pow! The whole thing fails. Just put a `try` block for your input-checking code:
```
try {
row = in.nextInt();
column = in.nextInt();
// Attempt to place player (an ArrayOutOfBoundsException could be thrown)
if(board[row][column] == 'X' || board[row][column] == 'O'){
System.out.println("This spot is occupied. Please try again");
continue;
}
board[row][column] = player;
} catch(Exception e){
System.out.println("I'm sorry, I didn't get that.");
continue;
}
```
This attempts to execute the code inside the `try` statement, and if someone inputs something incorrect, the exception gets 'caught' and a new iteration is created. Genius! |
39,945,881 | In class, our assignment is to create a two-dimensional array and create a tic-tac-toe game around it. I have everything done except displaying when the whole board is full and the game is a draw. I have tried a few things but I have not found the solution and I need some help... Here is my code:
```
import java.util.Scanner;
public class TicTacToe {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int row, column;
char player = 'X';
//create 2 dimensional array for tic tac toe board
char[][] board = new char[3][3];
char ch = '1';
for (int i = 0; i < 3; i++){
for (int j = 0; j < 3; j++) {
board[i][j] = ch++;
}
}
displayBoard(board);
while(!winner(board) == true){
//get input for row/column
System.out.println("Enter a row and column (0, 1, or 2); for player " + player + ":");
row = in.nextInt();
column = in.nextInt();
//occupied
while (board[row][column] == 'X' || board[row][column] == 'O') {
System.out.println("This spot is occupied. Please try again");
}
//place the X
board[row][column] = player;
displayBoard(board);
if (winner(board)){
System.out.println("Player " + player + " is the winner!");
}
//time to swap players after each go.
if (player == 'O') {
player = 'X';
}
else {
player = 'O';
}
if (winner(board) == false) {
System.out.println("The game is a draw. Please try again.");
}
}
private static void displayBoard(char[][] board) {
for (int i = 0; i < board.length; i++) {
for (int j = 0; j < board[i].length; j++) {
if (j == board[i].length - 1) System.out.print(board[i][j]);
else System.out.print( board[i][j] + " | ");
}
System.out.println();
}
}
//method to determine whether there is an x or an o in the spot
public static Boolean winner(char[][] board){
for (int i = 0; i< board.length; i++) {
for (int j = 0; j < board[0].length; j++) {
if (board[i][j] == 'O' || board[i][j] == 'X') {
return false;
}
}
}
return (board[0][0] == board [0][1] && board[0][0] == board [0][2]) ||
(board[0][0] == board [1][1] && board[0][0] == board [2][2]) ||
(board[0][0] == board [1][0] && board[0][0] == board [2][0]) ||
(board[2][0] == board [2][1] && board[2][0] == board [2][2]) ||
(board[2][0] == board [1][1] && board[0][0] == board [0][2]) ||
(board[0][2] == board [1][2] && board[0][2] == board [2][2]) ||
(board[0][1] == board [1][1] && board[0][1] == board [2][1]) ||
(board[1][0] == board [1][1] && board[1][0] == board [1][2]);
}
}
```
I want output saying that the board is full when it's full but I get nothing. This is the last line of my output and as you can see, my current strategy is not working as it continues to ask for input. -->
Enter a row and column (0, 1, or 2); for player X:
2 0
X | O | X
O | O | X
X | X | O
Enter a row and column (0, 1, or 2); for player O: | 2016/10/09 | [
"https://Stackoverflow.com/questions/39945881",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6791413/"
]
| The most efficient way to do this is to keep a running count of how many spaces have been filled previously and increment that count each time a space is occupied. The board can be considered full when that count reaches 9.
If you're familiar with object-oriented programming, I think you'll find this easier to implement if you wrap your 2D array in a Board class.
Example:
```
public static class Board {
private char[][] spaces = new char[3][3];
private int numMoves = 0;
public void makeMove(int row, int col, char player) {
if (spaces[row][col] == 'X' || spaces[row][col] == 'O') {
System.out.println("This spot is occupied. Please try again");
} else {
spaces[row][col] = player;
numMoves++;
}
}
public boolean isFull() {
return numMoves == 9;
}
public boolean hasWinner() {
...
}
public void display() {
...
}
}
``` | Although there are already some great answers I'd like to post another solution that is more generic in its logic to determine the winner. Currently you've hard-coded your some of the possible winning scenarios when you could write more generic logic for this.
As other answers have pointed out you want a method to check for unoccupied spaces in the board and this will tell you if there is a tie. I have implemented such a method in the code below along with the more generic winner logic.
Note that some methods are public to make it easier to test, they do not necessarily have to remain public.
```
import java.util.Scanner;
public class TicTacToe {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int row, column;
char player = 'X';
//create 2 dimensional array for tic tac toe board
char[][] board = new char[3][3];
char ch = '1';
for (int i = 0; i < 3; i++){
for (int j = 0; j < 3; j++) {
board[i][j] = ch++;
}
}
displayBoard(board);
while(!winner(board) == true){
//get input for row/column
System.out.println("Enter a row and column (0, 1, or 2); for player " + player + ":");
row = in.nextInt();
column = in.nextInt();
//occupied
while (board[row][column] == 'X' || board[row][column] == 'O') {
System.out.println("This spot is occupied. Please try again");
}
//place the X
board[row][column] = player;
displayBoard(board);
if (winner(board)){
System.out.println("Player " + player + " is the winner!");
}
//time to swap players after each go.
if (player == 'O') {
player = 'X';
}
else {
player = 'O';
}
if (winner(board) == false && !hasFreeSpace(board)) {
System.out.println("The game is a draw. Please try again.");
}
}
//Don't forget to close the scanner.
in.close();
}
public static void displayBoard(char[][] board) {
for (int i = 0; i < board.length; i++) {
for (int j = 0; j < board[i].length; j++) {
if (j == board[i].length - 1) System.out.print(board[i][j]);
else System.out.print( board[i][j] + " | ");
}
System.out.println();
}
}
/**
* Determines whether the board is completely occupied by X and O characters
* @param board the board to search through
* @return true if entire board is populated by X or O, false otherwise.
*/
public static boolean hasFreeSpace(char[][] board){
for (int i = 0; i< board.length; i++) {
for (int j = 0; j < board[0].length; j++) {
if (board[i][j] != 'O' && board[i][j] != 'X') {
return true;
}
}
}
return false;
}
//method to determine whether there is a winner
public static boolean winner(char[][] board){
return isHorizontalWin(board) || isVerticalWin(board) || isDiagonalWin(board);
}
/**
* Determines if there is a winner by checking each row for consecutive
* matching tokens.
* @return true if there is a winner horizontally, false otherwise.
*/
private static boolean isHorizontalWin(char[][] board) {
for(int row = 0; row < board.length; row++){
if(isWin(board[row]))
return true;
}
return false;
}
/**
* Determines whether all of the buttons in the specified array have the
* same text and that the text is not empty string.
* @param lineToProcess an array of buttons representing a line in the grid
* @return true if all buttons in the array have the same non-empty text, false otherwise.
*/
private static boolean isWin(char[] lineToProcess) {
boolean foundWin = true;
char prevChar = '-';
for(char character: lineToProcess) {
if(prevChar == '-')
prevChar = character;
if ('O' != character && 'X' != character) {
foundWin = false;
break;
} else if (prevChar != character) {
foundWin = false;
break;
}
}
return foundWin;
}
/**
* Determines whether there is a winner by checking column for consecutive
* matching tokens.
* @return true if there is a vertical winner, false otherwise.
*/
private static boolean isVerticalWin(char[][] board) {
char[] column = null;
//assuming all rows have same legnth (same number of cols in each row), use first row
for(int col = 0; col < board[0].length; col++){
column = new char[board[0].length];
for(int row = 0; row < column.length; row++){
column[row] = board[row][col];
}
if(isWin(column))
return true;
}
return false;
}
/**
* Determines if there is a winner by checking each diagonal for consecutive
* matching tokens.
* @return true if a diagonal winner exists, false otherwise.
*/
private static boolean isDiagonalWin(char[][] board) {
int row = 0, col = 0;
int cols = board.length;
int rows = board[0].length; //assuming all rows are equal length so just use the first one
//Create a one-dimensional array to represent the diagonal. Use the lesser
// of the rows or columns to set its size. If the grid is rectangular then
// a diagonal will always be the size of the lesser of its two dimensions.
int size = rows < cols ? rows : cols;
char[] diagonal = new char[size];
//Since we know the grid is a square we really could just check one of
// these - either row or col, but I left both in here anyway.
while (row < rows && col < cols) {
diagonal[col] = board[row][col];
row++;
col++;
}
if (isWin(diagonal)) {
return true;
}
row = rows - 1;
col = 0;
diagonal = new char[size];
while (row >=0 && col < cols) {
diagonal[col] = board[row][col];
row--;
col++;
}
return isWin(diagonal);
}
}
``` |
930 | I would like to write a geocoding web service for genealogy in Java. Because it is for genealogy, I don't need to go down to the street level. I only need to go down to the county.
Looking at genealogy data, misspelled names are very common. People also use a lot of non standard abbreviations. For instance for Baltimore County might look like:
1. Baltimore
2. Baltimore County
3. Baltimore Co
4. Baltimore Cty | 2010/08/07 | [
"https://gis.stackexchange.com/questions/930",
"https://gis.stackexchange.com",
"https://gis.stackexchange.com/users/242/"
]
| A geocoding service needs geographic geometry data, an associated gazetteer (to handle naming and name alternatives), and a user interface (to mediate the search). For a reverse geocoder, you'll need to add a topology validator. For Java, the open source JTS Topology Suite would be the natural choice: <http://www.vividsolutions.com/jts/jtshome.htm>
County geometries for the United States can be found at the Census: <http://www.census.gov/geo/www/cob/co2000.html>
To get started on the gazetteer, the U.S. Board on Geographic Names has a database: <http://geonames.usgs.gov/>
Creating a solid gazetteer database and weaving algorithms that tolerate approximate search matches are the difficult part. | Google has a [nice API for geocoding](http://code.google.com/apis/maps/documentation/javascript/v2/services.html), if you can follow their terms of service. [Basic demo can be found here](http://code.google.com/apis/maps/documentation/javascript/v2/examples/geocoding-simple.html).
Using their service is subject to some limitations, but the result is intuitive, fast, accurate and familiar to most users. It will allow you to focus on developing the genealogy part of your service. |
930 | I would like to write a geocoding web service for genealogy in Java. Because it is for genealogy, I don't need to go down to the street level. I only need to go down to the county.
Looking at genealogy data, misspelled names are very common. People also use a lot of non standard abbreviations. For instance for Baltimore County might look like:
1. Baltimore
2. Baltimore County
3. Baltimore Co
4. Baltimore Cty | 2010/08/07 | [
"https://gis.stackexchange.com/questions/930",
"https://gis.stackexchange.com",
"https://gis.stackexchange.com/users/242/"
]
| I don't think this question is explicitly geographic, because you're only interested in names, so you may want to ask it on [Stack Overflow](http://stackoverflow.com). You could answer your question with two pieces of information: the state and the corrected county name. To perform the corrections, you'd likely want to use the [Levenshtein distance](http://en.wikipedia.org/wiki/Levenshtein_distance) ([example & java implementation](http://www.merriampark.com/ld.htm)) to match the fuzzy data to corrected values. | Google has a [nice API for geocoding](http://code.google.com/apis/maps/documentation/javascript/v2/services.html), if you can follow their terms of service. [Basic demo can be found here](http://code.google.com/apis/maps/documentation/javascript/v2/examples/geocoding-simple.html).
Using their service is subject to some limitations, but the result is intuitive, fast, accurate and familiar to most users. It will allow you to focus on developing the genealogy part of your service. |
930 | I would like to write a geocoding web service for genealogy in Java. Because it is for genealogy, I don't need to go down to the street level. I only need to go down to the county.
Looking at genealogy data, misspelled names are very common. People also use a lot of non standard abbreviations. For instance for Baltimore County might look like:
1. Baltimore
2. Baltimore County
3. Baltimore Co
4. Baltimore Cty | 2010/08/07 | [
"https://gis.stackexchange.com/questions/930",
"https://gis.stackexchange.com",
"https://gis.stackexchange.com/users/242/"
]
| for Java Geocoder try
<http://jgeocoder.sourceforge.net/>
a little dated (2008) but still might be useful
has a wiki
<http://docs.codehaus.org/display/JGEOCODER/JGeocoder+-+Free+Java+Geocoder> | Google has a [nice API for geocoding](http://code.google.com/apis/maps/documentation/javascript/v2/services.html), if you can follow their terms of service. [Basic demo can be found here](http://code.google.com/apis/maps/documentation/javascript/v2/examples/geocoding-simple.html).
Using their service is subject to some limitations, but the result is intuitive, fast, accurate and familiar to most users. It will allow you to focus on developing the genealogy part of your service. |
930 | I would like to write a geocoding web service for genealogy in Java. Because it is for genealogy, I don't need to go down to the street level. I only need to go down to the county.
Looking at genealogy data, misspelled names are very common. People also use a lot of non standard abbreviations. For instance for Baltimore County might look like:
1. Baltimore
2. Baltimore County
3. Baltimore Co
4. Baltimore Cty | 2010/08/07 | [
"https://gis.stackexchange.com/questions/930",
"https://gis.stackexchange.com",
"https://gis.stackexchange.com/users/242/"
]
| I don't think this question is explicitly geographic, because you're only interested in names, so you may want to ask it on [Stack Overflow](http://stackoverflow.com). You could answer your question with two pieces of information: the state and the corrected county name. To perform the corrections, you'd likely want to use the [Levenshtein distance](http://en.wikipedia.org/wiki/Levenshtein_distance) ([example & java implementation](http://www.merriampark.com/ld.htm)) to match the fuzzy data to corrected values. | A geocoding service needs geographic geometry data, an associated gazetteer (to handle naming and name alternatives), and a user interface (to mediate the search). For a reverse geocoder, you'll need to add a topology validator. For Java, the open source JTS Topology Suite would be the natural choice: <http://www.vividsolutions.com/jts/jtshome.htm>
County geometries for the United States can be found at the Census: <http://www.census.gov/geo/www/cob/co2000.html>
To get started on the gazetteer, the U.S. Board on Geographic Names has a database: <http://geonames.usgs.gov/>
Creating a solid gazetteer database and weaving algorithms that tolerate approximate search matches are the difficult part. |
930 | I would like to write a geocoding web service for genealogy in Java. Because it is for genealogy, I don't need to go down to the street level. I only need to go down to the county.
Looking at genealogy data, misspelled names are very common. People also use a lot of non standard abbreviations. For instance for Baltimore County might look like:
1. Baltimore
2. Baltimore County
3. Baltimore Co
4. Baltimore Cty | 2010/08/07 | [
"https://gis.stackexchange.com/questions/930",
"https://gis.stackexchange.com",
"https://gis.stackexchange.com/users/242/"
]
| A geocoding service needs geographic geometry data, an associated gazetteer (to handle naming and name alternatives), and a user interface (to mediate the search). For a reverse geocoder, you'll need to add a topology validator. For Java, the open source JTS Topology Suite would be the natural choice: <http://www.vividsolutions.com/jts/jtshome.htm>
County geometries for the United States can be found at the Census: <http://www.census.gov/geo/www/cob/co2000.html>
To get started on the gazetteer, the U.S. Board on Geographic Names has a database: <http://geonames.usgs.gov/>
Creating a solid gazetteer database and weaving algorithms that tolerate approximate search matches are the difficult part. | for Java Geocoder try
<http://jgeocoder.sourceforge.net/>
a little dated (2008) but still might be useful
has a wiki
<http://docs.codehaus.org/display/JGEOCODER/JGeocoder+-+Free+Java+Geocoder> |
930 | I would like to write a geocoding web service for genealogy in Java. Because it is for genealogy, I don't need to go down to the street level. I only need to go down to the county.
Looking at genealogy data, misspelled names are very common. People also use a lot of non standard abbreviations. For instance for Baltimore County might look like:
1. Baltimore
2. Baltimore County
3. Baltimore Co
4. Baltimore Cty | 2010/08/07 | [
"https://gis.stackexchange.com/questions/930",
"https://gis.stackexchange.com",
"https://gis.stackexchange.com/users/242/"
]
| I don't think this question is explicitly geographic, because you're only interested in names, so you may want to ask it on [Stack Overflow](http://stackoverflow.com). You could answer your question with two pieces of information: the state and the corrected county name. To perform the corrections, you'd likely want to use the [Levenshtein distance](http://en.wikipedia.org/wiki/Levenshtein_distance) ([example & java implementation](http://www.merriampark.com/ld.htm)) to match the fuzzy data to corrected values. | for Java Geocoder try
<http://jgeocoder.sourceforge.net/>
a little dated (2008) but still might be useful
has a wiki
<http://docs.codehaus.org/display/JGEOCODER/JGeocoder+-+Free+Java+Geocoder> |
40,480,827 | In the paper [*Girshick, R* **Fast-RCNN** (ICCV 2015)](https://arxiv.org/abs/1504.08083), section "3.1 Truncated SVD for faster detection", the author proposes to use [SVD](https://en.wikipedia.org/wiki/Singular_value_decomposition) trick to reduce the size and computation time of a fully connected layer.
Given a *trained* model (`deploy.prototxt` and `weights.caffemodel`), how can I use this trick to replace a fully connected layer with a truncated one? | 2016/11/08 | [
"https://Stackoverflow.com/questions/40480827",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1714410/"
]
| **Some linear-algebra background**
Singular Value Decomposition ([SVD](https://en.wikipedia.org/wiki/Singular_value_decomposition)) is a decomposition of any matrix `W` into three matrices:
```
W = U S V*
```
Where `U` and `V` are ortho-normal matrices, and `S` is diagonal with elements in decreasing magnitude on the diagonal.
One of the interesting properties of SVD is that it allows to easily approximate `W` with a lower rank matrix: Suppose you truncate `S` to have only its `k` leading elements (instead of all elements on the diagonal) then
```
W_app = U S_trunc V*
```
is a rank `k` approximation of `W`.
**Using SVD to approximate a fully connected layer**
Suppose we have a model `deploy_full.prototxt` with a fully connected layer
```
# ... some layers here
layer {
name: "fc_orig"
type: "InnerProduct"
bottom: "in"
top: "out"
inner_product_param {
num_output: 1000
# more params...
}
# some more...
}
# more layers...
```
Furthermore, we have `trained_weights_full.caffemodel` - trained parameters for `deploy_full.prototxt` model.
1. Copy `deploy_full.protoxt` to `deploy_svd.protoxt` and open it in editor of your choice. *Replace* the fully connected layer with these two layers:
```
layer {
name: "fc_svd_U"
type: "InnerProduct"
bottom: "in" # same input
top: "svd_interim"
inner_product_param {
num_output: 20 # approximate with k = 20 rank matrix
bias_term: false
# more params...
}
# some more...
}
# NO activation layer here!
layer {
name: "fc_svd_V"
type: "InnerProduct"
bottom: "svd_interim"
top: "out" # same output
inner_product_param {
num_output: 1000 # original number of outputs
# more params...
}
# some more...
}
```
2. In python, a little [net surgery](https://github.com/BVLC/caffe/blob/master/examples/net_surgery.ipynb):
```
import caffe
import numpy as np
orig_net = caffe.Net('deploy_full.prototxt', 'trained_weights_full.caffemodel', caffe.TEST)
svd_net = caffe.Net('deploy_svd.prototxt', 'trained_weights_full.caffemodel', caffe.TEST)
# get the original weight matrix
W = np.array( orig_net.params['fc_orig'][0].data )
# SVD decomposition
k = 20 # same as num_ouput of fc_svd_U
U, s, V = np.linalg.svd(W)
S = np.zeros((U.shape[0], k), dtype='f4')
S[:k,:k] = s[:k] # taking only leading k singular values
# assign weight to svd net
svd_net.params['fc_svd_U'][0].data[...] = np.dot(U,S)
svd_net.params['fc_svd_V'][0].data[...] = V[:k,:]
svd_net.params['fc_svd_V'][1].data[...] = orig_net.params['fc_orig'][1].data # same bias
# save the new weights
svd_net.save('trained_weights_svd.caffemodel')
```
Now we have `deploy_svd.prototxt` with `trained_weights_svd.caffemodel` that approximate the original net with far less multiplications, and weights. | Actually, Ross Girshick's py-faster-rcnn repo includes an implementation for the SVD step: [`compress_net.py`](https://github.com/rbgirshick/py-faster-rcnn/blob/master/tools/compress_net.py).
BTW, you usually need to fine-tune the compressed model to recover the accuracy (or to compress in a more sophisticated way, see for example "[Accelerating Very Deep Convolutional Networks for Classification and Detection](https://arxiv.org/abs/1505.06798)", Zhang et al).
Also, for me scipy.linalg.svd worked faster than numpy's svd. |
211,719 | I've read that there was something like this in the PC version of Star Control II. | 2015/03/30 | [
"https://gaming.stackexchange.com/questions/211719",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/7418/"
]
| TL;DR and nonspoilered: **YES**, but it's a very large limit so there's no real need to rush.
Full answer in spoilers. **LOTS AND LOTS OF SPOILERS**.
>
> The backdrop of the game is the brief lull in the galactic conflict as the green Ur-Quan (the Kzer-Za) have finished conquering their assigned chunk of the galaxy while the Black Ur-Quan (Kor-Ah) have finished *eradicating all sentient life* from their chunk, and now they've met halfway to fight each other in a contest they call Supremacy of Doctrine to see which of the two approaches should be adopted for the entire galaxy.
>
>
>
Unfortunately
>
> for everyone that's not Ur-Quan, the Kzer-Za ran into some unexpectedly heavy trouble in this sector of the galaxy from the Alliance of Free Races and it looks like the Kor-Ah are going to win this one. There are a few things you can find out and do that will delay their victory even further, but ultimately unless you beat the game they will eventually win and take their prize, the Precursor Superdreadnought Sa-Matra, and eradicate every sentient species in the sector.
>
>
>
Once that happens,
>
> you're on the final time limit -- since every eradicated species will no longer be in a position to prevent you from picking up the various necessary MacGuffins you can still rush a Pyrrhic victory, but once they destroy the Chenjesu Homeworld before you can evolve them into the Chmrr, you're screwed.
>
>
>
As it happens,
>
> Chenjesu is the last stop on their Sectorwide Genocide Tour, so after that they double back to nuke the starbase over Earth and send a message probe to taunt you
>
>
>
... which is the Non-Standard Game Over.
ETA: According to [this link](http://wiki.uqm.stack.nl/Star_Control_II_facts#Star_Control_II_fact_.235_-_Timed_events) (Spoiler warning) you have roughly 4.5 in-game years before the clock starts ticking to failure; time passes at a rate of one day every thirty seconds in interplanetary space and one day every five seconds in hyperspace/SPOILERSPACE.
(Thanks to Kaffeleif for the addendum) | Strictly speaking, yes there is a time limit... (spoiler warning) The game is intelligently written and scripted to respond interactively to the decisions made by the player. You may play nice and fall into the role of The One, or you can be a bit of a jerk. Your decisions may cause certain other races to leave our galaxy, or may cause the destruction and extermination of another race, and much more. Its part of the rich story telling aspect of the game which is the best part for me imho. But these are subplots and doesn't affect the main plot. Which means they're more like timed events served to advance the story. So you should be disappointed if you are expecting multiple story endings like Fallout. As i said the timer feature still applies, but the good news is that almost in any style of game play, you shall find more than enough time to complete the mission. Now, go play this epic game and enjoy. (p.s. I will take a minute of vigil tonight in memory of the atrocity of Activision in its brutal killing of such an esteemed title.) |
211,719 | I've read that there was something like this in the PC version of Star Control II. | 2015/03/30 | [
"https://gaming.stackexchange.com/questions/211719",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/7418/"
]
| As Shadur mentioned, there is a timelimit. Depending on various factors this limit is set to 4.5-5.5 years of ingame time.
These factors are
>
> \* If you sent Utwig and Supox to fight Kohr-Ah you get 1 extra year.
>
> \* If you are in the Delta Crateris solar system when Korh-Ah wins their war you get 7 days extra
>
> \* The Korh-Ah will travel to other races ships and destroy them. Depending on where these ships are you can gain some extra time
>
>
>
Source: <http://wiki.uqm.stack.nl/Star_Control_II_facts#Star_Control_II_fact_.235_-_Timed_events>
Under the block "Korh-Ah events" | Strictly speaking, yes there is a time limit... (spoiler warning) The game is intelligently written and scripted to respond interactively to the decisions made by the player. You may play nice and fall into the role of The One, or you can be a bit of a jerk. Your decisions may cause certain other races to leave our galaxy, or may cause the destruction and extermination of another race, and much more. Its part of the rich story telling aspect of the game which is the best part for me imho. But these are subplots and doesn't affect the main plot. Which means they're more like timed events served to advance the story. So you should be disappointed if you are expecting multiple story endings like Fallout. As i said the timer feature still applies, but the good news is that almost in any style of game play, you shall find more than enough time to complete the mission. Now, go play this epic game and enjoy. (p.s. I will take a minute of vigil tonight in memory of the atrocity of Activision in its brutal killing of such an esteemed title.) |
211,719 | I've read that there was something like this in the PC version of Star Control II. | 2015/03/30 | [
"https://gaming.stackexchange.com/questions/211719",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/7418/"
]
| As Shadur mentioned, there is a timelimit. Depending on various factors this limit is set to 4.5-5.5 years of ingame time.
These factors are
>
> \* If you sent Utwig and Supox to fight Kohr-Ah you get 1 extra year.
>
> \* If you are in the Delta Crateris solar system when Korh-Ah wins their war you get 7 days extra
>
> \* The Korh-Ah will travel to other races ships and destroy them. Depending on where these ships are you can gain some extra time
>
>
>
Source: <http://wiki.uqm.stack.nl/Star_Control_II_facts#Star_Control_II_fact_.235_-_Timed_events>
Under the block "Korh-Ah events" | TL;DR and nonspoilered: **YES**, but it's a very large limit so there's no real need to rush.
Full answer in spoilers. **LOTS AND LOTS OF SPOILERS**.
>
> The backdrop of the game is the brief lull in the galactic conflict as the green Ur-Quan (the Kzer-Za) have finished conquering their assigned chunk of the galaxy while the Black Ur-Quan (Kor-Ah) have finished *eradicating all sentient life* from their chunk, and now they've met halfway to fight each other in a contest they call Supremacy of Doctrine to see which of the two approaches should be adopted for the entire galaxy.
>
>
>
Unfortunately
>
> for everyone that's not Ur-Quan, the Kzer-Za ran into some unexpectedly heavy trouble in this sector of the galaxy from the Alliance of Free Races and it looks like the Kor-Ah are going to win this one. There are a few things you can find out and do that will delay their victory even further, but ultimately unless you beat the game they will eventually win and take their prize, the Precursor Superdreadnought Sa-Matra, and eradicate every sentient species in the sector.
>
>
>
Once that happens,
>
> you're on the final time limit -- since every eradicated species will no longer be in a position to prevent you from picking up the various necessary MacGuffins you can still rush a Pyrrhic victory, but once they destroy the Chenjesu Homeworld before you can evolve them into the Chmrr, you're screwed.
>
>
>
As it happens,
>
> Chenjesu is the last stop on their Sectorwide Genocide Tour, so after that they double back to nuke the starbase over Earth and send a message probe to taunt you
>
>
>
... which is the Non-Standard Game Over.
ETA: According to [this link](http://wiki.uqm.stack.nl/Star_Control_II_facts#Star_Control_II_fact_.235_-_Timed_events) (Spoiler warning) you have roughly 4.5 in-game years before the clock starts ticking to failure; time passes at a rate of one day every thirty seconds in interplanetary space and one day every five seconds in hyperspace/SPOILERSPACE.
(Thanks to Kaffeleif for the addendum) |
211,719 | I've read that there was something like this in the PC version of Star Control II. | 2015/03/30 | [
"https://gaming.stackexchange.com/questions/211719",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/7418/"
]
| TL;DR and nonspoilered: **YES**, but it's a very large limit so there's no real need to rush.
Full answer in spoilers. **LOTS AND LOTS OF SPOILERS**.
>
> The backdrop of the game is the brief lull in the galactic conflict as the green Ur-Quan (the Kzer-Za) have finished conquering their assigned chunk of the galaxy while the Black Ur-Quan (Kor-Ah) have finished *eradicating all sentient life* from their chunk, and now they've met halfway to fight each other in a contest they call Supremacy of Doctrine to see which of the two approaches should be adopted for the entire galaxy.
>
>
>
Unfortunately
>
> for everyone that's not Ur-Quan, the Kzer-Za ran into some unexpectedly heavy trouble in this sector of the galaxy from the Alliance of Free Races and it looks like the Kor-Ah are going to win this one. There are a few things you can find out and do that will delay their victory even further, but ultimately unless you beat the game they will eventually win and take their prize, the Precursor Superdreadnought Sa-Matra, and eradicate every sentient species in the sector.
>
>
>
Once that happens,
>
> you're on the final time limit -- since every eradicated species will no longer be in a position to prevent you from picking up the various necessary MacGuffins you can still rush a Pyrrhic victory, but once they destroy the Chenjesu Homeworld before you can evolve them into the Chmrr, you're screwed.
>
>
>
As it happens,
>
> Chenjesu is the last stop on their Sectorwide Genocide Tour, so after that they double back to nuke the starbase over Earth and send a message probe to taunt you
>
>
>
... which is the Non-Standard Game Over.
ETA: According to [this link](http://wiki.uqm.stack.nl/Star_Control_II_facts#Star_Control_II_fact_.235_-_Timed_events) (Spoiler warning) you have roughly 4.5 in-game years before the clock starts ticking to failure; time passes at a rate of one day every thirty seconds in interplanetary space and one day every five seconds in hyperspace/SPOILERSPACE.
(Thanks to Kaffeleif for the addendum) | So math-wise you have about 13 hours of gameplay in hyperspace to finish the game. The game is 4.5 years (4.5\*356 days = 1642.5 days), and each day is 30 seconds in hyperspace 1642.5\*30 seconds = 821 minutes, or 13.6875 |
211,719 | I've read that there was something like this in the PC version of Star Control II. | 2015/03/30 | [
"https://gaming.stackexchange.com/questions/211719",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/7418/"
]
| As Shadur mentioned, there is a timelimit. Depending on various factors this limit is set to 4.5-5.5 years of ingame time.
These factors are
>
> \* If you sent Utwig and Supox to fight Kohr-Ah you get 1 extra year.
>
> \* If you are in the Delta Crateris solar system when Korh-Ah wins their war you get 7 days extra
>
> \* The Korh-Ah will travel to other races ships and destroy them. Depending on where these ships are you can gain some extra time
>
>
>
Source: <http://wiki.uqm.stack.nl/Star_Control_II_facts#Star_Control_II_fact_.235_-_Timed_events>
Under the block "Korh-Ah events" | So math-wise you have about 13 hours of gameplay in hyperspace to finish the game. The game is 4.5 years (4.5\*356 days = 1642.5 days), and each day is 30 seconds in hyperspace 1642.5\*30 seconds = 821 minutes, or 13.6875 |
59,773,783 | How can I retrieve the `std::unique_ptr` pointer that has been moved into a function when that function runs on a separate thread?
Consider the following example:
```
using IntPtr = std::unique_ptr<int>;
IntPtr&& update(IntPtr &&fp_)
{
*fp_ = 23;
return std::move(fp_);
}
int main()
{
IntPtr foo_ptr = std::make_unique<int>(0);
foo_ptr = update(std::move(foo_ptr));
std::cout<< "data: " << *foo_ptr <<std::endl;
}
```
This is fine. `foo_ptr` is moved into `fp_` on the `update()` and then retrieved (moved back) to the `foo_ptr`.
How can I retrieve the `foo_ptr` if `update()` was running on a separate thread???
```
using IntPtr = std::unique_ptr<int>;
IntPtr&& update(IntPtr &&fp_)
{
*fp_ = 23;
return std::move(fp_);
}
int main()
{
IntPtr foo_ptr = std::make_unique<int>(0);
std::thread foo_thread(update,std::move(foo_ptr));
foo_thread.join();
std::cout<< "data: " << *foo_ptr <<std::endl; // SEGFAULT because foo_ptr is a nullptr.
}
```
Online code example: <https://rextester.com/MQDVU97718> | 2020/01/16 | [
"https://Stackoverflow.com/questions/59773783",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2754510/"
]
| You don't.
You gave ownership of the memory to another thread. That thread now owns that memory and will delete it when it terminates. It doesn't exist after `join`, and you never moved the pointer back to the main thread.
If you want a thread to fill in some data for another thread, then either you need to use shared ownership or the producing thread should not own the memory at all (ie: you pass a raw pointer).
Or just use a `packaged_task<int(int)>`, and you don't have to (directly) allocate memory at all:
```
int update(int value)
{
return 23;
}
int main()
{
int value = 0;
std::packaged_task<int(int)> task(update);
auto future_int = task.get_future();
std::thread foo_thread(std::move(task), value);
foo_thread.join();
std::cout<< "data: " << future_int.get() <<std::endl;
}
``` | The simplest way is to just use a wrapper function that writes the result back to `foo_ptr`:
```
std::thread foo_thread([&foo_ptr]() {
foo_ptr = update(std::move(foo_ptr));
});
foo_thread.join();
std::cout<< "data: " << *foo_ptr <<std::endl;
```
Note though that between the `std::thread` constructor call and the completion of the `join()` call, the main thread must not access `foo_ptr` in any way. Doing so would be a data race. Before the constructor and after `join` this is fine, as both of these calls serve as synchronization points, but any access in between would be unsynchronized and race with the write to `foo_ptr` inside the lambda.
If this sounds too dangerous, consider an approach where the thread puts the result into a `std::promise` and the main thread then retrieves the object from a corresponding `std::future`:
```
std::promise<IntPtr> p;
std::future<IntPtr> fut = p.get_future();
std::thread foo_thread([ptr = std::move(foo_ptr), p = std::move(p)]() mutable {
p.set_value(update(std::move(ptr)));
});
foo_ptr = std::move(fut.get());
``` |
73,835,838 | I came from C/C++, and used alot things like `#define OBJ_STATE_INPROCESS 2`, so that when coding actual logic you can have `state = OBJ_STATE_INPROCESS;`, and what it does become more obvious than `state = 2;`, which makes the code easier to maintain.
I wonder if there is some trick like this in C# | 2022/09/24 | [
"https://Stackoverflow.com/questions/73835838",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13233185/"
]
| Though technically a different concept, in C# you can use contants and enums to avoid "magic numbers", e.g.
```
public static class Constants
{
public const string MyConst = "ThisIsMyConst";
}
public enum MyEnum
{
MyEnumValue1,
MyEnumValue2,
}
// Usage
var value = MyEnum.MyEnumValue2;
``` | You can accomplish that using constant properties, for example:
```
static class Constants
{
public const int OBJ_STATE_INPROCESS = 2
}
class Program
{
static void Main()
{
Console.WriteLine(Constants.OBJ_STATE_INPROCESS ); //prints 2
}
}
``` |
64,478,671 | As announced in Webpacks 5.0 release blog post build still works in most browsers after a few minor adjustments in `webpack.config.js`.
But it stopped working in Internet Explorer (11) because the generated output is mixed `ES6` and `ES5` and therefore incompatible with IE (see image).

As it actually leads to no successful build using a variety of babel plugins I'm asking myself if theres an "easy" way to specify ES5 as the generated output.
From beta phase of `webpack-5` I found a flag on [Medium](https://medium.com/@JayKariesch/webpack-5-beta-babel-loader-why-do-i-still-have-arrow-functions-6a22980dcae4) which seems not working anymore.
```
module.exports = {
output: {
filename: [name].js,
ecmaVersion: 5 // <- this flag
}
}
```
Is there some "webpack built in way“ in version 5.x to have ES5 as output target? | 2020/10/22 | [
"https://Stackoverflow.com/questions/64478671",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1165289/"
]
| From the [webpack guide To v5 from v4](https://webpack.js.org/migrate/5/#turn-off-es2015-syntax-in-runtime-code-if-necessary), it says:
>
> By default, webpack's runtime code uses ES2015 syntax to build smaller bundles. If your build targets environments that don't support this syntax **(like IE11)**, you'll need to set `target: ['web', 'es5']` to revert to ES5 syntax (`'web'` if target environment is browser).
>
>
>
So you can try to set:
```
target: ['web', 'es5']
```
then it will convert code to ES5. | You could manually configure the features available in the webpack runtime with [`output.environment`](https://webpack.js.org/configuration/output/#outputenvironment).
However, [by default](https://webpack.js.org/configuration/target/#target) webpack 5 will honor any `browserslist` entries it finds and set the runtime to only use those features available in your target browsers. You can configure which browsers to target using any of the methods [here](https://webpack.js.org/configuration/target/#browserslist), but the easiest way is to specify a key in your `package.json`:
```
"browserslist": "ie 11"
``` |
9,771 | How can i generate the CBOR hex of a plutus smart contract. Does it requires to generate CBOR of onchain code only or both onchain and offchain?
Also if have a smart contract which requires parameters e.g. deadline. to run, then how will i be able to pass that argument with that cbor at the time of deployment of plutus smart contract.
Kindly suggest a recommended way for that and also how to interact efficiently with that CBPOR. | 2023/01/24 | [
"https://cardano.stackexchange.com/questions/9771",
"https://cardano.stackexchange.com",
"https://cardano.stackexchange.com/users/7952/"
]
| Basically, there are two ways:
1. After getting the transaction in the frontend, load the CBOR to CSL (cardano-serialization-lib), and proceed from there.
The workflow would be: build the transaction with cardano-cli, sign it with some random wallet stored in backend, send the signed transaction CBOR to frontend, deserialize the CBOR to CSL Transaction object, remove the witness you signed with in backend, call any wallet extension (eternl, nami..) injected signTx() method and get current user witness, add it to the CSL Transaction object and submit it with submitTx() wallet method.
This worked fine for me with Alonzo era and simple transactions, but had some problems with complicated (inline datums, plutusV2 scripts, etc.) Babbage era transactions. You kind of need to dig deep into CSL to make it work. So I chose the second, easier approach.
2. Build the transaction using cardano-cli, send it to the frontend in order to retrieve a witness, return both transaction CBOR and witness to backend, assemble the transaction and submit it.
In depth steps:
1. `cardano-cli transaction build-raw --babbage-era --cddl-format ...`
build instead of build-raw also works. Do not forget to add --cddl-format flag, in order for frontend sign() method to understand the format. Also you do not need to sign the transaction, only build it.
2. Send built transaction CBOR to frontend
3. `encodedTxVkeyWitnesses = await window.signTx(cbor, true)`
Call signTx() wallet method with received CBOR as a parameter. You will get the encdoded witness, which is basically a proof that user signed the transaction. The resulting hex string will look like this: `a10081825820cccfe2be401c85342497f6e1e4a241629790b0fb7f2af5f18441779d11f25b1f5840c38a93d63faac9335ecc2f24ead7ca2d46a6637f354ee707bb06eb8192af2fa6a676fb72f8772cd1c42b491ec6dfc798c76b61c55dc4eecab362e71ffab26305`
4. `await handleSubmit(cbor, encodedTxVkeyWitnesses)`
Call your backend from frontend, and pass the very same transaction CBOR you received from backend and recently acquired witness CBOR.
5. `$witnessCbor = substr($encodedTxVkeyWitnesses, strpos($encodedTxVkeyWitnesses,'825820'), (strlen($encodedTxVkeyWitnesses) - strpos($encodedTxVkeyWitnesses,'825820')));`
Note: example is in PHP. signTx() method returns a bit different witness structure than required by cardano-cli. You basically need to strip first 6 chars from the string. They represent data structure, in this case some nested arrays and stuff. You can look at structure differences here, by comparing both stripped and not stripped hex witness CBOR strings: <https://cbor.nemo157.com/>
6.
```
transactionCborFile = '
{
"type": "Unwitnessed Tx BabbageEra",
"description": "Ledger Cddl Format",
"cborHex": "<transaction CBOR here>"
}
';
$witnessCborFile = '
{
"type": "TxWitness BabbageEra",
"description": "Key Witness ShelleyEra",
"cborHex": "<stripped witness CBOR here>"
}
';
```
Create two files as described above containing transaction and witness CBOR, as cardano-cli assemble command require files as parameters.
7. `cardano-cli transaction assemble --tx-body-file <transaction_cbor_file_path> --witness-file <witness_cbor_file_path> --out-file tx.assembled`
Use cardano-cli assemble command to combine both transaction and witness CBOR in order to receive a signed transaction. At this point, transaction is signed and is ready to be submitted.
8. `cardano-cli transaction submit $MAGIC --tx-file tx.assembled`
That's it! | I have a different type of example that might be helpful to anyone looking for ways to sign (and build) transactions using both a browser wallet and a server side private key. Code is here <https://github.com/lley154/helios-examples/tree/main/nft-multisig>
And video <https://youtu.be/CSd9ev_XH5w> |
31,488,863 | I have a tab structure consisting of 5 tabs. All tabs are working fine. Now in my first tab, I have few header tags which are same as the other 4 tabs. So when clicking of each of them, I want to change the active tab and also the contents. My code is as below.
```html
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"/>
<ul class="nav nav-pills" id="myTab">
<li class="active"><a data-toggle="tab" href="#overview">Overview</a>
</li>
<li><a data-toggle="tab" href="#tab1">tab1</a>
</li>
<li><a data-toggle="tab" href="#tab2">tab2</a>
</li>
<li><a data-toggle="tab" href="#tab3">tab3</a>
</li>
<li><a data-toggle="tab" href="#tab4">tab4</a>
</li>
</ul>
<div class="tab-content">
<div id="overview" class="tab-pane fade in active">
<p>overview</p>
<br>
<a href="#tab1">
<h3>tab1 link</h3>
</a>
<br>
<a href="#tab2">
<h3>tab2 link</h3>
</a>
<br>
<a href="#tab3">
<h3>tab3 link</h3>
</a>
<br>
<a href="#tab4">
<h3>tab4 link</h3>
</a>
</div>
<div id="tab1" class="tab-pane fade">
<p>Vestibulum nec erat eu nulla rhoncus fringilla ut non neque. Vivamus nibh urna, ornare id gravida ut, mollis a magna. Aliquam porttitor condimentum nisi, eu viverra ipsum porta ut. Nam hendrerit bibendum turpis, sed molestie mi fermentum id. Aenean
volutpat velit sem. Sed consequat ante in rutrum convallis. Nunc facilisis leo at faucibus adipiscing.</p>
</div>
<div id="tab2" class="tab-pane fade">
<p>WInteger convallis, nulla in sollicitudin placerat, ligula enim auctor lectus, in mollis diam dolor at lorem. Sed bibendum nibh sit amet dictum feugiat. Vivamus arcu sem, cursus a feugiat ut, iaculis at erat. Donec vehicula at ligula vitae venenatis.
Sed nunc nulla, vehicula non porttitor in, pharetra et dolor. Fusce nec velit velit. Pellentesque consectetur eros.</p>
</div>
<div id="tab3" class="tab-pane fade">
<p>Donec vel placerat quam, ut euismod risus. Sed a mi suscipit, elementum sem a, hendrerit velit. Donec at erat magna. Sed dignissim orci nec eleifend egestas. Donec eget mi consequat massa vestibulum laoreet. Mauris et ultrices nulla, malesuada volutpat
ante. Fusce ut orci lorem. Donec molestie libero in tempus imperdiet. Cum sociis natoque penatibus et magnis dis parturient.</p>
</div>
<div id="tab4" class="tab-pane fade">
<p>Donec vel placerat quam, ut euismod risus. Sed a mi suscipit, elementum sem a, hendrerit velit. Donec at erat magna. Sed dignissim orci nec eleifend egestas. Donec eget mi consequat massa vestibulum laoreet. Mauris et ultrices nulla, malesuada volutpat
ante. Fusce ut orci lorem. Donec molestie libero in tempus imperdiet. Cum sociis natoque penatibus et magnis dis parturient.</p>
</div>
</div>
```
Any help soon will help. | 2015/07/18 | [
"https://Stackoverflow.com/questions/31488863",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3378718/"
]
| `lstrip` `iterates` over the result string until there is no more combination that matches the left most set of characters
A little illustration is below.
```
In [1]: "attr.title".lstrip('attr.')
Out[1]: 'itle' # Flow --> "attr." --> "t" --> Next char is 'i' which does not match any combination hence, iteration stops & end result ('itle') is returned
In [2]: "attr.tritle".lstrip('attr.')
Out[2]: 'itle' # "attr." --> "t" --> "r" --> Next char is 'i' which does not match any combination hence, iteration stops & end result ('itle') is returned
In [5]: "attr.itratitle".lstrip('attr.')
Out[5]: 'itratitle' # "attr." --> Next char is 'i' which does not match any combination hence, iteration stops & end result ('itratitle') is returned
``` | ```
"attr.title".lstrip('attr.')
```
means "remove every `a`, `t`, `t`, `r`, `.` from the left of the given string until no such character occurs.
Then it takes the given string and removes the `a`, the two `t`s, the `r`, the `.` and the `t`, as they all are contained in the given pattern.
At the `i` it stops as it is not contained in the pattern. |
49,867,651 | I have following code in concern:
```
module UserStatus
extend ActiveSupport::Concern
included do
enum status: %i[not_started in_progress completed]
end
end
```
I am trying to write an rspec test for it.
```
require 'rails_helper'
RSpec.describe 'user_status' do
it 'test' do
byebug
should define_enum_for(:status).with(%i[not_started in_progress completed])
end
end
```
The above case returns an error:
```
undefined method `defined_enums' for Module:Class
```
If I remove `should`, it passes. But I don't know if that's the right way to test it. Is there a better way? | 2018/04/16 | [
"https://Stackoverflow.com/questions/49867651",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/427354/"
]
| You've installed it as yourself, but your agent is running as the service account.
They won't have access to each other env variables, you can either install it using the service account, or at the start of the build job, update the path variables with the location of ng. e.g. step 1, script path=%path%;location of ng | This is command how to find executable path in windows
```
where.exe ng
```
**Output:**
```
C:\Users\*[UserName]*\AppData\Local\Yarn\bin\ng
C:\Users\*[UserName]*\AppData\Local\Yarn\bin\ng.cmd
``` |
36,936,305 | I recently switched from Mac local apache, mysql setup to Vagrant Laravel/Homestead server. When trying to run my app. it gives me the following error.
```
View [components.people.feed] not found.
```
My Feed Method:
```
return view('components.people.feed')->with('people', $people);
```
My View Directory
```
resources
-
views
-
components
-
people
-
feed.blade.php
```
My app works on our production server here at work. it returns no errors.
only when run on Homestead server.
Could it be a homestead problem? first time trying to work with it.
Thanx in advance. | 2016/04/29 | [
"https://Stackoverflow.com/questions/36936305",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
]
| You should be running a Linux shell or similar. Quotes are parts of shell syntax. So you need to escape them.
The way you escape a character in shell depends on the software. But most of them support escaping with a backslash, single quotes or double quotes, e.g.:
```none
php script.php \'string\' 'word1 word2 word3'
php script.php "word $shell_variable"
```
Read more about [quoting variables](http://tldp.org/LDP/abs/html/quotingvar.html) and [escaping](http://tldp.org/LDP/abs/html/escapingsection.html) | Execuse me !
I think you did not understant what I mean.
So I'll try to explain more.
The true syntaxe for commande line is
```
/usr/local/bin/php script1.php arg1 arg2 arg3
```
Such the arguments shall not contain " or '
the question is : How to treat in the script "script1.php" the " or ' so to correct them or eraise them.
thanks |
42,384,492 | I am getting errors and warnings while trying to bring up WSO2 API Manager 2.1.0 for the first time. [CentOS Linux release 7.3.1611 (Core)]. Excerpts are given below. I have already tried the suggestions at: [Failed to start wso2 API Manager v2.0.0 on centos 7.0](https://stackoverflow.com/questions/38948303/failed-to-start-wso2-api-manager-v2-0-0-on-centos-7-0)
```
$ ./wso2server.sh
JAVA_HOME environment variable is set to /usr/java/jdk1.8.0_60
CARBON_HOME environment variable is set to /home/devwso2/wso2am-2.1.0
Using Java memory options: -Xms256m -Xmx1024m
[2017-02-22 06:03:46,688] INFO - QpidBundleActivator Setting BundleContext in PluginManager
[2017-02-22 06:03:48,217] INFO - CarbonCoreActivator Starting WSO2 Carbon...
[2017-02-22 06:03:48,217] INFO - CarbonCoreActivator Operating System : Linux 3.10.0-514.6.1.el7.x86_64, amd64
[2017-02-22 06:03:48,218] INFO - CarbonCoreActivator Java Home : /usr/java/jdk1.8.0_60/jre
[2017-02-22 06:03:48,218] INFO - CarbonCoreActivator Java Version : 1.8.0_60
[2017-02-22 06:03:48,218] INFO - CarbonCoreActivator Java VM : Java HotSpot(TM) 64-Bit Server VM 25.60-b23,Oracle Corporation
[2017-02-22 06:03:48,218] INFO - CarbonCoreActivator Carbon Home : /home/devwso2/wso2am-2.1.0
[2017-02-22 06:03:48,218] INFO - CarbonCoreActivator Java Temp Dir : /home/devwso2/wso2am-2.1.0/tmp
[2017-02-22 06:03:48,218] INFO - CarbonCoreActivator User : devwso2, en-US, UTC
[2017-02-22 06:03:48,387] WARN - ValidationResultPrinter Swap Memory size (MB): 0 of the system is below the recommended minimum size :2047
[2017-02-22 06:03:48,389] WARN - ValidationResultPrinter Carbon is configured to use the default keystore (wso2carbon.jks). To maximize security when deploying to a production environment, configure a new keystore with a unique password in the production server profile.
.....................
[2017-02-22 06:04:46,407] ERROR - Main Exception during startup. Triggering shutdown
org.wso2.andes.kernel.AndesException: Unable to initialise application registry
at org.wso2.andes.server.Broker.startupImpl(Broker.java:308)
at org.wso2.andes.server.Broker.startup(Broker.java:110)
at org.wso2.andes.server.Main.startBroker(Main.java:217)
at org.wso2.andes.server.Main.execute(Main.java:206)
at org.wso2.andes.server.Main.<init>(Main.java:54)
at org.wso2.andes.server.Main.main(Main.java:47)
at org.wso2.carbon.andes.internal.QpidServiceComponent.startAndesBroker(QpidServiceComponent.java:420)
at org.wso2.carbon.andes.internal.QpidServiceComponent.activate(QpidServiceComponent.java:165)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.eclipse.equinox.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:260)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:146)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:345)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:620)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:197)
at org.eclipse.equinox.internal.ds.Resolver.getEligible(Resolver.java:343)
at org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:222)
at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:107)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:861)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:819)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:771)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:214)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:433)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:451)
at org.wso2.carbon.server.admin.internal.ServerAdminServiceComponent.activate(ServerAdminServiceComponent.java:106)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.eclipse.equinox.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:260)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:146)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:345)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:620)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:197)
at org.eclipse.equinox.internal.ds.Resolver.getEligible(Resolver.java:343)
at org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:222)
at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:107)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:861)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:819)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:771)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:214)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:433)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:451)
at org.wso2.carbon.core.init.CarbonServerManager.initializeCarbon(CarbonServerManager.java:514)
at org.wso2.carbon.core.init.CarbonServerManager.start(CarbonServerManager.java:219)
at org.wso2.carbon.core.internal.CarbonCoreServiceComponent.activate(CarbonCoreServiceComponent.java:94)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.eclipse.equinox.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:260)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:146)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:345)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:620)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:197)
at org.eclipse.equinox.internal.ds.Resolver.getEligible(Resolver.java:343)
at org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:222)
at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:107)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:861)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:819)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:771)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:214)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:433)
at org.eclipse.equinox.http.servlet.internal.Activator.registerHttpService(Activator.java:81)
at org.eclipse.equinox.http.servlet.internal.Activator.addProxyServlet(Activator.java:60)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.init(ProxyServlet.java:40)
at org.wso2.carbon.tomcat.ext.servlet.DelegationServlet.init(DelegationServlet.java:38)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1269)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1182)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1072)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5368)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5660)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1571)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1561)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.wso2.andes.transport.TransportException: Could not bind to /0.0.0.0:5672
at org.wso2.andes.transport.network.mina.MinaNetworkTransport.accept(MinaNetworkTransport.java:147)
at org.wso2.andes.server.Broker.startAMQPListener(Broker.java:201)
at org.wso2.andes.server.Broker.startupImpl(Broker.java:295)
... 89 more
Caused by: java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at org.apache.mina.transport.socket.nio.SocketAcceptor.registerNew(SocketAcceptor.java:363)
at org.apache.mina.transport.socket.nio.SocketAcceptor.access$800(SocketAcceptor.java:55)
at org.apache.mina.transport.socket.nio.SocketAcceptor$Worker.run(SocketAcceptor.java:222)
at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51)
... 1 more
[2017-02-22 06:04:46,415] INFO - ApplicationRegistry Shutting down ApplicationRegistry(org.wso2.andes.server.registry.ConfigurationFileApplicationRegistry@1524f58a)
[2017-02-22 06:04:46,415] INFO - ApplicationRegistry Shutting down ApplicationRegistry:org.wso2.andes.server.registry.ConfigurationFileApplicationRegistry@1524f58a
[2017-02-22 06:04:46,418] INFO - PrincipalDatabaseAuthenticationManager Unregistering UserManagementMBean
[2017-02-22 06:04:46,421] INFO - CarbonServerManager Shutdown hook triggered....
[2017-02-22 06:04:46,426] INFO - CarbonServerManager Gracefully shutting down WSO2 API Manager...
[2017-02-22 06:04:46,428] INFO - ServerManagement Starting to switch to maintenance mode...
[2017-02-22 06:04:46,429] INFO - ServerManagement Stopped all transport listeners
[2017-02-22 06:04:46,429] INFO - ServerManagement Waiting for request service completion...
[2017-02-22 06:04:46,435] INFO - ServerManagement All requests have been served.
[2017-02-22 06:04:46,435] INFO - ServerManagement Waiting for deployment completion...
[2017-02-22 06:04:46,491] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/api/am/admin/v0.11]
[2017-02-22 06:04:46,536] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/throttle/data/v1]
[2017-02-22 06:04:46,566] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/am/sample/calculator/v1]
[2017-02-22 06:04:46,627] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/shindig]
[2017-02-22 06:04:46,653] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/api/am/publisher/v0.11]
[2017-02-22 06:04:46,682] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/api/am/store/v0.11]
[2017-02-22 06:04:46,699] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/authenticationendpoint]
[2017-02-22 06:04:46,719] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/oauth2]
[2017-02-22 06:04:46,735] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/am/sample/pizzashack/v1]
[2017-02-22 06:04:46,756] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/client-registration/v0.11]
[2017-02-22 06:04:46,764] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/admin]
[2017-02-22 06:04:46,775] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/portal]
[2017-02-22 06:04:46,783] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/store]
[2017-02-22 06:04:46,791] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/publisher]
[2017-02-22 06:04:46,791] INFO - ServerManagement All deployment tasks have been completed.
[2017-02-22 06:04:46,791] INFO - ServerManagement Waiting for server task completion...
[2017-02-22 06:04:46,805] INFO - ServerManagement All server tasks have been completed.
[2017-02-22 06:04:46,805] INFO - CarbonServerManager Shutting down WSO2 API Manager...
[2017-02-22 06:04:46,811] INFO - CarbonServerManager Shutting down OSGi framework...
[2017-02-22 06:04:54,812] INFO - CarbonEventManagementService Starting polling event receivers
[2017-02-22 06:05:15,404] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:05:15,412] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:05:17,532] WARN - AppDeployerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.synapse.service.SynapseAppDeployerService,
[2017-02-22 06:05:17,545] WARN - StartupFinalizerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.service.CappDeploymentService,org.wso2.carbon.server.admin.common.IServerAdmin,org.wso2.carbon.throttling.agent.ThrottlingAgent,
[2017-02-22 06:05:30,413] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:05:30,418] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:05:44,927] WARN - SynapseAppDeployerDSComponent Waiting for required OSGi services: org.wso2.carbon.message.processor.service.MessageProcessorDeployerService,org.wso2.carbon.message.store.service.MessageStoreDeployerService,org.wso2.carbon.proxyadmin.service.ProxyDeployerService,
[2017-02-22 06:05:45,415] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:05:45,420] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:00,419] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:00,421] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:15,422] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:15,423] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:17,531] WARN - AppDeployerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.synapse.service.SynapseAppDeployerService,
[2017-02-22 06:06:17,546] WARN - StartupFinalizerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.service.CappDeploymentService,org.wso2.carbon.server.admin.common.IServerAdmin,org.wso2.carbon.throttling.agent.ThrottlingAgent,
[2017-02-22 06:06:30,425] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:30,426] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:44,926] WARN - SynapseAppDeployerDSComponent Waiting for required OSGi services: org.wso2.carbon.message.processor.service.MessageProcessorDeployerService,org.wso2.carbon.message.store.service.MessageStoreDeployerService,org.wso2.carbon.proxyadmin.service.ProxyDeployerService,
[2017-02-22 06:06:45,428] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:45,428] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:00,430] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:00,431] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:15,434] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:15,434] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:17,531] WARN - AppDeployerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.synapse.service.SynapseAppDeployerService,
[2017-02-22 06:07:17,545] WARN - StartupFinalizerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.service.CappDeploymentService,org.wso2.carbon.server.admin.common.IServerAdmin,org.wso2.carbon.throttling.agent.ThrottlingAgent,
[2017-02-22 06:07:30,438] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:30,438] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:36,930] INFO - SynapseTaskManager Shutting down the task manager
[2017-02-22 06:07:44,926] WARN - SynapseAppDeployerDSComponent Waiting for required OSGi services: org.wso2.carbon.message.processor.service.MessageProcessorDeployerService,org.wso2.carbon.message.store.service.MessageStoreDeployerService,org.wso2.carbon.proxyadmin.service.ProxyDeployerService,
[2017-02-22 06:07:45,440] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:45,442] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:00,444] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:00,445] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:15,452] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:15,452] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:17,531] WARN - AppDeployerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.synapse.service.SynapseAppDeployerService,
[2017-02-22 06:08:17,545] WARN - StartupFinalizerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.service.CappDeploymentService,org.wso2.carbon.server.admin.common.IServerAdmin,org.wso2.carbon.throttling.agent.ThrottlingAgent,
[2017-02-22 06:08:30,456] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:30,456] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:44,927] WARN - SynapseAppDeployerDSComponent Waiting for required OSGi services: org.wso2.carbon.message.processor.service.MessageProcessorDeployerService,org.wso2.carbon.message.store.service.MessageStoreDeployerService,org.wso2.carbon.proxyadmin.service.ProxyDeployerService,
[2017-02-22 06:08:45,458] ERROR - BlockingConditionRetriever Exception when retrieving Blocking Conditions from remote endpoint
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:668)
at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:522)
at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:401)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:178)
at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:144)
at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:131)
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:610)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:445)
at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:863)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:106)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57)
at org.wso2.carbon.apimgt.gateway.throttling.util.BlockingConditionRetriever.retrieveBlockConditionsData(BlockingConditionRetriever.java:79)
at org.wso2.carbon.apimgt.gateway.throttling.util.BlockingConditionRetriever.loadBlockingConditionsFromWebService(BlockingConditionRetriever.java:105)
at org.wso2.carbon.apimgt.gateway.throttling.util.BlockingConditionRetriever.run(BlockingConditionRetriever.java:51)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
[2017-02-22 06:08:45,458] ERROR - KeyTemplateRetriever Exception when retrieving throttling data from remote endpoint
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:668)
at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:522)
at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:401)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:178)
at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:144)
at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:131)
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:610)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:445)
at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:863)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:106)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57)
at org.wso2.carbon.apimgt.gateway.throttling.util.KeyTemplateRetriever.retrieveKeyTemplateData(KeyTemplateRetriever.java:83)
at org.wso2.carbon.apimgt.gateway.throttling.util.KeyTemplateRetriever.loadKeyTemplatesFromWebService(KeyTemplateRetriever.java:111)
at org.wso2.carbon.apimgt.gateway.throttling.util.KeyTemplateRetriever.run(KeyTemplateRetriever.java:54)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
Exception in thread "Timer-5" java.lang.NullPointerException
at java.util.Objects.requireNonNull(Objects.java:203)
at java.util.Arrays$ArrayList.<init>(Arrays.java:3813)
at java.util.Arrays.asList(Arrays.java:3800)
at org.wso2.carbon.apimgt.gateway.throttling.util.KeyTemplateRetriever.loadKeyTemplatesFromWebService(KeyTemplateRetriever.java:111)
at org.wso2.carbon.apimgt.gateway.throttling.util.KeyTemplateRetriever.run(KeyTemplateRetriever.java:54)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
[2017-02-22 06:09:16,963] INFO - BinaryDataReceiverServiceComponent Binary Data Receiver server shutting down...
[2017-02-22 06:09:16,964] INFO - BinaryDataReceiver Stopping Binary Server..
[2017-02-22 06:09:17,531] WARN - AppDeployerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.synapse.service.SynapseAppDeployerService
``` | 2017/02/22 | [
"https://Stackoverflow.com/questions/42384492",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7602984/"
]
| I was running Java 17 SDK and got this same problem. Solved this by running the WSO2 script with Java 11 SDK instead.
You can either :
1. Change your JAVA\_HOME variable value
2. Create a new environment variable pointing to Java 11 SDK and replace recursively inside the WSO2 directory JAVA\_HOME with the new environment variable you have created | This is because port 5672 is occupied at the time when the API Manager server starts up. You can have 2 options I can think of to proceed with,
1. Change the default port offset.
* You can either start the API manager server with -DportOffset=[offset] (ex- -DportOffset=1) or change the value in /repository/conf to a value other than 0 and start the server.
2. Stop the existing process of already occupied server
* Without worrying about port offset, you can run the API Manager server on 5672 port for AMQP transport.
* Search the process of occupied port (5672 in this case)
>
> netstat -nlp|grep 5672
>
>
>
Output should looks like something below
>
> tcp 0 0 0.0.0.0:5672 0.0.0.0:\* LISTEN 6187/java
>
>
>
* Kill the process
>
> kill -9 [Process\_ID]
>
>
>
(here, 6187)
Then start the server and you won't see the exception anymore. |
42,384,492 | I am getting errors and warnings while trying to bring up WSO2 API Manager 2.1.0 for the first time. [CentOS Linux release 7.3.1611 (Core)]. Excerpts are given below. I have already tried the suggestions at: [Failed to start wso2 API Manager v2.0.0 on centos 7.0](https://stackoverflow.com/questions/38948303/failed-to-start-wso2-api-manager-v2-0-0-on-centos-7-0)
```
$ ./wso2server.sh
JAVA_HOME environment variable is set to /usr/java/jdk1.8.0_60
CARBON_HOME environment variable is set to /home/devwso2/wso2am-2.1.0
Using Java memory options: -Xms256m -Xmx1024m
[2017-02-22 06:03:46,688] INFO - QpidBundleActivator Setting BundleContext in PluginManager
[2017-02-22 06:03:48,217] INFO - CarbonCoreActivator Starting WSO2 Carbon...
[2017-02-22 06:03:48,217] INFO - CarbonCoreActivator Operating System : Linux 3.10.0-514.6.1.el7.x86_64, amd64
[2017-02-22 06:03:48,218] INFO - CarbonCoreActivator Java Home : /usr/java/jdk1.8.0_60/jre
[2017-02-22 06:03:48,218] INFO - CarbonCoreActivator Java Version : 1.8.0_60
[2017-02-22 06:03:48,218] INFO - CarbonCoreActivator Java VM : Java HotSpot(TM) 64-Bit Server VM 25.60-b23,Oracle Corporation
[2017-02-22 06:03:48,218] INFO - CarbonCoreActivator Carbon Home : /home/devwso2/wso2am-2.1.0
[2017-02-22 06:03:48,218] INFO - CarbonCoreActivator Java Temp Dir : /home/devwso2/wso2am-2.1.0/tmp
[2017-02-22 06:03:48,218] INFO - CarbonCoreActivator User : devwso2, en-US, UTC
[2017-02-22 06:03:48,387] WARN - ValidationResultPrinter Swap Memory size (MB): 0 of the system is below the recommended minimum size :2047
[2017-02-22 06:03:48,389] WARN - ValidationResultPrinter Carbon is configured to use the default keystore (wso2carbon.jks). To maximize security when deploying to a production environment, configure a new keystore with a unique password in the production server profile.
.....................
[2017-02-22 06:04:46,407] ERROR - Main Exception during startup. Triggering shutdown
org.wso2.andes.kernel.AndesException: Unable to initialise application registry
at org.wso2.andes.server.Broker.startupImpl(Broker.java:308)
at org.wso2.andes.server.Broker.startup(Broker.java:110)
at org.wso2.andes.server.Main.startBroker(Main.java:217)
at org.wso2.andes.server.Main.execute(Main.java:206)
at org.wso2.andes.server.Main.<init>(Main.java:54)
at org.wso2.andes.server.Main.main(Main.java:47)
at org.wso2.carbon.andes.internal.QpidServiceComponent.startAndesBroker(QpidServiceComponent.java:420)
at org.wso2.carbon.andes.internal.QpidServiceComponent.activate(QpidServiceComponent.java:165)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.eclipse.equinox.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:260)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:146)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:345)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:620)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:197)
at org.eclipse.equinox.internal.ds.Resolver.getEligible(Resolver.java:343)
at org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:222)
at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:107)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:861)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:819)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:771)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:214)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:433)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:451)
at org.wso2.carbon.server.admin.internal.ServerAdminServiceComponent.activate(ServerAdminServiceComponent.java:106)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.eclipse.equinox.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:260)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:146)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:345)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:620)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:197)
at org.eclipse.equinox.internal.ds.Resolver.getEligible(Resolver.java:343)
at org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:222)
at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:107)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:861)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:819)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:771)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:214)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:433)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:451)
at org.wso2.carbon.core.init.CarbonServerManager.initializeCarbon(CarbonServerManager.java:514)
at org.wso2.carbon.core.init.CarbonServerManager.start(CarbonServerManager.java:219)
at org.wso2.carbon.core.internal.CarbonCoreServiceComponent.activate(CarbonCoreServiceComponent.java:94)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.eclipse.equinox.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:260)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:146)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:345)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:620)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:197)
at org.eclipse.equinox.internal.ds.Resolver.getEligible(Resolver.java:343)
at org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:222)
at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:107)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:861)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:819)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:771)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:214)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:433)
at org.eclipse.equinox.http.servlet.internal.Activator.registerHttpService(Activator.java:81)
at org.eclipse.equinox.http.servlet.internal.Activator.addProxyServlet(Activator.java:60)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.init(ProxyServlet.java:40)
at org.wso2.carbon.tomcat.ext.servlet.DelegationServlet.init(DelegationServlet.java:38)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1269)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1182)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1072)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5368)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5660)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1571)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1561)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.wso2.andes.transport.TransportException: Could not bind to /0.0.0.0:5672
at org.wso2.andes.transport.network.mina.MinaNetworkTransport.accept(MinaNetworkTransport.java:147)
at org.wso2.andes.server.Broker.startAMQPListener(Broker.java:201)
at org.wso2.andes.server.Broker.startupImpl(Broker.java:295)
... 89 more
Caused by: java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at org.apache.mina.transport.socket.nio.SocketAcceptor.registerNew(SocketAcceptor.java:363)
at org.apache.mina.transport.socket.nio.SocketAcceptor.access$800(SocketAcceptor.java:55)
at org.apache.mina.transport.socket.nio.SocketAcceptor$Worker.run(SocketAcceptor.java:222)
at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51)
... 1 more
[2017-02-22 06:04:46,415] INFO - ApplicationRegistry Shutting down ApplicationRegistry(org.wso2.andes.server.registry.ConfigurationFileApplicationRegistry@1524f58a)
[2017-02-22 06:04:46,415] INFO - ApplicationRegistry Shutting down ApplicationRegistry:org.wso2.andes.server.registry.ConfigurationFileApplicationRegistry@1524f58a
[2017-02-22 06:04:46,418] INFO - PrincipalDatabaseAuthenticationManager Unregistering UserManagementMBean
[2017-02-22 06:04:46,421] INFO - CarbonServerManager Shutdown hook triggered....
[2017-02-22 06:04:46,426] INFO - CarbonServerManager Gracefully shutting down WSO2 API Manager...
[2017-02-22 06:04:46,428] INFO - ServerManagement Starting to switch to maintenance mode...
[2017-02-22 06:04:46,429] INFO - ServerManagement Stopped all transport listeners
[2017-02-22 06:04:46,429] INFO - ServerManagement Waiting for request service completion...
[2017-02-22 06:04:46,435] INFO - ServerManagement All requests have been served.
[2017-02-22 06:04:46,435] INFO - ServerManagement Waiting for deployment completion...
[2017-02-22 06:04:46,491] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/api/am/admin/v0.11]
[2017-02-22 06:04:46,536] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/throttle/data/v1]
[2017-02-22 06:04:46,566] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/am/sample/calculator/v1]
[2017-02-22 06:04:46,627] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/shindig]
[2017-02-22 06:04:46,653] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/api/am/publisher/v0.11]
[2017-02-22 06:04:46,682] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/api/am/store/v0.11]
[2017-02-22 06:04:46,699] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/authenticationendpoint]
[2017-02-22 06:04:46,719] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/oauth2]
[2017-02-22 06:04:46,735] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/am/sample/pizzashack/v1]
[2017-02-22 06:04:46,756] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/client-registration/v0.11]
[2017-02-22 06:04:46,764] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/admin]
[2017-02-22 06:04:46,775] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/portal]
[2017-02-22 06:04:46,783] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/store]
[2017-02-22 06:04:46,791] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/publisher]
[2017-02-22 06:04:46,791] INFO - ServerManagement All deployment tasks have been completed.
[2017-02-22 06:04:46,791] INFO - ServerManagement Waiting for server task completion...
[2017-02-22 06:04:46,805] INFO - ServerManagement All server tasks have been completed.
[2017-02-22 06:04:46,805] INFO - CarbonServerManager Shutting down WSO2 API Manager...
[2017-02-22 06:04:46,811] INFO - CarbonServerManager Shutting down OSGi framework...
[2017-02-22 06:04:54,812] INFO - CarbonEventManagementService Starting polling event receivers
[2017-02-22 06:05:15,404] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:05:15,412] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:05:17,532] WARN - AppDeployerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.synapse.service.SynapseAppDeployerService,
[2017-02-22 06:05:17,545] WARN - StartupFinalizerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.service.CappDeploymentService,org.wso2.carbon.server.admin.common.IServerAdmin,org.wso2.carbon.throttling.agent.ThrottlingAgent,
[2017-02-22 06:05:30,413] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:05:30,418] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:05:44,927] WARN - SynapseAppDeployerDSComponent Waiting for required OSGi services: org.wso2.carbon.message.processor.service.MessageProcessorDeployerService,org.wso2.carbon.message.store.service.MessageStoreDeployerService,org.wso2.carbon.proxyadmin.service.ProxyDeployerService,
[2017-02-22 06:05:45,415] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:05:45,420] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:00,419] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:00,421] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:15,422] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:15,423] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:17,531] WARN - AppDeployerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.synapse.service.SynapseAppDeployerService,
[2017-02-22 06:06:17,546] WARN - StartupFinalizerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.service.CappDeploymentService,org.wso2.carbon.server.admin.common.IServerAdmin,org.wso2.carbon.throttling.agent.ThrottlingAgent,
[2017-02-22 06:06:30,425] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:30,426] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:44,926] WARN - SynapseAppDeployerDSComponent Waiting for required OSGi services: org.wso2.carbon.message.processor.service.MessageProcessorDeployerService,org.wso2.carbon.message.store.service.MessageStoreDeployerService,org.wso2.carbon.proxyadmin.service.ProxyDeployerService,
[2017-02-22 06:06:45,428] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:45,428] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:00,430] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:00,431] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:15,434] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:15,434] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:17,531] WARN - AppDeployerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.synapse.service.SynapseAppDeployerService,
[2017-02-22 06:07:17,545] WARN - StartupFinalizerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.service.CappDeploymentService,org.wso2.carbon.server.admin.common.IServerAdmin,org.wso2.carbon.throttling.agent.ThrottlingAgent,
[2017-02-22 06:07:30,438] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:30,438] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:36,930] INFO - SynapseTaskManager Shutting down the task manager
[2017-02-22 06:07:44,926] WARN - SynapseAppDeployerDSComponent Waiting for required OSGi services: org.wso2.carbon.message.processor.service.MessageProcessorDeployerService,org.wso2.carbon.message.store.service.MessageStoreDeployerService,org.wso2.carbon.proxyadmin.service.ProxyDeployerService,
[2017-02-22 06:07:45,440] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:45,442] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:00,444] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:00,445] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:15,452] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:15,452] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:17,531] WARN - AppDeployerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.synapse.service.SynapseAppDeployerService,
[2017-02-22 06:08:17,545] WARN - StartupFinalizerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.service.CappDeploymentService,org.wso2.carbon.server.admin.common.IServerAdmin,org.wso2.carbon.throttling.agent.ThrottlingAgent,
[2017-02-22 06:08:30,456] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:30,456] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:44,927] WARN - SynapseAppDeployerDSComponent Waiting for required OSGi services: org.wso2.carbon.message.processor.service.MessageProcessorDeployerService,org.wso2.carbon.message.store.service.MessageStoreDeployerService,org.wso2.carbon.proxyadmin.service.ProxyDeployerService,
[2017-02-22 06:08:45,458] ERROR - BlockingConditionRetriever Exception when retrieving Blocking Conditions from remote endpoint
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:668)
at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:522)
at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:401)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:178)
at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:144)
at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:131)
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:610)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:445)
at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:863)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:106)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57)
at org.wso2.carbon.apimgt.gateway.throttling.util.BlockingConditionRetriever.retrieveBlockConditionsData(BlockingConditionRetriever.java:79)
at org.wso2.carbon.apimgt.gateway.throttling.util.BlockingConditionRetriever.loadBlockingConditionsFromWebService(BlockingConditionRetriever.java:105)
at org.wso2.carbon.apimgt.gateway.throttling.util.BlockingConditionRetriever.run(BlockingConditionRetriever.java:51)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
[2017-02-22 06:08:45,458] ERROR - KeyTemplateRetriever Exception when retrieving throttling data from remote endpoint
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:668)
at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:522)
at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:401)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:178)
at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:144)
at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:131)
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:610)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:445)
at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:863)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:106)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57)
at org.wso2.carbon.apimgt.gateway.throttling.util.KeyTemplateRetriever.retrieveKeyTemplateData(KeyTemplateRetriever.java:83)
at org.wso2.carbon.apimgt.gateway.throttling.util.KeyTemplateRetriever.loadKeyTemplatesFromWebService(KeyTemplateRetriever.java:111)
at org.wso2.carbon.apimgt.gateway.throttling.util.KeyTemplateRetriever.run(KeyTemplateRetriever.java:54)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
Exception in thread "Timer-5" java.lang.NullPointerException
at java.util.Objects.requireNonNull(Objects.java:203)
at java.util.Arrays$ArrayList.<init>(Arrays.java:3813)
at java.util.Arrays.asList(Arrays.java:3800)
at org.wso2.carbon.apimgt.gateway.throttling.util.KeyTemplateRetriever.loadKeyTemplatesFromWebService(KeyTemplateRetriever.java:111)
at org.wso2.carbon.apimgt.gateway.throttling.util.KeyTemplateRetriever.run(KeyTemplateRetriever.java:54)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
[2017-02-22 06:09:16,963] INFO - BinaryDataReceiverServiceComponent Binary Data Receiver server shutting down...
[2017-02-22 06:09:16,964] INFO - BinaryDataReceiver Stopping Binary Server..
[2017-02-22 06:09:17,531] WARN - AppDeployerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.synapse.service.SynapseAppDeployerService
``` | 2017/02/22 | [
"https://Stackoverflow.com/questions/42384492",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7602984/"
]
| I was running Java 17 SDK and got this same problem. Solved this by running the WSO2 script with Java 11 SDK instead.
You can either :
1. Change your JAVA\_HOME variable value
2. Create a new environment variable pointing to Java 11 SDK and replace recursively inside the WSO2 directory JAVA\_HOME with the new environment variable you have created | There's a problem with your port 5672,this port is already in use by some other process. So shutdown your wso2 process by ps -ef|grep wso2 and then kill -9 .
Then change your port by following this link and start wso2 api manager again.
<https://docs.wso2.com/display/AM200/Changing+the+Default+Ports+with+Offset> |
42,384,492 | I am getting errors and warnings while trying to bring up WSO2 API Manager 2.1.0 for the first time. [CentOS Linux release 7.3.1611 (Core)]. Excerpts are given below. I have already tried the suggestions at: [Failed to start wso2 API Manager v2.0.0 on centos 7.0](https://stackoverflow.com/questions/38948303/failed-to-start-wso2-api-manager-v2-0-0-on-centos-7-0)
```
$ ./wso2server.sh
JAVA_HOME environment variable is set to /usr/java/jdk1.8.0_60
CARBON_HOME environment variable is set to /home/devwso2/wso2am-2.1.0
Using Java memory options: -Xms256m -Xmx1024m
[2017-02-22 06:03:46,688] INFO - QpidBundleActivator Setting BundleContext in PluginManager
[2017-02-22 06:03:48,217] INFO - CarbonCoreActivator Starting WSO2 Carbon...
[2017-02-22 06:03:48,217] INFO - CarbonCoreActivator Operating System : Linux 3.10.0-514.6.1.el7.x86_64, amd64
[2017-02-22 06:03:48,218] INFO - CarbonCoreActivator Java Home : /usr/java/jdk1.8.0_60/jre
[2017-02-22 06:03:48,218] INFO - CarbonCoreActivator Java Version : 1.8.0_60
[2017-02-22 06:03:48,218] INFO - CarbonCoreActivator Java VM : Java HotSpot(TM) 64-Bit Server VM 25.60-b23,Oracle Corporation
[2017-02-22 06:03:48,218] INFO - CarbonCoreActivator Carbon Home : /home/devwso2/wso2am-2.1.0
[2017-02-22 06:03:48,218] INFO - CarbonCoreActivator Java Temp Dir : /home/devwso2/wso2am-2.1.0/tmp
[2017-02-22 06:03:48,218] INFO - CarbonCoreActivator User : devwso2, en-US, UTC
[2017-02-22 06:03:48,387] WARN - ValidationResultPrinter Swap Memory size (MB): 0 of the system is below the recommended minimum size :2047
[2017-02-22 06:03:48,389] WARN - ValidationResultPrinter Carbon is configured to use the default keystore (wso2carbon.jks). To maximize security when deploying to a production environment, configure a new keystore with a unique password in the production server profile.
.....................
[2017-02-22 06:04:46,407] ERROR - Main Exception during startup. Triggering shutdown
org.wso2.andes.kernel.AndesException: Unable to initialise application registry
at org.wso2.andes.server.Broker.startupImpl(Broker.java:308)
at org.wso2.andes.server.Broker.startup(Broker.java:110)
at org.wso2.andes.server.Main.startBroker(Main.java:217)
at org.wso2.andes.server.Main.execute(Main.java:206)
at org.wso2.andes.server.Main.<init>(Main.java:54)
at org.wso2.andes.server.Main.main(Main.java:47)
at org.wso2.carbon.andes.internal.QpidServiceComponent.startAndesBroker(QpidServiceComponent.java:420)
at org.wso2.carbon.andes.internal.QpidServiceComponent.activate(QpidServiceComponent.java:165)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.eclipse.equinox.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:260)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:146)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:345)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:620)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:197)
at org.eclipse.equinox.internal.ds.Resolver.getEligible(Resolver.java:343)
at org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:222)
at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:107)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:861)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:819)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:771)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:214)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:433)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:451)
at org.wso2.carbon.server.admin.internal.ServerAdminServiceComponent.activate(ServerAdminServiceComponent.java:106)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.eclipse.equinox.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:260)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:146)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:345)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:620)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:197)
at org.eclipse.equinox.internal.ds.Resolver.getEligible(Resolver.java:343)
at org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:222)
at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:107)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:861)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:819)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:771)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:214)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:433)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:451)
at org.wso2.carbon.core.init.CarbonServerManager.initializeCarbon(CarbonServerManager.java:514)
at org.wso2.carbon.core.init.CarbonServerManager.start(CarbonServerManager.java:219)
at org.wso2.carbon.core.internal.CarbonCoreServiceComponent.activate(CarbonCoreServiceComponent.java:94)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.eclipse.equinox.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:260)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:146)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:345)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:620)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:197)
at org.eclipse.equinox.internal.ds.Resolver.getEligible(Resolver.java:343)
at org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:222)
at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:107)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:861)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:819)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:771)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:214)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:433)
at org.eclipse.equinox.http.servlet.internal.Activator.registerHttpService(Activator.java:81)
at org.eclipse.equinox.http.servlet.internal.Activator.addProxyServlet(Activator.java:60)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.init(ProxyServlet.java:40)
at org.wso2.carbon.tomcat.ext.servlet.DelegationServlet.init(DelegationServlet.java:38)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1269)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1182)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1072)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5368)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5660)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1571)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1561)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.wso2.andes.transport.TransportException: Could not bind to /0.0.0.0:5672
at org.wso2.andes.transport.network.mina.MinaNetworkTransport.accept(MinaNetworkTransport.java:147)
at org.wso2.andes.server.Broker.startAMQPListener(Broker.java:201)
at org.wso2.andes.server.Broker.startupImpl(Broker.java:295)
... 89 more
Caused by: java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at org.apache.mina.transport.socket.nio.SocketAcceptor.registerNew(SocketAcceptor.java:363)
at org.apache.mina.transport.socket.nio.SocketAcceptor.access$800(SocketAcceptor.java:55)
at org.apache.mina.transport.socket.nio.SocketAcceptor$Worker.run(SocketAcceptor.java:222)
at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51)
... 1 more
[2017-02-22 06:04:46,415] INFO - ApplicationRegistry Shutting down ApplicationRegistry(org.wso2.andes.server.registry.ConfigurationFileApplicationRegistry@1524f58a)
[2017-02-22 06:04:46,415] INFO - ApplicationRegistry Shutting down ApplicationRegistry:org.wso2.andes.server.registry.ConfigurationFileApplicationRegistry@1524f58a
[2017-02-22 06:04:46,418] INFO - PrincipalDatabaseAuthenticationManager Unregistering UserManagementMBean
[2017-02-22 06:04:46,421] INFO - CarbonServerManager Shutdown hook triggered....
[2017-02-22 06:04:46,426] INFO - CarbonServerManager Gracefully shutting down WSO2 API Manager...
[2017-02-22 06:04:46,428] INFO - ServerManagement Starting to switch to maintenance mode...
[2017-02-22 06:04:46,429] INFO - ServerManagement Stopped all transport listeners
[2017-02-22 06:04:46,429] INFO - ServerManagement Waiting for request service completion...
[2017-02-22 06:04:46,435] INFO - ServerManagement All requests have been served.
[2017-02-22 06:04:46,435] INFO - ServerManagement Waiting for deployment completion...
[2017-02-22 06:04:46,491] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/api/am/admin/v0.11]
[2017-02-22 06:04:46,536] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/throttle/data/v1]
[2017-02-22 06:04:46,566] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/am/sample/calculator/v1]
[2017-02-22 06:04:46,627] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/shindig]
[2017-02-22 06:04:46,653] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/api/am/publisher/v0.11]
[2017-02-22 06:04:46,682] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/api/am/store/v0.11]
[2017-02-22 06:04:46,699] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/authenticationendpoint]
[2017-02-22 06:04:46,719] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/oauth2]
[2017-02-22 06:04:46,735] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/am/sample/pizzashack/v1]
[2017-02-22 06:04:46,756] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/client-registration/v0.11]
[2017-02-22 06:04:46,764] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/admin]
[2017-02-22 06:04:46,775] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/portal]
[2017-02-22 06:04:46,783] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/store]
[2017-02-22 06:04:46,791] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/publisher]
[2017-02-22 06:04:46,791] INFO - ServerManagement All deployment tasks have been completed.
[2017-02-22 06:04:46,791] INFO - ServerManagement Waiting for server task completion...
[2017-02-22 06:04:46,805] INFO - ServerManagement All server tasks have been completed.
[2017-02-22 06:04:46,805] INFO - CarbonServerManager Shutting down WSO2 API Manager...
[2017-02-22 06:04:46,811] INFO - CarbonServerManager Shutting down OSGi framework...
[2017-02-22 06:04:54,812] INFO - CarbonEventManagementService Starting polling event receivers
[2017-02-22 06:05:15,404] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:05:15,412] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:05:17,532] WARN - AppDeployerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.synapse.service.SynapseAppDeployerService,
[2017-02-22 06:05:17,545] WARN - StartupFinalizerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.service.CappDeploymentService,org.wso2.carbon.server.admin.common.IServerAdmin,org.wso2.carbon.throttling.agent.ThrottlingAgent,
[2017-02-22 06:05:30,413] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:05:30,418] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:05:44,927] WARN - SynapseAppDeployerDSComponent Waiting for required OSGi services: org.wso2.carbon.message.processor.service.MessageProcessorDeployerService,org.wso2.carbon.message.store.service.MessageStoreDeployerService,org.wso2.carbon.proxyadmin.service.ProxyDeployerService,
[2017-02-22 06:05:45,415] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:05:45,420] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:00,419] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:00,421] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:15,422] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:15,423] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:17,531] WARN - AppDeployerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.synapse.service.SynapseAppDeployerService,
[2017-02-22 06:06:17,546] WARN - StartupFinalizerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.service.CappDeploymentService,org.wso2.carbon.server.admin.common.IServerAdmin,org.wso2.carbon.throttling.agent.ThrottlingAgent,
[2017-02-22 06:06:30,425] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:30,426] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:44,926] WARN - SynapseAppDeployerDSComponent Waiting for required OSGi services: org.wso2.carbon.message.processor.service.MessageProcessorDeployerService,org.wso2.carbon.message.store.service.MessageStoreDeployerService,org.wso2.carbon.proxyadmin.service.ProxyDeployerService,
[2017-02-22 06:06:45,428] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:45,428] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:00,430] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:00,431] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:15,434] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:15,434] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:17,531] WARN - AppDeployerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.synapse.service.SynapseAppDeployerService,
[2017-02-22 06:07:17,545] WARN - StartupFinalizerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.service.CappDeploymentService,org.wso2.carbon.server.admin.common.IServerAdmin,org.wso2.carbon.throttling.agent.ThrottlingAgent,
[2017-02-22 06:07:30,438] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:30,438] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:36,930] INFO - SynapseTaskManager Shutting down the task manager
[2017-02-22 06:07:44,926] WARN - SynapseAppDeployerDSComponent Waiting for required OSGi services: org.wso2.carbon.message.processor.service.MessageProcessorDeployerService,org.wso2.carbon.message.store.service.MessageStoreDeployerService,org.wso2.carbon.proxyadmin.service.ProxyDeployerService,
[2017-02-22 06:07:45,440] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:45,442] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:00,444] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:00,445] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:15,452] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:15,452] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:17,531] WARN - AppDeployerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.synapse.service.SynapseAppDeployerService,
[2017-02-22 06:08:17,545] WARN - StartupFinalizerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.service.CappDeploymentService,org.wso2.carbon.server.admin.common.IServerAdmin,org.wso2.carbon.throttling.agent.ThrottlingAgent,
[2017-02-22 06:08:30,456] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:30,456] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:44,927] WARN - SynapseAppDeployerDSComponent Waiting for required OSGi services: org.wso2.carbon.message.processor.service.MessageProcessorDeployerService,org.wso2.carbon.message.store.service.MessageStoreDeployerService,org.wso2.carbon.proxyadmin.service.ProxyDeployerService,
[2017-02-22 06:08:45,458] ERROR - BlockingConditionRetriever Exception when retrieving Blocking Conditions from remote endpoint
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:668)
at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:522)
at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:401)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:178)
at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:144)
at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:131)
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:610)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:445)
at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:863)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:106)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57)
at org.wso2.carbon.apimgt.gateway.throttling.util.BlockingConditionRetriever.retrieveBlockConditionsData(BlockingConditionRetriever.java:79)
at org.wso2.carbon.apimgt.gateway.throttling.util.BlockingConditionRetriever.loadBlockingConditionsFromWebService(BlockingConditionRetriever.java:105)
at org.wso2.carbon.apimgt.gateway.throttling.util.BlockingConditionRetriever.run(BlockingConditionRetriever.java:51)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
[2017-02-22 06:08:45,458] ERROR - KeyTemplateRetriever Exception when retrieving throttling data from remote endpoint
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:668)
at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:522)
at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:401)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:178)
at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:144)
at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:131)
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:610)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:445)
at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:863)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:106)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57)
at org.wso2.carbon.apimgt.gateway.throttling.util.KeyTemplateRetriever.retrieveKeyTemplateData(KeyTemplateRetriever.java:83)
at org.wso2.carbon.apimgt.gateway.throttling.util.KeyTemplateRetriever.loadKeyTemplatesFromWebService(KeyTemplateRetriever.java:111)
at org.wso2.carbon.apimgt.gateway.throttling.util.KeyTemplateRetriever.run(KeyTemplateRetriever.java:54)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
Exception in thread "Timer-5" java.lang.NullPointerException
at java.util.Objects.requireNonNull(Objects.java:203)
at java.util.Arrays$ArrayList.<init>(Arrays.java:3813)
at java.util.Arrays.asList(Arrays.java:3800)
at org.wso2.carbon.apimgt.gateway.throttling.util.KeyTemplateRetriever.loadKeyTemplatesFromWebService(KeyTemplateRetriever.java:111)
at org.wso2.carbon.apimgt.gateway.throttling.util.KeyTemplateRetriever.run(KeyTemplateRetriever.java:54)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
[2017-02-22 06:09:16,963] INFO - BinaryDataReceiverServiceComponent Binary Data Receiver server shutting down...
[2017-02-22 06:09:16,964] INFO - BinaryDataReceiver Stopping Binary Server..
[2017-02-22 06:09:17,531] WARN - AppDeployerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.synapse.service.SynapseAppDeployerService
``` | 2017/02/22 | [
"https://Stackoverflow.com/questions/42384492",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7602984/"
]
| This is because port 5672 is occupied at the time when the API Manager server starts up. You can have 2 options I can think of to proceed with,
1. Change the default port offset.
* You can either start the API manager server with -DportOffset=[offset] (ex- -DportOffset=1) or change the value in /repository/conf to a value other than 0 and start the server.
2. Stop the existing process of already occupied server
* Without worrying about port offset, you can run the API Manager server on 5672 port for AMQP transport.
* Search the process of occupied port (5672 in this case)
>
> netstat -nlp|grep 5672
>
>
>
Output should looks like something below
>
> tcp 0 0 0.0.0.0:5672 0.0.0.0:\* LISTEN 6187/java
>
>
>
* Kill the process
>
> kill -9 [Process\_ID]
>
>
>
(here, 6187)
Then start the server and you won't see the exception anymore. | There's a problem with your port 5672,this port is already in use by some other process. So shutdown your wso2 process by ps -ef|grep wso2 and then kill -9 .
Then change your port by following this link and start wso2 api manager again.
<https://docs.wso2.com/display/AM200/Changing+the+Default+Ports+with+Offset> |
42,384,492 | I am getting errors and warnings while trying to bring up WSO2 API Manager 2.1.0 for the first time. [CentOS Linux release 7.3.1611 (Core)]. Excerpts are given below. I have already tried the suggestions at: [Failed to start wso2 API Manager v2.0.0 on centos 7.0](https://stackoverflow.com/questions/38948303/failed-to-start-wso2-api-manager-v2-0-0-on-centos-7-0)
```
$ ./wso2server.sh
JAVA_HOME environment variable is set to /usr/java/jdk1.8.0_60
CARBON_HOME environment variable is set to /home/devwso2/wso2am-2.1.0
Using Java memory options: -Xms256m -Xmx1024m
[2017-02-22 06:03:46,688] INFO - QpidBundleActivator Setting BundleContext in PluginManager
[2017-02-22 06:03:48,217] INFO - CarbonCoreActivator Starting WSO2 Carbon...
[2017-02-22 06:03:48,217] INFO - CarbonCoreActivator Operating System : Linux 3.10.0-514.6.1.el7.x86_64, amd64
[2017-02-22 06:03:48,218] INFO - CarbonCoreActivator Java Home : /usr/java/jdk1.8.0_60/jre
[2017-02-22 06:03:48,218] INFO - CarbonCoreActivator Java Version : 1.8.0_60
[2017-02-22 06:03:48,218] INFO - CarbonCoreActivator Java VM : Java HotSpot(TM) 64-Bit Server VM 25.60-b23,Oracle Corporation
[2017-02-22 06:03:48,218] INFO - CarbonCoreActivator Carbon Home : /home/devwso2/wso2am-2.1.0
[2017-02-22 06:03:48,218] INFO - CarbonCoreActivator Java Temp Dir : /home/devwso2/wso2am-2.1.0/tmp
[2017-02-22 06:03:48,218] INFO - CarbonCoreActivator User : devwso2, en-US, UTC
[2017-02-22 06:03:48,387] WARN - ValidationResultPrinter Swap Memory size (MB): 0 of the system is below the recommended minimum size :2047
[2017-02-22 06:03:48,389] WARN - ValidationResultPrinter Carbon is configured to use the default keystore (wso2carbon.jks). To maximize security when deploying to a production environment, configure a new keystore with a unique password in the production server profile.
.....................
[2017-02-22 06:04:46,407] ERROR - Main Exception during startup. Triggering shutdown
org.wso2.andes.kernel.AndesException: Unable to initialise application registry
at org.wso2.andes.server.Broker.startupImpl(Broker.java:308)
at org.wso2.andes.server.Broker.startup(Broker.java:110)
at org.wso2.andes.server.Main.startBroker(Main.java:217)
at org.wso2.andes.server.Main.execute(Main.java:206)
at org.wso2.andes.server.Main.<init>(Main.java:54)
at org.wso2.andes.server.Main.main(Main.java:47)
at org.wso2.carbon.andes.internal.QpidServiceComponent.startAndesBroker(QpidServiceComponent.java:420)
at org.wso2.carbon.andes.internal.QpidServiceComponent.activate(QpidServiceComponent.java:165)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.eclipse.equinox.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:260)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:146)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:345)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:620)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:197)
at org.eclipse.equinox.internal.ds.Resolver.getEligible(Resolver.java:343)
at org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:222)
at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:107)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:861)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:819)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:771)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:214)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:433)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:451)
at org.wso2.carbon.server.admin.internal.ServerAdminServiceComponent.activate(ServerAdminServiceComponent.java:106)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.eclipse.equinox.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:260)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:146)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:345)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:620)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:197)
at org.eclipse.equinox.internal.ds.Resolver.getEligible(Resolver.java:343)
at org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:222)
at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:107)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:861)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:819)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:771)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:214)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:433)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:451)
at org.wso2.carbon.core.init.CarbonServerManager.initializeCarbon(CarbonServerManager.java:514)
at org.wso2.carbon.core.init.CarbonServerManager.start(CarbonServerManager.java:219)
at org.wso2.carbon.core.internal.CarbonCoreServiceComponent.activate(CarbonCoreServiceComponent.java:94)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.eclipse.equinox.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:260)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:146)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:345)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:620)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:197)
at org.eclipse.equinox.internal.ds.Resolver.getEligible(Resolver.java:343)
at org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:222)
at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:107)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:861)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:819)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:771)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:214)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:433)
at org.eclipse.equinox.http.servlet.internal.Activator.registerHttpService(Activator.java:81)
at org.eclipse.equinox.http.servlet.internal.Activator.addProxyServlet(Activator.java:60)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.init(ProxyServlet.java:40)
at org.wso2.carbon.tomcat.ext.servlet.DelegationServlet.init(DelegationServlet.java:38)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1269)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1182)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1072)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5368)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5660)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1571)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1561)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.wso2.andes.transport.TransportException: Could not bind to /0.0.0.0:5672
at org.wso2.andes.transport.network.mina.MinaNetworkTransport.accept(MinaNetworkTransport.java:147)
at org.wso2.andes.server.Broker.startAMQPListener(Broker.java:201)
at org.wso2.andes.server.Broker.startupImpl(Broker.java:295)
... 89 more
Caused by: java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at org.apache.mina.transport.socket.nio.SocketAcceptor.registerNew(SocketAcceptor.java:363)
at org.apache.mina.transport.socket.nio.SocketAcceptor.access$800(SocketAcceptor.java:55)
at org.apache.mina.transport.socket.nio.SocketAcceptor$Worker.run(SocketAcceptor.java:222)
at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51)
... 1 more
[2017-02-22 06:04:46,415] INFO - ApplicationRegistry Shutting down ApplicationRegistry(org.wso2.andes.server.registry.ConfigurationFileApplicationRegistry@1524f58a)
[2017-02-22 06:04:46,415] INFO - ApplicationRegistry Shutting down ApplicationRegistry:org.wso2.andes.server.registry.ConfigurationFileApplicationRegistry@1524f58a
[2017-02-22 06:04:46,418] INFO - PrincipalDatabaseAuthenticationManager Unregistering UserManagementMBean
[2017-02-22 06:04:46,421] INFO - CarbonServerManager Shutdown hook triggered....
[2017-02-22 06:04:46,426] INFO - CarbonServerManager Gracefully shutting down WSO2 API Manager...
[2017-02-22 06:04:46,428] INFO - ServerManagement Starting to switch to maintenance mode...
[2017-02-22 06:04:46,429] INFO - ServerManagement Stopped all transport listeners
[2017-02-22 06:04:46,429] INFO - ServerManagement Waiting for request service completion...
[2017-02-22 06:04:46,435] INFO - ServerManagement All requests have been served.
[2017-02-22 06:04:46,435] INFO - ServerManagement Waiting for deployment completion...
[2017-02-22 06:04:46,491] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/api/am/admin/v0.11]
[2017-02-22 06:04:46,536] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/throttle/data/v1]
[2017-02-22 06:04:46,566] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/am/sample/calculator/v1]
[2017-02-22 06:04:46,627] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/shindig]
[2017-02-22 06:04:46,653] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/api/am/publisher/v0.11]
[2017-02-22 06:04:46,682] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/api/am/store/v0.11]
[2017-02-22 06:04:46,699] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/authenticationendpoint]
[2017-02-22 06:04:46,719] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/oauth2]
[2017-02-22 06:04:46,735] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/am/sample/pizzashack/v1]
[2017-02-22 06:04:46,756] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/client-registration/v0.11]
[2017-02-22 06:04:46,764] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/admin]
[2017-02-22 06:04:46,775] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/portal]
[2017-02-22 06:04:46,783] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/store]
[2017-02-22 06:04:46,791] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/publisher]
[2017-02-22 06:04:46,791] INFO - ServerManagement All deployment tasks have been completed.
[2017-02-22 06:04:46,791] INFO - ServerManagement Waiting for server task completion...
[2017-02-22 06:04:46,805] INFO - ServerManagement All server tasks have been completed.
[2017-02-22 06:04:46,805] INFO - CarbonServerManager Shutting down WSO2 API Manager...
[2017-02-22 06:04:46,811] INFO - CarbonServerManager Shutting down OSGi framework...
[2017-02-22 06:04:54,812] INFO - CarbonEventManagementService Starting polling event receivers
[2017-02-22 06:05:15,404] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:05:15,412] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:05:17,532] WARN - AppDeployerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.synapse.service.SynapseAppDeployerService,
[2017-02-22 06:05:17,545] WARN - StartupFinalizerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.service.CappDeploymentService,org.wso2.carbon.server.admin.common.IServerAdmin,org.wso2.carbon.throttling.agent.ThrottlingAgent,
[2017-02-22 06:05:30,413] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:05:30,418] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:05:44,927] WARN - SynapseAppDeployerDSComponent Waiting for required OSGi services: org.wso2.carbon.message.processor.service.MessageProcessorDeployerService,org.wso2.carbon.message.store.service.MessageStoreDeployerService,org.wso2.carbon.proxyadmin.service.ProxyDeployerService,
[2017-02-22 06:05:45,415] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:05:45,420] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:00,419] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:00,421] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:15,422] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:15,423] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:17,531] WARN - AppDeployerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.synapse.service.SynapseAppDeployerService,
[2017-02-22 06:06:17,546] WARN - StartupFinalizerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.service.CappDeploymentService,org.wso2.carbon.server.admin.common.IServerAdmin,org.wso2.carbon.throttling.agent.ThrottlingAgent,
[2017-02-22 06:06:30,425] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:30,426] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:44,926] WARN - SynapseAppDeployerDSComponent Waiting for required OSGi services: org.wso2.carbon.message.processor.service.MessageProcessorDeployerService,org.wso2.carbon.message.store.service.MessageStoreDeployerService,org.wso2.carbon.proxyadmin.service.ProxyDeployerService,
[2017-02-22 06:06:45,428] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:45,428] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:00,430] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:00,431] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:15,434] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:15,434] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:17,531] WARN - AppDeployerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.synapse.service.SynapseAppDeployerService,
[2017-02-22 06:07:17,545] WARN - StartupFinalizerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.service.CappDeploymentService,org.wso2.carbon.server.admin.common.IServerAdmin,org.wso2.carbon.throttling.agent.ThrottlingAgent,
[2017-02-22 06:07:30,438] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:30,438] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:36,930] INFO - SynapseTaskManager Shutting down the task manager
[2017-02-22 06:07:44,926] WARN - SynapseAppDeployerDSComponent Waiting for required OSGi services: org.wso2.carbon.message.processor.service.MessageProcessorDeployerService,org.wso2.carbon.message.store.service.MessageStoreDeployerService,org.wso2.carbon.proxyadmin.service.ProxyDeployerService,
[2017-02-22 06:07:45,440] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:45,442] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:00,444] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:00,445] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:15,452] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:15,452] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:17,531] WARN - AppDeployerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.synapse.service.SynapseAppDeployerService,
[2017-02-22 06:08:17,545] WARN - StartupFinalizerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.service.CappDeploymentService,org.wso2.carbon.server.admin.common.IServerAdmin,org.wso2.carbon.throttling.agent.ThrottlingAgent,
[2017-02-22 06:08:30,456] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:30,456] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:44,927] WARN - SynapseAppDeployerDSComponent Waiting for required OSGi services: org.wso2.carbon.message.processor.service.MessageProcessorDeployerService,org.wso2.carbon.message.store.service.MessageStoreDeployerService,org.wso2.carbon.proxyadmin.service.ProxyDeployerService,
[2017-02-22 06:08:45,458] ERROR - BlockingConditionRetriever Exception when retrieving Blocking Conditions from remote endpoint
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:668)
at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:522)
at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:401)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:178)
at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:144)
at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:131)
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:610)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:445)
at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:863)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:106)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57)
at org.wso2.carbon.apimgt.gateway.throttling.util.BlockingConditionRetriever.retrieveBlockConditionsData(BlockingConditionRetriever.java:79)
at org.wso2.carbon.apimgt.gateway.throttling.util.BlockingConditionRetriever.loadBlockingConditionsFromWebService(BlockingConditionRetriever.java:105)
at org.wso2.carbon.apimgt.gateway.throttling.util.BlockingConditionRetriever.run(BlockingConditionRetriever.java:51)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
[2017-02-22 06:08:45,458] ERROR - KeyTemplateRetriever Exception when retrieving throttling data from remote endpoint
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:668)
at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:522)
at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:401)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:178)
at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:144)
at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:131)
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:610)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:445)
at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:863)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:106)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57)
at org.wso2.carbon.apimgt.gateway.throttling.util.KeyTemplateRetriever.retrieveKeyTemplateData(KeyTemplateRetriever.java:83)
at org.wso2.carbon.apimgt.gateway.throttling.util.KeyTemplateRetriever.loadKeyTemplatesFromWebService(KeyTemplateRetriever.java:111)
at org.wso2.carbon.apimgt.gateway.throttling.util.KeyTemplateRetriever.run(KeyTemplateRetriever.java:54)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
Exception in thread "Timer-5" java.lang.NullPointerException
at java.util.Objects.requireNonNull(Objects.java:203)
at java.util.Arrays$ArrayList.<init>(Arrays.java:3813)
at java.util.Arrays.asList(Arrays.java:3800)
at org.wso2.carbon.apimgt.gateway.throttling.util.KeyTemplateRetriever.loadKeyTemplatesFromWebService(KeyTemplateRetriever.java:111)
at org.wso2.carbon.apimgt.gateway.throttling.util.KeyTemplateRetriever.run(KeyTemplateRetriever.java:54)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
[2017-02-22 06:09:16,963] INFO - BinaryDataReceiverServiceComponent Binary Data Receiver server shutting down...
[2017-02-22 06:09:16,964] INFO - BinaryDataReceiver Stopping Binary Server..
[2017-02-22 06:09:17,531] WARN - AppDeployerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.synapse.service.SynapseAppDeployerService
``` | 2017/02/22 | [
"https://Stackoverflow.com/questions/42384492",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7602984/"
]
| This is because port 5672 is occupied at the time when the API Manager server starts up. You can have 2 options I can think of to proceed with,
1. Change the default port offset.
* You can either start the API manager server with -DportOffset=[offset] (ex- -DportOffset=1) or change the value in /repository/conf to a value other than 0 and start the server.
2. Stop the existing process of already occupied server
* Without worrying about port offset, you can run the API Manager server on 5672 port for AMQP transport.
* Search the process of occupied port (5672 in this case)
>
> netstat -nlp|grep 5672
>
>
>
Output should looks like something below
>
> tcp 0 0 0.0.0.0:5672 0.0.0.0:\* LISTEN 6187/java
>
>
>
* Kill the process
>
> kill -9 [Process\_ID]
>
>
>
(here, 6187)
Then start the server and you won't see the exception anymore. | As Tanvi and Abimaran said, Port 5672 is used for queuing. It's very common to get this error when configuring two nodes in one machine for trying cluster. If this port has been used by another application, and you can't shut that application down, then you can change
```
connectionfactory.TopicConnectionFactory = amqp://admin:admin@clientid/carbon?brokerlist='tcp://localhost:5672'
connectionfactory.QueueConnectionFactory = amqp://admin:admin@clientID/test?brokerlist='tcp://localhost:5672'
```
to another port for API manager in (/repository/config/jndi.properties). |
42,384,492 | I am getting errors and warnings while trying to bring up WSO2 API Manager 2.1.0 for the first time. [CentOS Linux release 7.3.1611 (Core)]. Excerpts are given below. I have already tried the suggestions at: [Failed to start wso2 API Manager v2.0.0 on centos 7.0](https://stackoverflow.com/questions/38948303/failed-to-start-wso2-api-manager-v2-0-0-on-centos-7-0)
```
$ ./wso2server.sh
JAVA_HOME environment variable is set to /usr/java/jdk1.8.0_60
CARBON_HOME environment variable is set to /home/devwso2/wso2am-2.1.0
Using Java memory options: -Xms256m -Xmx1024m
[2017-02-22 06:03:46,688] INFO - QpidBundleActivator Setting BundleContext in PluginManager
[2017-02-22 06:03:48,217] INFO - CarbonCoreActivator Starting WSO2 Carbon...
[2017-02-22 06:03:48,217] INFO - CarbonCoreActivator Operating System : Linux 3.10.0-514.6.1.el7.x86_64, amd64
[2017-02-22 06:03:48,218] INFO - CarbonCoreActivator Java Home : /usr/java/jdk1.8.0_60/jre
[2017-02-22 06:03:48,218] INFO - CarbonCoreActivator Java Version : 1.8.0_60
[2017-02-22 06:03:48,218] INFO - CarbonCoreActivator Java VM : Java HotSpot(TM) 64-Bit Server VM 25.60-b23,Oracle Corporation
[2017-02-22 06:03:48,218] INFO - CarbonCoreActivator Carbon Home : /home/devwso2/wso2am-2.1.0
[2017-02-22 06:03:48,218] INFO - CarbonCoreActivator Java Temp Dir : /home/devwso2/wso2am-2.1.0/tmp
[2017-02-22 06:03:48,218] INFO - CarbonCoreActivator User : devwso2, en-US, UTC
[2017-02-22 06:03:48,387] WARN - ValidationResultPrinter Swap Memory size (MB): 0 of the system is below the recommended minimum size :2047
[2017-02-22 06:03:48,389] WARN - ValidationResultPrinter Carbon is configured to use the default keystore (wso2carbon.jks). To maximize security when deploying to a production environment, configure a new keystore with a unique password in the production server profile.
.....................
[2017-02-22 06:04:46,407] ERROR - Main Exception during startup. Triggering shutdown
org.wso2.andes.kernel.AndesException: Unable to initialise application registry
at org.wso2.andes.server.Broker.startupImpl(Broker.java:308)
at org.wso2.andes.server.Broker.startup(Broker.java:110)
at org.wso2.andes.server.Main.startBroker(Main.java:217)
at org.wso2.andes.server.Main.execute(Main.java:206)
at org.wso2.andes.server.Main.<init>(Main.java:54)
at org.wso2.andes.server.Main.main(Main.java:47)
at org.wso2.carbon.andes.internal.QpidServiceComponent.startAndesBroker(QpidServiceComponent.java:420)
at org.wso2.carbon.andes.internal.QpidServiceComponent.activate(QpidServiceComponent.java:165)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.eclipse.equinox.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:260)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:146)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:345)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:620)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:197)
at org.eclipse.equinox.internal.ds.Resolver.getEligible(Resolver.java:343)
at org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:222)
at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:107)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:861)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:819)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:771)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:214)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:433)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:451)
at org.wso2.carbon.server.admin.internal.ServerAdminServiceComponent.activate(ServerAdminServiceComponent.java:106)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.eclipse.equinox.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:260)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:146)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:345)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:620)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:197)
at org.eclipse.equinox.internal.ds.Resolver.getEligible(Resolver.java:343)
at org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:222)
at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:107)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:861)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:819)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:771)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:214)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:433)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:451)
at org.wso2.carbon.core.init.CarbonServerManager.initializeCarbon(CarbonServerManager.java:514)
at org.wso2.carbon.core.init.CarbonServerManager.start(CarbonServerManager.java:219)
at org.wso2.carbon.core.internal.CarbonCoreServiceComponent.activate(CarbonCoreServiceComponent.java:94)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.eclipse.equinox.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:260)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:146)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:345)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:620)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:197)
at org.eclipse.equinox.internal.ds.Resolver.getEligible(Resolver.java:343)
at org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:222)
at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:107)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:861)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:819)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:771)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:214)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:433)
at org.eclipse.equinox.http.servlet.internal.Activator.registerHttpService(Activator.java:81)
at org.eclipse.equinox.http.servlet.internal.Activator.addProxyServlet(Activator.java:60)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.init(ProxyServlet.java:40)
at org.wso2.carbon.tomcat.ext.servlet.DelegationServlet.init(DelegationServlet.java:38)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1269)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1182)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1072)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5368)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5660)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1571)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1561)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.wso2.andes.transport.TransportException: Could not bind to /0.0.0.0:5672
at org.wso2.andes.transport.network.mina.MinaNetworkTransport.accept(MinaNetworkTransport.java:147)
at org.wso2.andes.server.Broker.startAMQPListener(Broker.java:201)
at org.wso2.andes.server.Broker.startupImpl(Broker.java:295)
... 89 more
Caused by: java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at org.apache.mina.transport.socket.nio.SocketAcceptor.registerNew(SocketAcceptor.java:363)
at org.apache.mina.transport.socket.nio.SocketAcceptor.access$800(SocketAcceptor.java:55)
at org.apache.mina.transport.socket.nio.SocketAcceptor$Worker.run(SocketAcceptor.java:222)
at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51)
... 1 more
[2017-02-22 06:04:46,415] INFO - ApplicationRegistry Shutting down ApplicationRegistry(org.wso2.andes.server.registry.ConfigurationFileApplicationRegistry@1524f58a)
[2017-02-22 06:04:46,415] INFO - ApplicationRegistry Shutting down ApplicationRegistry:org.wso2.andes.server.registry.ConfigurationFileApplicationRegistry@1524f58a
[2017-02-22 06:04:46,418] INFO - PrincipalDatabaseAuthenticationManager Unregistering UserManagementMBean
[2017-02-22 06:04:46,421] INFO - CarbonServerManager Shutdown hook triggered....
[2017-02-22 06:04:46,426] INFO - CarbonServerManager Gracefully shutting down WSO2 API Manager...
[2017-02-22 06:04:46,428] INFO - ServerManagement Starting to switch to maintenance mode...
[2017-02-22 06:04:46,429] INFO - ServerManagement Stopped all transport listeners
[2017-02-22 06:04:46,429] INFO - ServerManagement Waiting for request service completion...
[2017-02-22 06:04:46,435] INFO - ServerManagement All requests have been served.
[2017-02-22 06:04:46,435] INFO - ServerManagement Waiting for deployment completion...
[2017-02-22 06:04:46,491] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/api/am/admin/v0.11]
[2017-02-22 06:04:46,536] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/throttle/data/v1]
[2017-02-22 06:04:46,566] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/am/sample/calculator/v1]
[2017-02-22 06:04:46,627] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/shindig]
[2017-02-22 06:04:46,653] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/api/am/publisher/v0.11]
[2017-02-22 06:04:46,682] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/api/am/store/v0.11]
[2017-02-22 06:04:46,699] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/authenticationendpoint]
[2017-02-22 06:04:46,719] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/oauth2]
[2017-02-22 06:04:46,735] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/am/sample/pizzashack/v1]
[2017-02-22 06:04:46,756] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/client-registration/v0.11]
[2017-02-22 06:04:46,764] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/admin]
[2017-02-22 06:04:46,775] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/portal]
[2017-02-22 06:04:46,783] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/store]
[2017-02-22 06:04:46,791] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/publisher]
[2017-02-22 06:04:46,791] INFO - ServerManagement All deployment tasks have been completed.
[2017-02-22 06:04:46,791] INFO - ServerManagement Waiting for server task completion...
[2017-02-22 06:04:46,805] INFO - ServerManagement All server tasks have been completed.
[2017-02-22 06:04:46,805] INFO - CarbonServerManager Shutting down WSO2 API Manager...
[2017-02-22 06:04:46,811] INFO - CarbonServerManager Shutting down OSGi framework...
[2017-02-22 06:04:54,812] INFO - CarbonEventManagementService Starting polling event receivers
[2017-02-22 06:05:15,404] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:05:15,412] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:05:17,532] WARN - AppDeployerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.synapse.service.SynapseAppDeployerService,
[2017-02-22 06:05:17,545] WARN - StartupFinalizerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.service.CappDeploymentService,org.wso2.carbon.server.admin.common.IServerAdmin,org.wso2.carbon.throttling.agent.ThrottlingAgent,
[2017-02-22 06:05:30,413] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:05:30,418] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:05:44,927] WARN - SynapseAppDeployerDSComponent Waiting for required OSGi services: org.wso2.carbon.message.processor.service.MessageProcessorDeployerService,org.wso2.carbon.message.store.service.MessageStoreDeployerService,org.wso2.carbon.proxyadmin.service.ProxyDeployerService,
[2017-02-22 06:05:45,415] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:05:45,420] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:00,419] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:00,421] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:15,422] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:15,423] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:17,531] WARN - AppDeployerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.synapse.service.SynapseAppDeployerService,
[2017-02-22 06:06:17,546] WARN - StartupFinalizerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.service.CappDeploymentService,org.wso2.carbon.server.admin.common.IServerAdmin,org.wso2.carbon.throttling.agent.ThrottlingAgent,
[2017-02-22 06:06:30,425] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:30,426] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:44,926] WARN - SynapseAppDeployerDSComponent Waiting for required OSGi services: org.wso2.carbon.message.processor.service.MessageProcessorDeployerService,org.wso2.carbon.message.store.service.MessageStoreDeployerService,org.wso2.carbon.proxyadmin.service.ProxyDeployerService,
[2017-02-22 06:06:45,428] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:45,428] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:00,430] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:00,431] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:15,434] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:15,434] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:17,531] WARN - AppDeployerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.synapse.service.SynapseAppDeployerService,
[2017-02-22 06:07:17,545] WARN - StartupFinalizerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.service.CappDeploymentService,org.wso2.carbon.server.admin.common.IServerAdmin,org.wso2.carbon.throttling.agent.ThrottlingAgent,
[2017-02-22 06:07:30,438] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:30,438] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:36,930] INFO - SynapseTaskManager Shutting down the task manager
[2017-02-22 06:07:44,926] WARN - SynapseAppDeployerDSComponent Waiting for required OSGi services: org.wso2.carbon.message.processor.service.MessageProcessorDeployerService,org.wso2.carbon.message.store.service.MessageStoreDeployerService,org.wso2.carbon.proxyadmin.service.ProxyDeployerService,
[2017-02-22 06:07:45,440] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:45,442] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:00,444] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:00,445] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:15,452] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:15,452] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:17,531] WARN - AppDeployerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.synapse.service.SynapseAppDeployerService,
[2017-02-22 06:08:17,545] WARN - StartupFinalizerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.service.CappDeploymentService,org.wso2.carbon.server.admin.common.IServerAdmin,org.wso2.carbon.throttling.agent.ThrottlingAgent,
[2017-02-22 06:08:30,456] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:30,456] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:44,927] WARN - SynapseAppDeployerDSComponent Waiting for required OSGi services: org.wso2.carbon.message.processor.service.MessageProcessorDeployerService,org.wso2.carbon.message.store.service.MessageStoreDeployerService,org.wso2.carbon.proxyadmin.service.ProxyDeployerService,
[2017-02-22 06:08:45,458] ERROR - BlockingConditionRetriever Exception when retrieving Blocking Conditions from remote endpoint
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:668)
at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:522)
at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:401)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:178)
at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:144)
at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:131)
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:610)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:445)
at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:863)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:106)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57)
at org.wso2.carbon.apimgt.gateway.throttling.util.BlockingConditionRetriever.retrieveBlockConditionsData(BlockingConditionRetriever.java:79)
at org.wso2.carbon.apimgt.gateway.throttling.util.BlockingConditionRetriever.loadBlockingConditionsFromWebService(BlockingConditionRetriever.java:105)
at org.wso2.carbon.apimgt.gateway.throttling.util.BlockingConditionRetriever.run(BlockingConditionRetriever.java:51)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
[2017-02-22 06:08:45,458] ERROR - KeyTemplateRetriever Exception when retrieving throttling data from remote endpoint
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:668)
at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:522)
at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:401)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:178)
at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:144)
at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:131)
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:610)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:445)
at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:863)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:106)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57)
at org.wso2.carbon.apimgt.gateway.throttling.util.KeyTemplateRetriever.retrieveKeyTemplateData(KeyTemplateRetriever.java:83)
at org.wso2.carbon.apimgt.gateway.throttling.util.KeyTemplateRetriever.loadKeyTemplatesFromWebService(KeyTemplateRetriever.java:111)
at org.wso2.carbon.apimgt.gateway.throttling.util.KeyTemplateRetriever.run(KeyTemplateRetriever.java:54)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
Exception in thread "Timer-5" java.lang.NullPointerException
at java.util.Objects.requireNonNull(Objects.java:203)
at java.util.Arrays$ArrayList.<init>(Arrays.java:3813)
at java.util.Arrays.asList(Arrays.java:3800)
at org.wso2.carbon.apimgt.gateway.throttling.util.KeyTemplateRetriever.loadKeyTemplatesFromWebService(KeyTemplateRetriever.java:111)
at org.wso2.carbon.apimgt.gateway.throttling.util.KeyTemplateRetriever.run(KeyTemplateRetriever.java:54)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
[2017-02-22 06:09:16,963] INFO - BinaryDataReceiverServiceComponent Binary Data Receiver server shutting down...
[2017-02-22 06:09:16,964] INFO - BinaryDataReceiver Stopping Binary Server..
[2017-02-22 06:09:17,531] WARN - AppDeployerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.synapse.service.SynapseAppDeployerService
``` | 2017/02/22 | [
"https://Stackoverflow.com/questions/42384492",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7602984/"
]
| I was running Java 17 SDK and got this same problem. Solved this by running the WSO2 script with Java 11 SDK instead.
You can either :
1. Change your JAVA\_HOME variable value
2. Create a new environment variable pointing to Java 11 SDK and replace recursively inside the WSO2 directory JAVA\_HOME with the new environment variable you have created | Port 5672 is needed for API Manager, from your exception trace, that port is occupied by another process.
Normally [RabbitMQ uses 5672](https://stackoverflow.com/questions/12792856/what-ports-does-rabbitmq-use), if that's the case you have to shut down that process. If you have another API Manager running on the physical node, then you have to offset the port with `-DportOffset=1` |
42,384,492 | I am getting errors and warnings while trying to bring up WSO2 API Manager 2.1.0 for the first time. [CentOS Linux release 7.3.1611 (Core)]. Excerpts are given below. I have already tried the suggestions at: [Failed to start wso2 API Manager v2.0.0 on centos 7.0](https://stackoverflow.com/questions/38948303/failed-to-start-wso2-api-manager-v2-0-0-on-centos-7-0)
```
$ ./wso2server.sh
JAVA_HOME environment variable is set to /usr/java/jdk1.8.0_60
CARBON_HOME environment variable is set to /home/devwso2/wso2am-2.1.0
Using Java memory options: -Xms256m -Xmx1024m
[2017-02-22 06:03:46,688] INFO - QpidBundleActivator Setting BundleContext in PluginManager
[2017-02-22 06:03:48,217] INFO - CarbonCoreActivator Starting WSO2 Carbon...
[2017-02-22 06:03:48,217] INFO - CarbonCoreActivator Operating System : Linux 3.10.0-514.6.1.el7.x86_64, amd64
[2017-02-22 06:03:48,218] INFO - CarbonCoreActivator Java Home : /usr/java/jdk1.8.0_60/jre
[2017-02-22 06:03:48,218] INFO - CarbonCoreActivator Java Version : 1.8.0_60
[2017-02-22 06:03:48,218] INFO - CarbonCoreActivator Java VM : Java HotSpot(TM) 64-Bit Server VM 25.60-b23,Oracle Corporation
[2017-02-22 06:03:48,218] INFO - CarbonCoreActivator Carbon Home : /home/devwso2/wso2am-2.1.0
[2017-02-22 06:03:48,218] INFO - CarbonCoreActivator Java Temp Dir : /home/devwso2/wso2am-2.1.0/tmp
[2017-02-22 06:03:48,218] INFO - CarbonCoreActivator User : devwso2, en-US, UTC
[2017-02-22 06:03:48,387] WARN - ValidationResultPrinter Swap Memory size (MB): 0 of the system is below the recommended minimum size :2047
[2017-02-22 06:03:48,389] WARN - ValidationResultPrinter Carbon is configured to use the default keystore (wso2carbon.jks). To maximize security when deploying to a production environment, configure a new keystore with a unique password in the production server profile.
.....................
[2017-02-22 06:04:46,407] ERROR - Main Exception during startup. Triggering shutdown
org.wso2.andes.kernel.AndesException: Unable to initialise application registry
at org.wso2.andes.server.Broker.startupImpl(Broker.java:308)
at org.wso2.andes.server.Broker.startup(Broker.java:110)
at org.wso2.andes.server.Main.startBroker(Main.java:217)
at org.wso2.andes.server.Main.execute(Main.java:206)
at org.wso2.andes.server.Main.<init>(Main.java:54)
at org.wso2.andes.server.Main.main(Main.java:47)
at org.wso2.carbon.andes.internal.QpidServiceComponent.startAndesBroker(QpidServiceComponent.java:420)
at org.wso2.carbon.andes.internal.QpidServiceComponent.activate(QpidServiceComponent.java:165)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.eclipse.equinox.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:260)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:146)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:345)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:620)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:197)
at org.eclipse.equinox.internal.ds.Resolver.getEligible(Resolver.java:343)
at org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:222)
at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:107)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:861)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:819)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:771)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:214)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:433)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:451)
at org.wso2.carbon.server.admin.internal.ServerAdminServiceComponent.activate(ServerAdminServiceComponent.java:106)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.eclipse.equinox.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:260)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:146)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:345)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:620)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:197)
at org.eclipse.equinox.internal.ds.Resolver.getEligible(Resolver.java:343)
at org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:222)
at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:107)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:861)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:819)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:771)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:214)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:433)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:451)
at org.wso2.carbon.core.init.CarbonServerManager.initializeCarbon(CarbonServerManager.java:514)
at org.wso2.carbon.core.init.CarbonServerManager.start(CarbonServerManager.java:219)
at org.wso2.carbon.core.internal.CarbonCoreServiceComponent.activate(CarbonCoreServiceComponent.java:94)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.eclipse.equinox.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:260)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:146)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:345)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:620)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:197)
at org.eclipse.equinox.internal.ds.Resolver.getEligible(Resolver.java:343)
at org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:222)
at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:107)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:861)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:819)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:771)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:214)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:433)
at org.eclipse.equinox.http.servlet.internal.Activator.registerHttpService(Activator.java:81)
at org.eclipse.equinox.http.servlet.internal.Activator.addProxyServlet(Activator.java:60)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.init(ProxyServlet.java:40)
at org.wso2.carbon.tomcat.ext.servlet.DelegationServlet.init(DelegationServlet.java:38)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1269)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1182)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1072)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5368)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5660)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1571)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1561)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.wso2.andes.transport.TransportException: Could not bind to /0.0.0.0:5672
at org.wso2.andes.transport.network.mina.MinaNetworkTransport.accept(MinaNetworkTransport.java:147)
at org.wso2.andes.server.Broker.startAMQPListener(Broker.java:201)
at org.wso2.andes.server.Broker.startupImpl(Broker.java:295)
... 89 more
Caused by: java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at org.apache.mina.transport.socket.nio.SocketAcceptor.registerNew(SocketAcceptor.java:363)
at org.apache.mina.transport.socket.nio.SocketAcceptor.access$800(SocketAcceptor.java:55)
at org.apache.mina.transport.socket.nio.SocketAcceptor$Worker.run(SocketAcceptor.java:222)
at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51)
... 1 more
[2017-02-22 06:04:46,415] INFO - ApplicationRegistry Shutting down ApplicationRegistry(org.wso2.andes.server.registry.ConfigurationFileApplicationRegistry@1524f58a)
[2017-02-22 06:04:46,415] INFO - ApplicationRegistry Shutting down ApplicationRegistry:org.wso2.andes.server.registry.ConfigurationFileApplicationRegistry@1524f58a
[2017-02-22 06:04:46,418] INFO - PrincipalDatabaseAuthenticationManager Unregistering UserManagementMBean
[2017-02-22 06:04:46,421] INFO - CarbonServerManager Shutdown hook triggered....
[2017-02-22 06:04:46,426] INFO - CarbonServerManager Gracefully shutting down WSO2 API Manager...
[2017-02-22 06:04:46,428] INFO - ServerManagement Starting to switch to maintenance mode...
[2017-02-22 06:04:46,429] INFO - ServerManagement Stopped all transport listeners
[2017-02-22 06:04:46,429] INFO - ServerManagement Waiting for request service completion...
[2017-02-22 06:04:46,435] INFO - ServerManagement All requests have been served.
[2017-02-22 06:04:46,435] INFO - ServerManagement Waiting for deployment completion...
[2017-02-22 06:04:46,491] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/api/am/admin/v0.11]
[2017-02-22 06:04:46,536] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/throttle/data/v1]
[2017-02-22 06:04:46,566] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/am/sample/calculator/v1]
[2017-02-22 06:04:46,627] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/shindig]
[2017-02-22 06:04:46,653] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/api/am/publisher/v0.11]
[2017-02-22 06:04:46,682] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/api/am/store/v0.11]
[2017-02-22 06:04:46,699] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/authenticationendpoint]
[2017-02-22 06:04:46,719] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/oauth2]
[2017-02-22 06:04:46,735] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/am/sample/pizzashack/v1]
[2017-02-22 06:04:46,756] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/client-registration/v0.11]
[2017-02-22 06:04:46,764] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/admin]
[2017-02-22 06:04:46,775] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/portal]
[2017-02-22 06:04:46,783] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/store]
[2017-02-22 06:04:46,791] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/publisher]
[2017-02-22 06:04:46,791] INFO - ServerManagement All deployment tasks have been completed.
[2017-02-22 06:04:46,791] INFO - ServerManagement Waiting for server task completion...
[2017-02-22 06:04:46,805] INFO - ServerManagement All server tasks have been completed.
[2017-02-22 06:04:46,805] INFO - CarbonServerManager Shutting down WSO2 API Manager...
[2017-02-22 06:04:46,811] INFO - CarbonServerManager Shutting down OSGi framework...
[2017-02-22 06:04:54,812] INFO - CarbonEventManagementService Starting polling event receivers
[2017-02-22 06:05:15,404] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:05:15,412] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:05:17,532] WARN - AppDeployerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.synapse.service.SynapseAppDeployerService,
[2017-02-22 06:05:17,545] WARN - StartupFinalizerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.service.CappDeploymentService,org.wso2.carbon.server.admin.common.IServerAdmin,org.wso2.carbon.throttling.agent.ThrottlingAgent,
[2017-02-22 06:05:30,413] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:05:30,418] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:05:44,927] WARN - SynapseAppDeployerDSComponent Waiting for required OSGi services: org.wso2.carbon.message.processor.service.MessageProcessorDeployerService,org.wso2.carbon.message.store.service.MessageStoreDeployerService,org.wso2.carbon.proxyadmin.service.ProxyDeployerService,
[2017-02-22 06:05:45,415] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:05:45,420] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:00,419] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:00,421] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:15,422] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:15,423] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:17,531] WARN - AppDeployerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.synapse.service.SynapseAppDeployerService,
[2017-02-22 06:06:17,546] WARN - StartupFinalizerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.service.CappDeploymentService,org.wso2.carbon.server.admin.common.IServerAdmin,org.wso2.carbon.throttling.agent.ThrottlingAgent,
[2017-02-22 06:06:30,425] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:30,426] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:44,926] WARN - SynapseAppDeployerDSComponent Waiting for required OSGi services: org.wso2.carbon.message.processor.service.MessageProcessorDeployerService,org.wso2.carbon.message.store.service.MessageStoreDeployerService,org.wso2.carbon.proxyadmin.service.ProxyDeployerService,
[2017-02-22 06:06:45,428] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:45,428] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:00,430] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:00,431] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:15,434] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:15,434] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:17,531] WARN - AppDeployerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.synapse.service.SynapseAppDeployerService,
[2017-02-22 06:07:17,545] WARN - StartupFinalizerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.service.CappDeploymentService,org.wso2.carbon.server.admin.common.IServerAdmin,org.wso2.carbon.throttling.agent.ThrottlingAgent,
[2017-02-22 06:07:30,438] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:30,438] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:36,930] INFO - SynapseTaskManager Shutting down the task manager
[2017-02-22 06:07:44,926] WARN - SynapseAppDeployerDSComponent Waiting for required OSGi services: org.wso2.carbon.message.processor.service.MessageProcessorDeployerService,org.wso2.carbon.message.store.service.MessageStoreDeployerService,org.wso2.carbon.proxyadmin.service.ProxyDeployerService,
[2017-02-22 06:07:45,440] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:45,442] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:00,444] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:00,445] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:15,452] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:15,452] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:17,531] WARN - AppDeployerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.synapse.service.SynapseAppDeployerService,
[2017-02-22 06:08:17,545] WARN - StartupFinalizerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.service.CappDeploymentService,org.wso2.carbon.server.admin.common.IServerAdmin,org.wso2.carbon.throttling.agent.ThrottlingAgent,
[2017-02-22 06:08:30,456] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:30,456] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:44,927] WARN - SynapseAppDeployerDSComponent Waiting for required OSGi services: org.wso2.carbon.message.processor.service.MessageProcessorDeployerService,org.wso2.carbon.message.store.service.MessageStoreDeployerService,org.wso2.carbon.proxyadmin.service.ProxyDeployerService,
[2017-02-22 06:08:45,458] ERROR - BlockingConditionRetriever Exception when retrieving Blocking Conditions from remote endpoint
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:668)
at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:522)
at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:401)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:178)
at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:144)
at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:131)
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:610)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:445)
at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:863)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:106)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57)
at org.wso2.carbon.apimgt.gateway.throttling.util.BlockingConditionRetriever.retrieveBlockConditionsData(BlockingConditionRetriever.java:79)
at org.wso2.carbon.apimgt.gateway.throttling.util.BlockingConditionRetriever.loadBlockingConditionsFromWebService(BlockingConditionRetriever.java:105)
at org.wso2.carbon.apimgt.gateway.throttling.util.BlockingConditionRetriever.run(BlockingConditionRetriever.java:51)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
[2017-02-22 06:08:45,458] ERROR - KeyTemplateRetriever Exception when retrieving throttling data from remote endpoint
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:668)
at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:522)
at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:401)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:178)
at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:144)
at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:131)
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:610)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:445)
at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:863)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:106)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57)
at org.wso2.carbon.apimgt.gateway.throttling.util.KeyTemplateRetriever.retrieveKeyTemplateData(KeyTemplateRetriever.java:83)
at org.wso2.carbon.apimgt.gateway.throttling.util.KeyTemplateRetriever.loadKeyTemplatesFromWebService(KeyTemplateRetriever.java:111)
at org.wso2.carbon.apimgt.gateway.throttling.util.KeyTemplateRetriever.run(KeyTemplateRetriever.java:54)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
Exception in thread "Timer-5" java.lang.NullPointerException
at java.util.Objects.requireNonNull(Objects.java:203)
at java.util.Arrays$ArrayList.<init>(Arrays.java:3813)
at java.util.Arrays.asList(Arrays.java:3800)
at org.wso2.carbon.apimgt.gateway.throttling.util.KeyTemplateRetriever.loadKeyTemplatesFromWebService(KeyTemplateRetriever.java:111)
at org.wso2.carbon.apimgt.gateway.throttling.util.KeyTemplateRetriever.run(KeyTemplateRetriever.java:54)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
[2017-02-22 06:09:16,963] INFO - BinaryDataReceiverServiceComponent Binary Data Receiver server shutting down...
[2017-02-22 06:09:16,964] INFO - BinaryDataReceiver Stopping Binary Server..
[2017-02-22 06:09:17,531] WARN - AppDeployerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.synapse.service.SynapseAppDeployerService
``` | 2017/02/22 | [
"https://Stackoverflow.com/questions/42384492",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7602984/"
]
| I was trying from long time. RMQ was running in my system.
Got to **C:\Program Files (x86)\RabbitMQ Server\rabbitmq\_server-3.3.4\sbin** and run
```
rabbitmq-service.bat stop
``` | You could change the default ports with an offset. So go to :
```
deployment.toml
```
and for example change the following config:
```
[server]
offset=1
```
so port no 5672 will be change to 5673. |
42,384,492 | I am getting errors and warnings while trying to bring up WSO2 API Manager 2.1.0 for the first time. [CentOS Linux release 7.3.1611 (Core)]. Excerpts are given below. I have already tried the suggestions at: [Failed to start wso2 API Manager v2.0.0 on centos 7.0](https://stackoverflow.com/questions/38948303/failed-to-start-wso2-api-manager-v2-0-0-on-centos-7-0)
```
$ ./wso2server.sh
JAVA_HOME environment variable is set to /usr/java/jdk1.8.0_60
CARBON_HOME environment variable is set to /home/devwso2/wso2am-2.1.0
Using Java memory options: -Xms256m -Xmx1024m
[2017-02-22 06:03:46,688] INFO - QpidBundleActivator Setting BundleContext in PluginManager
[2017-02-22 06:03:48,217] INFO - CarbonCoreActivator Starting WSO2 Carbon...
[2017-02-22 06:03:48,217] INFO - CarbonCoreActivator Operating System : Linux 3.10.0-514.6.1.el7.x86_64, amd64
[2017-02-22 06:03:48,218] INFO - CarbonCoreActivator Java Home : /usr/java/jdk1.8.0_60/jre
[2017-02-22 06:03:48,218] INFO - CarbonCoreActivator Java Version : 1.8.0_60
[2017-02-22 06:03:48,218] INFO - CarbonCoreActivator Java VM : Java HotSpot(TM) 64-Bit Server VM 25.60-b23,Oracle Corporation
[2017-02-22 06:03:48,218] INFO - CarbonCoreActivator Carbon Home : /home/devwso2/wso2am-2.1.0
[2017-02-22 06:03:48,218] INFO - CarbonCoreActivator Java Temp Dir : /home/devwso2/wso2am-2.1.0/tmp
[2017-02-22 06:03:48,218] INFO - CarbonCoreActivator User : devwso2, en-US, UTC
[2017-02-22 06:03:48,387] WARN - ValidationResultPrinter Swap Memory size (MB): 0 of the system is below the recommended minimum size :2047
[2017-02-22 06:03:48,389] WARN - ValidationResultPrinter Carbon is configured to use the default keystore (wso2carbon.jks). To maximize security when deploying to a production environment, configure a new keystore with a unique password in the production server profile.
.....................
[2017-02-22 06:04:46,407] ERROR - Main Exception during startup. Triggering shutdown
org.wso2.andes.kernel.AndesException: Unable to initialise application registry
at org.wso2.andes.server.Broker.startupImpl(Broker.java:308)
at org.wso2.andes.server.Broker.startup(Broker.java:110)
at org.wso2.andes.server.Main.startBroker(Main.java:217)
at org.wso2.andes.server.Main.execute(Main.java:206)
at org.wso2.andes.server.Main.<init>(Main.java:54)
at org.wso2.andes.server.Main.main(Main.java:47)
at org.wso2.carbon.andes.internal.QpidServiceComponent.startAndesBroker(QpidServiceComponent.java:420)
at org.wso2.carbon.andes.internal.QpidServiceComponent.activate(QpidServiceComponent.java:165)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.eclipse.equinox.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:260)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:146)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:345)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:620)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:197)
at org.eclipse.equinox.internal.ds.Resolver.getEligible(Resolver.java:343)
at org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:222)
at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:107)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:861)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:819)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:771)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:214)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:433)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:451)
at org.wso2.carbon.server.admin.internal.ServerAdminServiceComponent.activate(ServerAdminServiceComponent.java:106)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.eclipse.equinox.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:260)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:146)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:345)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:620)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:197)
at org.eclipse.equinox.internal.ds.Resolver.getEligible(Resolver.java:343)
at org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:222)
at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:107)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:861)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:819)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:771)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:214)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:433)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:451)
at org.wso2.carbon.core.init.CarbonServerManager.initializeCarbon(CarbonServerManager.java:514)
at org.wso2.carbon.core.init.CarbonServerManager.start(CarbonServerManager.java:219)
at org.wso2.carbon.core.internal.CarbonCoreServiceComponent.activate(CarbonCoreServiceComponent.java:94)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.eclipse.equinox.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:260)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:146)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:345)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:620)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:197)
at org.eclipse.equinox.internal.ds.Resolver.getEligible(Resolver.java:343)
at org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:222)
at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:107)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:861)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:819)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:771)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:214)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:433)
at org.eclipse.equinox.http.servlet.internal.Activator.registerHttpService(Activator.java:81)
at org.eclipse.equinox.http.servlet.internal.Activator.addProxyServlet(Activator.java:60)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.init(ProxyServlet.java:40)
at org.wso2.carbon.tomcat.ext.servlet.DelegationServlet.init(DelegationServlet.java:38)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1269)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1182)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1072)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5368)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5660)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1571)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1561)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.wso2.andes.transport.TransportException: Could not bind to /0.0.0.0:5672
at org.wso2.andes.transport.network.mina.MinaNetworkTransport.accept(MinaNetworkTransport.java:147)
at org.wso2.andes.server.Broker.startAMQPListener(Broker.java:201)
at org.wso2.andes.server.Broker.startupImpl(Broker.java:295)
... 89 more
Caused by: java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at org.apache.mina.transport.socket.nio.SocketAcceptor.registerNew(SocketAcceptor.java:363)
at org.apache.mina.transport.socket.nio.SocketAcceptor.access$800(SocketAcceptor.java:55)
at org.apache.mina.transport.socket.nio.SocketAcceptor$Worker.run(SocketAcceptor.java:222)
at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51)
... 1 more
[2017-02-22 06:04:46,415] INFO - ApplicationRegistry Shutting down ApplicationRegistry(org.wso2.andes.server.registry.ConfigurationFileApplicationRegistry@1524f58a)
[2017-02-22 06:04:46,415] INFO - ApplicationRegistry Shutting down ApplicationRegistry:org.wso2.andes.server.registry.ConfigurationFileApplicationRegistry@1524f58a
[2017-02-22 06:04:46,418] INFO - PrincipalDatabaseAuthenticationManager Unregistering UserManagementMBean
[2017-02-22 06:04:46,421] INFO - CarbonServerManager Shutdown hook triggered....
[2017-02-22 06:04:46,426] INFO - CarbonServerManager Gracefully shutting down WSO2 API Manager...
[2017-02-22 06:04:46,428] INFO - ServerManagement Starting to switch to maintenance mode...
[2017-02-22 06:04:46,429] INFO - ServerManagement Stopped all transport listeners
[2017-02-22 06:04:46,429] INFO - ServerManagement Waiting for request service completion...
[2017-02-22 06:04:46,435] INFO - ServerManagement All requests have been served.
[2017-02-22 06:04:46,435] INFO - ServerManagement Waiting for deployment completion...
[2017-02-22 06:04:46,491] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/api/am/admin/v0.11]
[2017-02-22 06:04:46,536] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/throttle/data/v1]
[2017-02-22 06:04:46,566] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/am/sample/calculator/v1]
[2017-02-22 06:04:46,627] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/shindig]
[2017-02-22 06:04:46,653] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/api/am/publisher/v0.11]
[2017-02-22 06:04:46,682] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/api/am/store/v0.11]
[2017-02-22 06:04:46,699] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/authenticationendpoint]
[2017-02-22 06:04:46,719] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/oauth2]
[2017-02-22 06:04:46,735] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/am/sample/pizzashack/v1]
[2017-02-22 06:04:46,756] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/client-registration/v0.11]
[2017-02-22 06:04:46,764] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/admin]
[2017-02-22 06:04:46,775] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/portal]
[2017-02-22 06:04:46,783] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/store]
[2017-02-22 06:04:46,791] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/publisher]
[2017-02-22 06:04:46,791] INFO - ServerManagement All deployment tasks have been completed.
[2017-02-22 06:04:46,791] INFO - ServerManagement Waiting for server task completion...
[2017-02-22 06:04:46,805] INFO - ServerManagement All server tasks have been completed.
[2017-02-22 06:04:46,805] INFO - CarbonServerManager Shutting down WSO2 API Manager...
[2017-02-22 06:04:46,811] INFO - CarbonServerManager Shutting down OSGi framework...
[2017-02-22 06:04:54,812] INFO - CarbonEventManagementService Starting polling event receivers
[2017-02-22 06:05:15,404] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:05:15,412] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:05:17,532] WARN - AppDeployerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.synapse.service.SynapseAppDeployerService,
[2017-02-22 06:05:17,545] WARN - StartupFinalizerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.service.CappDeploymentService,org.wso2.carbon.server.admin.common.IServerAdmin,org.wso2.carbon.throttling.agent.ThrottlingAgent,
[2017-02-22 06:05:30,413] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:05:30,418] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:05:44,927] WARN - SynapseAppDeployerDSComponent Waiting for required OSGi services: org.wso2.carbon.message.processor.service.MessageProcessorDeployerService,org.wso2.carbon.message.store.service.MessageStoreDeployerService,org.wso2.carbon.proxyadmin.service.ProxyDeployerService,
[2017-02-22 06:05:45,415] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:05:45,420] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:00,419] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:00,421] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:15,422] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:15,423] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:17,531] WARN - AppDeployerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.synapse.service.SynapseAppDeployerService,
[2017-02-22 06:06:17,546] WARN - StartupFinalizerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.service.CappDeploymentService,org.wso2.carbon.server.admin.common.IServerAdmin,org.wso2.carbon.throttling.agent.ThrottlingAgent,
[2017-02-22 06:06:30,425] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:30,426] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:44,926] WARN - SynapseAppDeployerDSComponent Waiting for required OSGi services: org.wso2.carbon.message.processor.service.MessageProcessorDeployerService,org.wso2.carbon.message.store.service.MessageStoreDeployerService,org.wso2.carbon.proxyadmin.service.ProxyDeployerService,
[2017-02-22 06:06:45,428] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:45,428] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:00,430] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:00,431] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:15,434] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:15,434] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:17,531] WARN - AppDeployerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.synapse.service.SynapseAppDeployerService,
[2017-02-22 06:07:17,545] WARN - StartupFinalizerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.service.CappDeploymentService,org.wso2.carbon.server.admin.common.IServerAdmin,org.wso2.carbon.throttling.agent.ThrottlingAgent,
[2017-02-22 06:07:30,438] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:30,438] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:36,930] INFO - SynapseTaskManager Shutting down the task manager
[2017-02-22 06:07:44,926] WARN - SynapseAppDeployerDSComponent Waiting for required OSGi services: org.wso2.carbon.message.processor.service.MessageProcessorDeployerService,org.wso2.carbon.message.store.service.MessageStoreDeployerService,org.wso2.carbon.proxyadmin.service.ProxyDeployerService,
[2017-02-22 06:07:45,440] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:45,442] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:00,444] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:00,445] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:15,452] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:15,452] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:17,531] WARN - AppDeployerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.synapse.service.SynapseAppDeployerService,
[2017-02-22 06:08:17,545] WARN - StartupFinalizerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.service.CappDeploymentService,org.wso2.carbon.server.admin.common.IServerAdmin,org.wso2.carbon.throttling.agent.ThrottlingAgent,
[2017-02-22 06:08:30,456] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:30,456] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:44,927] WARN - SynapseAppDeployerDSComponent Waiting for required OSGi services: org.wso2.carbon.message.processor.service.MessageProcessorDeployerService,org.wso2.carbon.message.store.service.MessageStoreDeployerService,org.wso2.carbon.proxyadmin.service.ProxyDeployerService,
[2017-02-22 06:08:45,458] ERROR - BlockingConditionRetriever Exception when retrieving Blocking Conditions from remote endpoint
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:668)
at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:522)
at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:401)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:178)
at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:144)
at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:131)
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:610)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:445)
at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:863)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:106)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57)
at org.wso2.carbon.apimgt.gateway.throttling.util.BlockingConditionRetriever.retrieveBlockConditionsData(BlockingConditionRetriever.java:79)
at org.wso2.carbon.apimgt.gateway.throttling.util.BlockingConditionRetriever.loadBlockingConditionsFromWebService(BlockingConditionRetriever.java:105)
at org.wso2.carbon.apimgt.gateway.throttling.util.BlockingConditionRetriever.run(BlockingConditionRetriever.java:51)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
[2017-02-22 06:08:45,458] ERROR - KeyTemplateRetriever Exception when retrieving throttling data from remote endpoint
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:668)
at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:522)
at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:401)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:178)
at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:144)
at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:131)
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:610)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:445)
at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:863)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:106)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57)
at org.wso2.carbon.apimgt.gateway.throttling.util.KeyTemplateRetriever.retrieveKeyTemplateData(KeyTemplateRetriever.java:83)
at org.wso2.carbon.apimgt.gateway.throttling.util.KeyTemplateRetriever.loadKeyTemplatesFromWebService(KeyTemplateRetriever.java:111)
at org.wso2.carbon.apimgt.gateway.throttling.util.KeyTemplateRetriever.run(KeyTemplateRetriever.java:54)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
Exception in thread "Timer-5" java.lang.NullPointerException
at java.util.Objects.requireNonNull(Objects.java:203)
at java.util.Arrays$ArrayList.<init>(Arrays.java:3813)
at java.util.Arrays.asList(Arrays.java:3800)
at org.wso2.carbon.apimgt.gateway.throttling.util.KeyTemplateRetriever.loadKeyTemplatesFromWebService(KeyTemplateRetriever.java:111)
at org.wso2.carbon.apimgt.gateway.throttling.util.KeyTemplateRetriever.run(KeyTemplateRetriever.java:54)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
[2017-02-22 06:09:16,963] INFO - BinaryDataReceiverServiceComponent Binary Data Receiver server shutting down...
[2017-02-22 06:09:16,964] INFO - BinaryDataReceiver Stopping Binary Server..
[2017-02-22 06:09:17,531] WARN - AppDeployerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.synapse.service.SynapseAppDeployerService
``` | 2017/02/22 | [
"https://Stackoverflow.com/questions/42384492",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7602984/"
]
| I was running Java 17 SDK and got this same problem. Solved this by running the WSO2 script with Java 11 SDK instead.
You can either :
1. Change your JAVA\_HOME variable value
2. Create a new environment variable pointing to Java 11 SDK and replace recursively inside the WSO2 directory JAVA\_HOME with the new environment variable you have created | You could change the default ports with an offset. So go to :
```
deployment.toml
```
and for example change the following config:
```
[server]
offset=1
```
so port no 5672 will be change to 5673. |
42,384,492 | I am getting errors and warnings while trying to bring up WSO2 API Manager 2.1.0 for the first time. [CentOS Linux release 7.3.1611 (Core)]. Excerpts are given below. I have already tried the suggestions at: [Failed to start wso2 API Manager v2.0.0 on centos 7.0](https://stackoverflow.com/questions/38948303/failed-to-start-wso2-api-manager-v2-0-0-on-centos-7-0)
```
$ ./wso2server.sh
JAVA_HOME environment variable is set to /usr/java/jdk1.8.0_60
CARBON_HOME environment variable is set to /home/devwso2/wso2am-2.1.0
Using Java memory options: -Xms256m -Xmx1024m
[2017-02-22 06:03:46,688] INFO - QpidBundleActivator Setting BundleContext in PluginManager
[2017-02-22 06:03:48,217] INFO - CarbonCoreActivator Starting WSO2 Carbon...
[2017-02-22 06:03:48,217] INFO - CarbonCoreActivator Operating System : Linux 3.10.0-514.6.1.el7.x86_64, amd64
[2017-02-22 06:03:48,218] INFO - CarbonCoreActivator Java Home : /usr/java/jdk1.8.0_60/jre
[2017-02-22 06:03:48,218] INFO - CarbonCoreActivator Java Version : 1.8.0_60
[2017-02-22 06:03:48,218] INFO - CarbonCoreActivator Java VM : Java HotSpot(TM) 64-Bit Server VM 25.60-b23,Oracle Corporation
[2017-02-22 06:03:48,218] INFO - CarbonCoreActivator Carbon Home : /home/devwso2/wso2am-2.1.0
[2017-02-22 06:03:48,218] INFO - CarbonCoreActivator Java Temp Dir : /home/devwso2/wso2am-2.1.0/tmp
[2017-02-22 06:03:48,218] INFO - CarbonCoreActivator User : devwso2, en-US, UTC
[2017-02-22 06:03:48,387] WARN - ValidationResultPrinter Swap Memory size (MB): 0 of the system is below the recommended minimum size :2047
[2017-02-22 06:03:48,389] WARN - ValidationResultPrinter Carbon is configured to use the default keystore (wso2carbon.jks). To maximize security when deploying to a production environment, configure a new keystore with a unique password in the production server profile.
.....................
[2017-02-22 06:04:46,407] ERROR - Main Exception during startup. Triggering shutdown
org.wso2.andes.kernel.AndesException: Unable to initialise application registry
at org.wso2.andes.server.Broker.startupImpl(Broker.java:308)
at org.wso2.andes.server.Broker.startup(Broker.java:110)
at org.wso2.andes.server.Main.startBroker(Main.java:217)
at org.wso2.andes.server.Main.execute(Main.java:206)
at org.wso2.andes.server.Main.<init>(Main.java:54)
at org.wso2.andes.server.Main.main(Main.java:47)
at org.wso2.carbon.andes.internal.QpidServiceComponent.startAndesBroker(QpidServiceComponent.java:420)
at org.wso2.carbon.andes.internal.QpidServiceComponent.activate(QpidServiceComponent.java:165)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.eclipse.equinox.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:260)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:146)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:345)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:620)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:197)
at org.eclipse.equinox.internal.ds.Resolver.getEligible(Resolver.java:343)
at org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:222)
at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:107)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:861)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:819)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:771)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:214)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:433)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:451)
at org.wso2.carbon.server.admin.internal.ServerAdminServiceComponent.activate(ServerAdminServiceComponent.java:106)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.eclipse.equinox.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:260)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:146)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:345)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:620)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:197)
at org.eclipse.equinox.internal.ds.Resolver.getEligible(Resolver.java:343)
at org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:222)
at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:107)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:861)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:819)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:771)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:214)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:433)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:451)
at org.wso2.carbon.core.init.CarbonServerManager.initializeCarbon(CarbonServerManager.java:514)
at org.wso2.carbon.core.init.CarbonServerManager.start(CarbonServerManager.java:219)
at org.wso2.carbon.core.internal.CarbonCoreServiceComponent.activate(CarbonCoreServiceComponent.java:94)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.eclipse.equinox.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:260)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:146)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:345)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:620)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:197)
at org.eclipse.equinox.internal.ds.Resolver.getEligible(Resolver.java:343)
at org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:222)
at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:107)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:861)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:819)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:771)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:214)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:433)
at org.eclipse.equinox.http.servlet.internal.Activator.registerHttpService(Activator.java:81)
at org.eclipse.equinox.http.servlet.internal.Activator.addProxyServlet(Activator.java:60)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.init(ProxyServlet.java:40)
at org.wso2.carbon.tomcat.ext.servlet.DelegationServlet.init(DelegationServlet.java:38)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1269)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1182)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1072)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5368)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5660)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1571)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1561)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.wso2.andes.transport.TransportException: Could not bind to /0.0.0.0:5672
at org.wso2.andes.transport.network.mina.MinaNetworkTransport.accept(MinaNetworkTransport.java:147)
at org.wso2.andes.server.Broker.startAMQPListener(Broker.java:201)
at org.wso2.andes.server.Broker.startupImpl(Broker.java:295)
... 89 more
Caused by: java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at org.apache.mina.transport.socket.nio.SocketAcceptor.registerNew(SocketAcceptor.java:363)
at org.apache.mina.transport.socket.nio.SocketAcceptor.access$800(SocketAcceptor.java:55)
at org.apache.mina.transport.socket.nio.SocketAcceptor$Worker.run(SocketAcceptor.java:222)
at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51)
... 1 more
[2017-02-22 06:04:46,415] INFO - ApplicationRegistry Shutting down ApplicationRegistry(org.wso2.andes.server.registry.ConfigurationFileApplicationRegistry@1524f58a)
[2017-02-22 06:04:46,415] INFO - ApplicationRegistry Shutting down ApplicationRegistry:org.wso2.andes.server.registry.ConfigurationFileApplicationRegistry@1524f58a
[2017-02-22 06:04:46,418] INFO - PrincipalDatabaseAuthenticationManager Unregistering UserManagementMBean
[2017-02-22 06:04:46,421] INFO - CarbonServerManager Shutdown hook triggered....
[2017-02-22 06:04:46,426] INFO - CarbonServerManager Gracefully shutting down WSO2 API Manager...
[2017-02-22 06:04:46,428] INFO - ServerManagement Starting to switch to maintenance mode...
[2017-02-22 06:04:46,429] INFO - ServerManagement Stopped all transport listeners
[2017-02-22 06:04:46,429] INFO - ServerManagement Waiting for request service completion...
[2017-02-22 06:04:46,435] INFO - ServerManagement All requests have been served.
[2017-02-22 06:04:46,435] INFO - ServerManagement Waiting for deployment completion...
[2017-02-22 06:04:46,491] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/api/am/admin/v0.11]
[2017-02-22 06:04:46,536] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/throttle/data/v1]
[2017-02-22 06:04:46,566] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/am/sample/calculator/v1]
[2017-02-22 06:04:46,627] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/shindig]
[2017-02-22 06:04:46,653] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/api/am/publisher/v0.11]
[2017-02-22 06:04:46,682] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/api/am/store/v0.11]
[2017-02-22 06:04:46,699] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/authenticationendpoint]
[2017-02-22 06:04:46,719] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/oauth2]
[2017-02-22 06:04:46,735] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/am/sample/pizzashack/v1]
[2017-02-22 06:04:46,756] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/client-registration/v0.11]
[2017-02-22 06:04:46,764] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/admin]
[2017-02-22 06:04:46,775] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/portal]
[2017-02-22 06:04:46,783] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/store]
[2017-02-22 06:04:46,791] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/publisher]
[2017-02-22 06:04:46,791] INFO - ServerManagement All deployment tasks have been completed.
[2017-02-22 06:04:46,791] INFO - ServerManagement Waiting for server task completion...
[2017-02-22 06:04:46,805] INFO - ServerManagement All server tasks have been completed.
[2017-02-22 06:04:46,805] INFO - CarbonServerManager Shutting down WSO2 API Manager...
[2017-02-22 06:04:46,811] INFO - CarbonServerManager Shutting down OSGi framework...
[2017-02-22 06:04:54,812] INFO - CarbonEventManagementService Starting polling event receivers
[2017-02-22 06:05:15,404] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:05:15,412] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:05:17,532] WARN - AppDeployerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.synapse.service.SynapseAppDeployerService,
[2017-02-22 06:05:17,545] WARN - StartupFinalizerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.service.CappDeploymentService,org.wso2.carbon.server.admin.common.IServerAdmin,org.wso2.carbon.throttling.agent.ThrottlingAgent,
[2017-02-22 06:05:30,413] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:05:30,418] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:05:44,927] WARN - SynapseAppDeployerDSComponent Waiting for required OSGi services: org.wso2.carbon.message.processor.service.MessageProcessorDeployerService,org.wso2.carbon.message.store.service.MessageStoreDeployerService,org.wso2.carbon.proxyadmin.service.ProxyDeployerService,
[2017-02-22 06:05:45,415] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:05:45,420] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:00,419] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:00,421] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:15,422] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:15,423] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:17,531] WARN - AppDeployerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.synapse.service.SynapseAppDeployerService,
[2017-02-22 06:06:17,546] WARN - StartupFinalizerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.service.CappDeploymentService,org.wso2.carbon.server.admin.common.IServerAdmin,org.wso2.carbon.throttling.agent.ThrottlingAgent,
[2017-02-22 06:06:30,425] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:30,426] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:44,926] WARN - SynapseAppDeployerDSComponent Waiting for required OSGi services: org.wso2.carbon.message.processor.service.MessageProcessorDeployerService,org.wso2.carbon.message.store.service.MessageStoreDeployerService,org.wso2.carbon.proxyadmin.service.ProxyDeployerService,
[2017-02-22 06:06:45,428] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:45,428] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:00,430] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:00,431] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:15,434] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:15,434] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:17,531] WARN - AppDeployerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.synapse.service.SynapseAppDeployerService,
[2017-02-22 06:07:17,545] WARN - StartupFinalizerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.service.CappDeploymentService,org.wso2.carbon.server.admin.common.IServerAdmin,org.wso2.carbon.throttling.agent.ThrottlingAgent,
[2017-02-22 06:07:30,438] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:30,438] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:36,930] INFO - SynapseTaskManager Shutting down the task manager
[2017-02-22 06:07:44,926] WARN - SynapseAppDeployerDSComponent Waiting for required OSGi services: org.wso2.carbon.message.processor.service.MessageProcessorDeployerService,org.wso2.carbon.message.store.service.MessageStoreDeployerService,org.wso2.carbon.proxyadmin.service.ProxyDeployerService,
[2017-02-22 06:07:45,440] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:45,442] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:00,444] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:00,445] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:15,452] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:15,452] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:17,531] WARN - AppDeployerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.synapse.service.SynapseAppDeployerService,
[2017-02-22 06:08:17,545] WARN - StartupFinalizerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.service.CappDeploymentService,org.wso2.carbon.server.admin.common.IServerAdmin,org.wso2.carbon.throttling.agent.ThrottlingAgent,
[2017-02-22 06:08:30,456] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:30,456] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:44,927] WARN - SynapseAppDeployerDSComponent Waiting for required OSGi services: org.wso2.carbon.message.processor.service.MessageProcessorDeployerService,org.wso2.carbon.message.store.service.MessageStoreDeployerService,org.wso2.carbon.proxyadmin.service.ProxyDeployerService,
[2017-02-22 06:08:45,458] ERROR - BlockingConditionRetriever Exception when retrieving Blocking Conditions from remote endpoint
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:668)
at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:522)
at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:401)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:178)
at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:144)
at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:131)
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:610)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:445)
at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:863)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:106)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57)
at org.wso2.carbon.apimgt.gateway.throttling.util.BlockingConditionRetriever.retrieveBlockConditionsData(BlockingConditionRetriever.java:79)
at org.wso2.carbon.apimgt.gateway.throttling.util.BlockingConditionRetriever.loadBlockingConditionsFromWebService(BlockingConditionRetriever.java:105)
at org.wso2.carbon.apimgt.gateway.throttling.util.BlockingConditionRetriever.run(BlockingConditionRetriever.java:51)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
[2017-02-22 06:08:45,458] ERROR - KeyTemplateRetriever Exception when retrieving throttling data from remote endpoint
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:668)
at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:522)
at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:401)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:178)
at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:144)
at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:131)
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:610)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:445)
at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:863)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:106)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57)
at org.wso2.carbon.apimgt.gateway.throttling.util.KeyTemplateRetriever.retrieveKeyTemplateData(KeyTemplateRetriever.java:83)
at org.wso2.carbon.apimgt.gateway.throttling.util.KeyTemplateRetriever.loadKeyTemplatesFromWebService(KeyTemplateRetriever.java:111)
at org.wso2.carbon.apimgt.gateway.throttling.util.KeyTemplateRetriever.run(KeyTemplateRetriever.java:54)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
Exception in thread "Timer-5" java.lang.NullPointerException
at java.util.Objects.requireNonNull(Objects.java:203)
at java.util.Arrays$ArrayList.<init>(Arrays.java:3813)
at java.util.Arrays.asList(Arrays.java:3800)
at org.wso2.carbon.apimgt.gateway.throttling.util.KeyTemplateRetriever.loadKeyTemplatesFromWebService(KeyTemplateRetriever.java:111)
at org.wso2.carbon.apimgt.gateway.throttling.util.KeyTemplateRetriever.run(KeyTemplateRetriever.java:54)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
[2017-02-22 06:09:16,963] INFO - BinaryDataReceiverServiceComponent Binary Data Receiver server shutting down...
[2017-02-22 06:09:16,964] INFO - BinaryDataReceiver Stopping Binary Server..
[2017-02-22 06:09:17,531] WARN - AppDeployerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.synapse.service.SynapseAppDeployerService
``` | 2017/02/22 | [
"https://Stackoverflow.com/questions/42384492",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7602984/"
]
| This is because port 5672 is occupied at the time when the API Manager server starts up. You can have 2 options I can think of to proceed with,
1. Change the default port offset.
* You can either start the API manager server with -DportOffset=[offset] (ex- -DportOffset=1) or change the value in /repository/conf to a value other than 0 and start the server.
2. Stop the existing process of already occupied server
* Without worrying about port offset, you can run the API Manager server on 5672 port for AMQP transport.
* Search the process of occupied port (5672 in this case)
>
> netstat -nlp|grep 5672
>
>
>
Output should looks like something below
>
> tcp 0 0 0.0.0.0:5672 0.0.0.0:\* LISTEN 6187/java
>
>
>
* Kill the process
>
> kill -9 [Process\_ID]
>
>
>
(here, 6187)
Then start the server and you won't see the exception anymore. | Port 5672 is needed for API Manager, from your exception trace, that port is occupied by another process.
Normally [RabbitMQ uses 5672](https://stackoverflow.com/questions/12792856/what-ports-does-rabbitmq-use), if that's the case you have to shut down that process. If you have another API Manager running on the physical node, then you have to offset the port with `-DportOffset=1` |
42,384,492 | I am getting errors and warnings while trying to bring up WSO2 API Manager 2.1.0 for the first time. [CentOS Linux release 7.3.1611 (Core)]. Excerpts are given below. I have already tried the suggestions at: [Failed to start wso2 API Manager v2.0.0 on centos 7.0](https://stackoverflow.com/questions/38948303/failed-to-start-wso2-api-manager-v2-0-0-on-centos-7-0)
```
$ ./wso2server.sh
JAVA_HOME environment variable is set to /usr/java/jdk1.8.0_60
CARBON_HOME environment variable is set to /home/devwso2/wso2am-2.1.0
Using Java memory options: -Xms256m -Xmx1024m
[2017-02-22 06:03:46,688] INFO - QpidBundleActivator Setting BundleContext in PluginManager
[2017-02-22 06:03:48,217] INFO - CarbonCoreActivator Starting WSO2 Carbon...
[2017-02-22 06:03:48,217] INFO - CarbonCoreActivator Operating System : Linux 3.10.0-514.6.1.el7.x86_64, amd64
[2017-02-22 06:03:48,218] INFO - CarbonCoreActivator Java Home : /usr/java/jdk1.8.0_60/jre
[2017-02-22 06:03:48,218] INFO - CarbonCoreActivator Java Version : 1.8.0_60
[2017-02-22 06:03:48,218] INFO - CarbonCoreActivator Java VM : Java HotSpot(TM) 64-Bit Server VM 25.60-b23,Oracle Corporation
[2017-02-22 06:03:48,218] INFO - CarbonCoreActivator Carbon Home : /home/devwso2/wso2am-2.1.0
[2017-02-22 06:03:48,218] INFO - CarbonCoreActivator Java Temp Dir : /home/devwso2/wso2am-2.1.0/tmp
[2017-02-22 06:03:48,218] INFO - CarbonCoreActivator User : devwso2, en-US, UTC
[2017-02-22 06:03:48,387] WARN - ValidationResultPrinter Swap Memory size (MB): 0 of the system is below the recommended minimum size :2047
[2017-02-22 06:03:48,389] WARN - ValidationResultPrinter Carbon is configured to use the default keystore (wso2carbon.jks). To maximize security when deploying to a production environment, configure a new keystore with a unique password in the production server profile.
.....................
[2017-02-22 06:04:46,407] ERROR - Main Exception during startup. Triggering shutdown
org.wso2.andes.kernel.AndesException: Unable to initialise application registry
at org.wso2.andes.server.Broker.startupImpl(Broker.java:308)
at org.wso2.andes.server.Broker.startup(Broker.java:110)
at org.wso2.andes.server.Main.startBroker(Main.java:217)
at org.wso2.andes.server.Main.execute(Main.java:206)
at org.wso2.andes.server.Main.<init>(Main.java:54)
at org.wso2.andes.server.Main.main(Main.java:47)
at org.wso2.carbon.andes.internal.QpidServiceComponent.startAndesBroker(QpidServiceComponent.java:420)
at org.wso2.carbon.andes.internal.QpidServiceComponent.activate(QpidServiceComponent.java:165)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.eclipse.equinox.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:260)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:146)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:345)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:620)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:197)
at org.eclipse.equinox.internal.ds.Resolver.getEligible(Resolver.java:343)
at org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:222)
at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:107)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:861)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:819)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:771)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:214)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:433)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:451)
at org.wso2.carbon.server.admin.internal.ServerAdminServiceComponent.activate(ServerAdminServiceComponent.java:106)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.eclipse.equinox.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:260)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:146)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:345)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:620)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:197)
at org.eclipse.equinox.internal.ds.Resolver.getEligible(Resolver.java:343)
at org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:222)
at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:107)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:861)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:819)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:771)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:214)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:433)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:451)
at org.wso2.carbon.core.init.CarbonServerManager.initializeCarbon(CarbonServerManager.java:514)
at org.wso2.carbon.core.init.CarbonServerManager.start(CarbonServerManager.java:219)
at org.wso2.carbon.core.internal.CarbonCoreServiceComponent.activate(CarbonCoreServiceComponent.java:94)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.eclipse.equinox.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:260)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:146)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:345)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:620)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:197)
at org.eclipse.equinox.internal.ds.Resolver.getEligible(Resolver.java:343)
at org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:222)
at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:107)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:861)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:819)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:771)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:214)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:433)
at org.eclipse.equinox.http.servlet.internal.Activator.registerHttpService(Activator.java:81)
at org.eclipse.equinox.http.servlet.internal.Activator.addProxyServlet(Activator.java:60)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.init(ProxyServlet.java:40)
at org.wso2.carbon.tomcat.ext.servlet.DelegationServlet.init(DelegationServlet.java:38)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1269)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1182)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1072)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5368)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5660)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1571)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1561)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.wso2.andes.transport.TransportException: Could not bind to /0.0.0.0:5672
at org.wso2.andes.transport.network.mina.MinaNetworkTransport.accept(MinaNetworkTransport.java:147)
at org.wso2.andes.server.Broker.startAMQPListener(Broker.java:201)
at org.wso2.andes.server.Broker.startupImpl(Broker.java:295)
... 89 more
Caused by: java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at org.apache.mina.transport.socket.nio.SocketAcceptor.registerNew(SocketAcceptor.java:363)
at org.apache.mina.transport.socket.nio.SocketAcceptor.access$800(SocketAcceptor.java:55)
at org.apache.mina.transport.socket.nio.SocketAcceptor$Worker.run(SocketAcceptor.java:222)
at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51)
... 1 more
[2017-02-22 06:04:46,415] INFO - ApplicationRegistry Shutting down ApplicationRegistry(org.wso2.andes.server.registry.ConfigurationFileApplicationRegistry@1524f58a)
[2017-02-22 06:04:46,415] INFO - ApplicationRegistry Shutting down ApplicationRegistry:org.wso2.andes.server.registry.ConfigurationFileApplicationRegistry@1524f58a
[2017-02-22 06:04:46,418] INFO - PrincipalDatabaseAuthenticationManager Unregistering UserManagementMBean
[2017-02-22 06:04:46,421] INFO - CarbonServerManager Shutdown hook triggered....
[2017-02-22 06:04:46,426] INFO - CarbonServerManager Gracefully shutting down WSO2 API Manager...
[2017-02-22 06:04:46,428] INFO - ServerManagement Starting to switch to maintenance mode...
[2017-02-22 06:04:46,429] INFO - ServerManagement Stopped all transport listeners
[2017-02-22 06:04:46,429] INFO - ServerManagement Waiting for request service completion...
[2017-02-22 06:04:46,435] INFO - ServerManagement All requests have been served.
[2017-02-22 06:04:46,435] INFO - ServerManagement Waiting for deployment completion...
[2017-02-22 06:04:46,491] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/api/am/admin/v0.11]
[2017-02-22 06:04:46,536] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/throttle/data/v1]
[2017-02-22 06:04:46,566] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/am/sample/calculator/v1]
[2017-02-22 06:04:46,627] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/shindig]
[2017-02-22 06:04:46,653] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/api/am/publisher/v0.11]
[2017-02-22 06:04:46,682] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/api/am/store/v0.11]
[2017-02-22 06:04:46,699] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/authenticationendpoint]
[2017-02-22 06:04:46,719] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/oauth2]
[2017-02-22 06:04:46,735] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/am/sample/pizzashack/v1]
[2017-02-22 06:04:46,756] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/client-registration/v0.11]
[2017-02-22 06:04:46,764] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/admin]
[2017-02-22 06:04:46,775] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/portal]
[2017-02-22 06:04:46,783] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/store]
[2017-02-22 06:04:46,791] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/publisher]
[2017-02-22 06:04:46,791] INFO - ServerManagement All deployment tasks have been completed.
[2017-02-22 06:04:46,791] INFO - ServerManagement Waiting for server task completion...
[2017-02-22 06:04:46,805] INFO - ServerManagement All server tasks have been completed.
[2017-02-22 06:04:46,805] INFO - CarbonServerManager Shutting down WSO2 API Manager...
[2017-02-22 06:04:46,811] INFO - CarbonServerManager Shutting down OSGi framework...
[2017-02-22 06:04:54,812] INFO - CarbonEventManagementService Starting polling event receivers
[2017-02-22 06:05:15,404] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:05:15,412] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:05:17,532] WARN - AppDeployerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.synapse.service.SynapseAppDeployerService,
[2017-02-22 06:05:17,545] WARN - StartupFinalizerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.service.CappDeploymentService,org.wso2.carbon.server.admin.common.IServerAdmin,org.wso2.carbon.throttling.agent.ThrottlingAgent,
[2017-02-22 06:05:30,413] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:05:30,418] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:05:44,927] WARN - SynapseAppDeployerDSComponent Waiting for required OSGi services: org.wso2.carbon.message.processor.service.MessageProcessorDeployerService,org.wso2.carbon.message.store.service.MessageStoreDeployerService,org.wso2.carbon.proxyadmin.service.ProxyDeployerService,
[2017-02-22 06:05:45,415] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:05:45,420] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:00,419] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:00,421] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:15,422] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:15,423] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:17,531] WARN - AppDeployerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.synapse.service.SynapseAppDeployerService,
[2017-02-22 06:06:17,546] WARN - StartupFinalizerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.service.CappDeploymentService,org.wso2.carbon.server.admin.common.IServerAdmin,org.wso2.carbon.throttling.agent.ThrottlingAgent,
[2017-02-22 06:06:30,425] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:30,426] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:44,926] WARN - SynapseAppDeployerDSComponent Waiting for required OSGi services: org.wso2.carbon.message.processor.service.MessageProcessorDeployerService,org.wso2.carbon.message.store.service.MessageStoreDeployerService,org.wso2.carbon.proxyadmin.service.ProxyDeployerService,
[2017-02-22 06:06:45,428] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:45,428] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:00,430] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:00,431] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:15,434] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:15,434] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:17,531] WARN - AppDeployerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.synapse.service.SynapseAppDeployerService,
[2017-02-22 06:07:17,545] WARN - StartupFinalizerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.service.CappDeploymentService,org.wso2.carbon.server.admin.common.IServerAdmin,org.wso2.carbon.throttling.agent.ThrottlingAgent,
[2017-02-22 06:07:30,438] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:30,438] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:36,930] INFO - SynapseTaskManager Shutting down the task manager
[2017-02-22 06:07:44,926] WARN - SynapseAppDeployerDSComponent Waiting for required OSGi services: org.wso2.carbon.message.processor.service.MessageProcessorDeployerService,org.wso2.carbon.message.store.service.MessageStoreDeployerService,org.wso2.carbon.proxyadmin.service.ProxyDeployerService,
[2017-02-22 06:07:45,440] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:45,442] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:00,444] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:00,445] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:15,452] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:15,452] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:17,531] WARN - AppDeployerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.synapse.service.SynapseAppDeployerService,
[2017-02-22 06:08:17,545] WARN - StartupFinalizerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.service.CappDeploymentService,org.wso2.carbon.server.admin.common.IServerAdmin,org.wso2.carbon.throttling.agent.ThrottlingAgent,
[2017-02-22 06:08:30,456] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:30,456] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:44,927] WARN - SynapseAppDeployerDSComponent Waiting for required OSGi services: org.wso2.carbon.message.processor.service.MessageProcessorDeployerService,org.wso2.carbon.message.store.service.MessageStoreDeployerService,org.wso2.carbon.proxyadmin.service.ProxyDeployerService,
[2017-02-22 06:08:45,458] ERROR - BlockingConditionRetriever Exception when retrieving Blocking Conditions from remote endpoint
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:668)
at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:522)
at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:401)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:178)
at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:144)
at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:131)
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:610)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:445)
at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:863)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:106)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57)
at org.wso2.carbon.apimgt.gateway.throttling.util.BlockingConditionRetriever.retrieveBlockConditionsData(BlockingConditionRetriever.java:79)
at org.wso2.carbon.apimgt.gateway.throttling.util.BlockingConditionRetriever.loadBlockingConditionsFromWebService(BlockingConditionRetriever.java:105)
at org.wso2.carbon.apimgt.gateway.throttling.util.BlockingConditionRetriever.run(BlockingConditionRetriever.java:51)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
[2017-02-22 06:08:45,458] ERROR - KeyTemplateRetriever Exception when retrieving throttling data from remote endpoint
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:668)
at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:522)
at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:401)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:178)
at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:144)
at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:131)
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:610)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:445)
at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:863)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:106)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57)
at org.wso2.carbon.apimgt.gateway.throttling.util.KeyTemplateRetriever.retrieveKeyTemplateData(KeyTemplateRetriever.java:83)
at org.wso2.carbon.apimgt.gateway.throttling.util.KeyTemplateRetriever.loadKeyTemplatesFromWebService(KeyTemplateRetriever.java:111)
at org.wso2.carbon.apimgt.gateway.throttling.util.KeyTemplateRetriever.run(KeyTemplateRetriever.java:54)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
Exception in thread "Timer-5" java.lang.NullPointerException
at java.util.Objects.requireNonNull(Objects.java:203)
at java.util.Arrays$ArrayList.<init>(Arrays.java:3813)
at java.util.Arrays.asList(Arrays.java:3800)
at org.wso2.carbon.apimgt.gateway.throttling.util.KeyTemplateRetriever.loadKeyTemplatesFromWebService(KeyTemplateRetriever.java:111)
at org.wso2.carbon.apimgt.gateway.throttling.util.KeyTemplateRetriever.run(KeyTemplateRetriever.java:54)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
[2017-02-22 06:09:16,963] INFO - BinaryDataReceiverServiceComponent Binary Data Receiver server shutting down...
[2017-02-22 06:09:16,964] INFO - BinaryDataReceiver Stopping Binary Server..
[2017-02-22 06:09:17,531] WARN - AppDeployerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.synapse.service.SynapseAppDeployerService
``` | 2017/02/22 | [
"https://Stackoverflow.com/questions/42384492",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7602984/"
]
| I was trying from long time. RMQ was running in my system.
Got to **C:\Program Files (x86)\RabbitMQ Server\rabbitmq\_server-3.3.4\sbin** and run
```
rabbitmq-service.bat stop
``` | As Tanvi and Abimaran said, Port 5672 is used for queuing. It's very common to get this error when configuring two nodes in one machine for trying cluster. If this port has been used by another application, and you can't shut that application down, then you can change
```
connectionfactory.TopicConnectionFactory = amqp://admin:admin@clientid/carbon?brokerlist='tcp://localhost:5672'
connectionfactory.QueueConnectionFactory = amqp://admin:admin@clientID/test?brokerlist='tcp://localhost:5672'
```
to another port for API manager in (/repository/config/jndi.properties). |
42,384,492 | I am getting errors and warnings while trying to bring up WSO2 API Manager 2.1.0 for the first time. [CentOS Linux release 7.3.1611 (Core)]. Excerpts are given below. I have already tried the suggestions at: [Failed to start wso2 API Manager v2.0.0 on centos 7.0](https://stackoverflow.com/questions/38948303/failed-to-start-wso2-api-manager-v2-0-0-on-centos-7-0)
```
$ ./wso2server.sh
JAVA_HOME environment variable is set to /usr/java/jdk1.8.0_60
CARBON_HOME environment variable is set to /home/devwso2/wso2am-2.1.0
Using Java memory options: -Xms256m -Xmx1024m
[2017-02-22 06:03:46,688] INFO - QpidBundleActivator Setting BundleContext in PluginManager
[2017-02-22 06:03:48,217] INFO - CarbonCoreActivator Starting WSO2 Carbon...
[2017-02-22 06:03:48,217] INFO - CarbonCoreActivator Operating System : Linux 3.10.0-514.6.1.el7.x86_64, amd64
[2017-02-22 06:03:48,218] INFO - CarbonCoreActivator Java Home : /usr/java/jdk1.8.0_60/jre
[2017-02-22 06:03:48,218] INFO - CarbonCoreActivator Java Version : 1.8.0_60
[2017-02-22 06:03:48,218] INFO - CarbonCoreActivator Java VM : Java HotSpot(TM) 64-Bit Server VM 25.60-b23,Oracle Corporation
[2017-02-22 06:03:48,218] INFO - CarbonCoreActivator Carbon Home : /home/devwso2/wso2am-2.1.0
[2017-02-22 06:03:48,218] INFO - CarbonCoreActivator Java Temp Dir : /home/devwso2/wso2am-2.1.0/tmp
[2017-02-22 06:03:48,218] INFO - CarbonCoreActivator User : devwso2, en-US, UTC
[2017-02-22 06:03:48,387] WARN - ValidationResultPrinter Swap Memory size (MB): 0 of the system is below the recommended minimum size :2047
[2017-02-22 06:03:48,389] WARN - ValidationResultPrinter Carbon is configured to use the default keystore (wso2carbon.jks). To maximize security when deploying to a production environment, configure a new keystore with a unique password in the production server profile.
.....................
[2017-02-22 06:04:46,407] ERROR - Main Exception during startup. Triggering shutdown
org.wso2.andes.kernel.AndesException: Unable to initialise application registry
at org.wso2.andes.server.Broker.startupImpl(Broker.java:308)
at org.wso2.andes.server.Broker.startup(Broker.java:110)
at org.wso2.andes.server.Main.startBroker(Main.java:217)
at org.wso2.andes.server.Main.execute(Main.java:206)
at org.wso2.andes.server.Main.<init>(Main.java:54)
at org.wso2.andes.server.Main.main(Main.java:47)
at org.wso2.carbon.andes.internal.QpidServiceComponent.startAndesBroker(QpidServiceComponent.java:420)
at org.wso2.carbon.andes.internal.QpidServiceComponent.activate(QpidServiceComponent.java:165)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.eclipse.equinox.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:260)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:146)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:345)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:620)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:197)
at org.eclipse.equinox.internal.ds.Resolver.getEligible(Resolver.java:343)
at org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:222)
at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:107)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:861)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:819)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:771)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:214)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:433)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:451)
at org.wso2.carbon.server.admin.internal.ServerAdminServiceComponent.activate(ServerAdminServiceComponent.java:106)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.eclipse.equinox.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:260)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:146)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:345)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:620)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:197)
at org.eclipse.equinox.internal.ds.Resolver.getEligible(Resolver.java:343)
at org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:222)
at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:107)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:861)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:819)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:771)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:214)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:433)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:451)
at org.wso2.carbon.core.init.CarbonServerManager.initializeCarbon(CarbonServerManager.java:514)
at org.wso2.carbon.core.init.CarbonServerManager.start(CarbonServerManager.java:219)
at org.wso2.carbon.core.internal.CarbonCoreServiceComponent.activate(CarbonCoreServiceComponent.java:94)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.eclipse.equinox.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:260)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:146)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:345)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:620)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:197)
at org.eclipse.equinox.internal.ds.Resolver.getEligible(Resolver.java:343)
at org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:222)
at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:107)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:861)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:819)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:771)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:214)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:433)
at org.eclipse.equinox.http.servlet.internal.Activator.registerHttpService(Activator.java:81)
at org.eclipse.equinox.http.servlet.internal.Activator.addProxyServlet(Activator.java:60)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.init(ProxyServlet.java:40)
at org.wso2.carbon.tomcat.ext.servlet.DelegationServlet.init(DelegationServlet.java:38)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1269)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1182)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1072)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5368)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5660)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1571)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1561)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.wso2.andes.transport.TransportException: Could not bind to /0.0.0.0:5672
at org.wso2.andes.transport.network.mina.MinaNetworkTransport.accept(MinaNetworkTransport.java:147)
at org.wso2.andes.server.Broker.startAMQPListener(Broker.java:201)
at org.wso2.andes.server.Broker.startupImpl(Broker.java:295)
... 89 more
Caused by: java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at org.apache.mina.transport.socket.nio.SocketAcceptor.registerNew(SocketAcceptor.java:363)
at org.apache.mina.transport.socket.nio.SocketAcceptor.access$800(SocketAcceptor.java:55)
at org.apache.mina.transport.socket.nio.SocketAcceptor$Worker.run(SocketAcceptor.java:222)
at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51)
... 1 more
[2017-02-22 06:04:46,415] INFO - ApplicationRegistry Shutting down ApplicationRegistry(org.wso2.andes.server.registry.ConfigurationFileApplicationRegistry@1524f58a)
[2017-02-22 06:04:46,415] INFO - ApplicationRegistry Shutting down ApplicationRegistry:org.wso2.andes.server.registry.ConfigurationFileApplicationRegistry@1524f58a
[2017-02-22 06:04:46,418] INFO - PrincipalDatabaseAuthenticationManager Unregistering UserManagementMBean
[2017-02-22 06:04:46,421] INFO - CarbonServerManager Shutdown hook triggered....
[2017-02-22 06:04:46,426] INFO - CarbonServerManager Gracefully shutting down WSO2 API Manager...
[2017-02-22 06:04:46,428] INFO - ServerManagement Starting to switch to maintenance mode...
[2017-02-22 06:04:46,429] INFO - ServerManagement Stopped all transport listeners
[2017-02-22 06:04:46,429] INFO - ServerManagement Waiting for request service completion...
[2017-02-22 06:04:46,435] INFO - ServerManagement All requests have been served.
[2017-02-22 06:04:46,435] INFO - ServerManagement Waiting for deployment completion...
[2017-02-22 06:04:46,491] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/api/am/admin/v0.11]
[2017-02-22 06:04:46,536] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/throttle/data/v1]
[2017-02-22 06:04:46,566] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/am/sample/calculator/v1]
[2017-02-22 06:04:46,627] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/shindig]
[2017-02-22 06:04:46,653] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/api/am/publisher/v0.11]
[2017-02-22 06:04:46,682] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/api/am/store/v0.11]
[2017-02-22 06:04:46,699] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/authenticationendpoint]
[2017-02-22 06:04:46,719] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/oauth2]
[2017-02-22 06:04:46,735] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/am/sample/pizzashack/v1]
[2017-02-22 06:04:46,756] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/client-registration/v0.11]
[2017-02-22 06:04:46,764] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/admin]
[2017-02-22 06:04:46,775] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/portal]
[2017-02-22 06:04:46,783] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/store]
[2017-02-22 06:04:46,791] INFO - WebApplication Unloaded webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/publisher]
[2017-02-22 06:04:46,791] INFO - ServerManagement All deployment tasks have been completed.
[2017-02-22 06:04:46,791] INFO - ServerManagement Waiting for server task completion...
[2017-02-22 06:04:46,805] INFO - ServerManagement All server tasks have been completed.
[2017-02-22 06:04:46,805] INFO - CarbonServerManager Shutting down WSO2 API Manager...
[2017-02-22 06:04:46,811] INFO - CarbonServerManager Shutting down OSGi framework...
[2017-02-22 06:04:54,812] INFO - CarbonEventManagementService Starting polling event receivers
[2017-02-22 06:05:15,404] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:05:15,412] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:05:17,532] WARN - AppDeployerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.synapse.service.SynapseAppDeployerService,
[2017-02-22 06:05:17,545] WARN - StartupFinalizerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.service.CappDeploymentService,org.wso2.carbon.server.admin.common.IServerAdmin,org.wso2.carbon.throttling.agent.ThrottlingAgent,
[2017-02-22 06:05:30,413] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:05:30,418] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:05:44,927] WARN - SynapseAppDeployerDSComponent Waiting for required OSGi services: org.wso2.carbon.message.processor.service.MessageProcessorDeployerService,org.wso2.carbon.message.store.service.MessageStoreDeployerService,org.wso2.carbon.proxyadmin.service.ProxyDeployerService,
[2017-02-22 06:05:45,415] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:05:45,420] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:00,419] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:00,421] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:15,422] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:15,423] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:17,531] WARN - AppDeployerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.synapse.service.SynapseAppDeployerService,
[2017-02-22 06:06:17,546] WARN - StartupFinalizerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.service.CappDeploymentService,org.wso2.carbon.server.admin.common.IServerAdmin,org.wso2.carbon.throttling.agent.ThrottlingAgent,
[2017-02-22 06:06:30,425] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:30,426] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:44,926] WARN - SynapseAppDeployerDSComponent Waiting for required OSGi services: org.wso2.carbon.message.processor.service.MessageProcessorDeployerService,org.wso2.carbon.message.store.service.MessageStoreDeployerService,org.wso2.carbon.proxyadmin.service.ProxyDeployerService,
[2017-02-22 06:06:45,428] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:06:45,428] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:00,430] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:00,431] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:15,434] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:15,434] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:17,531] WARN - AppDeployerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.synapse.service.SynapseAppDeployerService,
[2017-02-22 06:07:17,545] WARN - StartupFinalizerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.service.CappDeploymentService,org.wso2.carbon.server.admin.common.IServerAdmin,org.wso2.carbon.throttling.agent.ThrottlingAgent,
[2017-02-22 06:07:30,438] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:30,438] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:36,930] INFO - SynapseTaskManager Shutting down the task manager
[2017-02-22 06:07:44,926] WARN - SynapseAppDeployerDSComponent Waiting for required OSGi services: org.wso2.carbon.message.processor.service.MessageProcessorDeployerService,org.wso2.carbon.message.store.service.MessageStoreDeployerService,org.wso2.carbon.proxyadmin.service.ProxyDeployerService,
[2017-02-22 06:07:45,440] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:07:45,442] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:00,444] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:00,445] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:15,452] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:15,452] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:17,531] WARN - AppDeployerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.synapse.service.SynapseAppDeployerService,
[2017-02-22 06:08:17,545] WARN - StartupFinalizerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.service.CappDeploymentService,org.wso2.carbon.server.admin.common.IServerAdmin,org.wso2.carbon.throttling.agent.ThrottlingAgent,
[2017-02-22 06:08:30,456] WARN - KeyTemplateRetriever Failed retrieving throttling data from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:30,456] WARN - BlockingConditionRetriever Failed retrieving Blocking Conditions from remote endpoint: Connection refused. Retrying after 15 seconds...
[2017-02-22 06:08:44,927] WARN - SynapseAppDeployerDSComponent Waiting for required OSGi services: org.wso2.carbon.message.processor.service.MessageProcessorDeployerService,org.wso2.carbon.message.store.service.MessageStoreDeployerService,org.wso2.carbon.proxyadmin.service.ProxyDeployerService,
[2017-02-22 06:08:45,458] ERROR - BlockingConditionRetriever Exception when retrieving Blocking Conditions from remote endpoint
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:668)
at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:522)
at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:401)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:178)
at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:144)
at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:131)
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:610)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:445)
at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:863)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:106)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57)
at org.wso2.carbon.apimgt.gateway.throttling.util.BlockingConditionRetriever.retrieveBlockConditionsData(BlockingConditionRetriever.java:79)
at org.wso2.carbon.apimgt.gateway.throttling.util.BlockingConditionRetriever.loadBlockingConditionsFromWebService(BlockingConditionRetriever.java:105)
at org.wso2.carbon.apimgt.gateway.throttling.util.BlockingConditionRetriever.run(BlockingConditionRetriever.java:51)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
[2017-02-22 06:08:45,458] ERROR - KeyTemplateRetriever Exception when retrieving throttling data from remote endpoint
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:668)
at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:522)
at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:401)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:178)
at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:144)
at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:131)
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:610)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:445)
at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:863)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:106)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57)
at org.wso2.carbon.apimgt.gateway.throttling.util.KeyTemplateRetriever.retrieveKeyTemplateData(KeyTemplateRetriever.java:83)
at org.wso2.carbon.apimgt.gateway.throttling.util.KeyTemplateRetriever.loadKeyTemplatesFromWebService(KeyTemplateRetriever.java:111)
at org.wso2.carbon.apimgt.gateway.throttling.util.KeyTemplateRetriever.run(KeyTemplateRetriever.java:54)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
Exception in thread "Timer-5" java.lang.NullPointerException
at java.util.Objects.requireNonNull(Objects.java:203)
at java.util.Arrays$ArrayList.<init>(Arrays.java:3813)
at java.util.Arrays.asList(Arrays.java:3800)
at org.wso2.carbon.apimgt.gateway.throttling.util.KeyTemplateRetriever.loadKeyTemplatesFromWebService(KeyTemplateRetriever.java:111)
at org.wso2.carbon.apimgt.gateway.throttling.util.KeyTemplateRetriever.run(KeyTemplateRetriever.java:54)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
[2017-02-22 06:09:16,963] INFO - BinaryDataReceiverServiceComponent Binary Data Receiver server shutting down...
[2017-02-22 06:09:16,964] INFO - BinaryDataReceiver Stopping Binary Server..
[2017-02-22 06:09:17,531] WARN - AppDeployerServiceComponent Waiting for required OSGi services: org.wso2.carbon.application.deployer.synapse.service.SynapseAppDeployerService
``` | 2017/02/22 | [
"https://Stackoverflow.com/questions/42384492",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7602984/"
]
| I was trying from long time. RMQ was running in my system.
Got to **C:\Program Files (x86)\RabbitMQ Server\rabbitmq\_server-3.3.4\sbin** and run
```
rabbitmq-service.bat stop
``` | Port 5672 is needed for API Manager, from your exception trace, that port is occupied by another process.
Normally [RabbitMQ uses 5672](https://stackoverflow.com/questions/12792856/what-ports-does-rabbitmq-use), if that's the case you have to shut down that process. If you have another API Manager running on the physical node, then you have to offset the port with `-DportOffset=1` |
28,013,648 | I built a layout like this in XML say "block.xml"

Now, i want to create an XML like this 
so that i can access each block as an array. Can somebody tell me how can i use block.xml as a template to generate my new xml file to be put as a UI part in android. Thank You
Just to be sure , i want to use table layout i dont know how to procees. | 2015/01/18 | [
"https://Stackoverflow.com/questions/28013648",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2481681/"
]
| In your layout xml you may use the include tag and re-use your block.xml
as:
```
<include
android:id="@+id/block1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
layout="@layout/block" />
```
And in your java code you can access views from block.xml as
```
View firstBlock = findViewById( R.id.block1 );
View blockButton = firstBlock.findViewById( R.id.someButtonId );
``` | You should inflate and add the sub layouts programmatically.
This link has example code:
[Android using layouts as a template for creating multiple layout instances](https://stackoverflow.com/questions/7916527/android-using-layouts-as-a-template-for-creating-multiple-layout-instances/7917040#7917040) |
32,040,562 | I installed VS Code to try it out. I hit Ctrl+Shift+B on a .ts file. The first time, it asked me to set up a build task, which I did. Now, I build again and it does nothing. I get no errors or warnings but no .js file either. An ideas what I missed?
tasks.json
```
{
"version": "0.1.0",
// The command is tsc. Assumes that tsc has been installed using npm install -g typescript
"command": "tsc",
// The command is a shell script
"isShellCommand": true,
// Show the output window only if unrecognized errors occur.
"showOutput": "silent",
// args is the program to compile.
"args": ["app.ts"],
// use the standard tsc problem matcher to find compile problems
// in the output.
"problemMatcher": "$tsc"
}
```
tsconfig.json
```
{
"compilerOptions": {
"target" : "ESS",
"module": "amd",
"sourceMap": true
}
}
``` | 2015/08/16 | [
"https://Stackoverflow.com/questions/32040562",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5181338/"
]
| This error raised because the `data` is a unicode/str variable, change the second line of your code to resolve your error:
```
data = json.loads(data)
```
`json.load` get a file object in first parameter position and call the `read` method of this.
Also you can call the `json` method of the response to fetch data directly:
```
response = requests.get('http://ws.audioscrobbler.com/2.0/?method=library.getartists&api_key=4c22bd45cf5aa6e408e02b3fc1bff690&user=joanofarctan&format=json')
data = response.json()
``` | [`requests.get(…).text`](http://www.python-requests.org/en/latest/api/#requests.Response.text) returns the content as a single (unicode) string. The [`json.load()`](https://docs.python.org/3/library/json.html#json.load) function however requires a file-like argument.
The solution is rather simple: Just use [`loads`](https://docs.python.org/3/library/json.html#json.loads) instead of `load`:
```
data = json.loads(data)
```
An even better solution though is to simply call [`json()`](http://www.python-requests.org/en/latest/api/#requests.Response.json) on the response object directly. So don’t use `.text` but `.json()`:
```
data = requests.get(…).json()
```
While this uses `json.loads` itself internally, it hides that implementation detail, so you can just focus on getting the JSON response. |
58,321,528 | Before posting this question, I have already read some documentation, [SO answers](https://stackoverflow.com/a/1306445/2386113) and watched some videos to understand `__stdcall`. So far I have understood that it's a calling convention and specifies to push parameters from right to left on the stack. This also signifies when to clear the stack.
But I am still not able to understand the advantage and cases where I should use `__stdcall`.
I have come across the following code, which is called when an OPC-UA client is closed. I see that this should follow the `__stdcall` calling convention but why? What may have happened if `__stdcall` was not specified for the following method?
```
OpcUa_StatusCode __stdcall opcua_client::onShutdownMessage(OpcUa_Handle hApplication, OpcUa_Handle hSession, OpcUa_String strShutdownMessage, void* extraParam)
{
opcua_client* pOpcClient = NULL;
if (extraParam)
{
try
{
pOpcClient = qobject_cast <opcua_client*>((QObject*)extraParam);
throw(55);
}
catch (int exeption)
{
}
}
OpcUa_StatusCode uStatus = OpcUa_Good;
QString strShutDownMsg = QString::fromUtf8(OpcUa_String_GetRawString(&strShutdownMessage));
bool bOK;
OpcUa_StatusCode uClientLibStatus = uClientLibStatus = strShutDownMsg.toUInt(&bOK, 16);
if (pOpcClient)
{
if (uClientLibStatus > 0)
pOpcClient->process_onShutdownMessage(uClientLibStatus);
}
else
{
return uStatus;
}
return uStatus;
}
``` | 2019/10/10 | [
"https://Stackoverflow.com/questions/58321528",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2386113/"
]
| `opcua_client::onShutdownMessage` looks like callback function. That is, a function that is sent to some API which calls the function at a later time. The callback function must then have the calling convention expected by the API, in this case `__stdcall`. Since `__stdcall` is the default calling convention on the Win32 platform, it does not have to be specified when building for Win32. | Function calling convention must be followed by the caller. If it is there, then there must be some caller of this function that will assume it has to be called in a specific way. This is usually important when you have a callback function.
Other than that, `stdcall` is meant to reduce code size compared to `cdecl` by moving argument cleanup code from the caller to the callee (which can use [`ret imm16`](https://www.felixcloutier.com/x86/ret) on x86).
This is an old micro optimization for IA-32 architecture. MSVC accepts `__stdcall` keyword on other architectures too, but it [doesn't do anything there](https://learn.microsoft.com/en-us/cpp/cpp/stdcall?view=vs-2019).
Check this example:
```
__declspec(noinline) int sum(int a, int b)
{
return a + b;
}
int add1(int a)
{
return sum(a, 1);
}
```
MSVC compiles this to:
```
int sum(int,int) PROC
mov eax, DWORD PTR _a$[esp-4]
add eax, DWORD PTR _b$[esp-4]
ret 0 ; this instruction will be replaced
int sum(int,int) ENDP
int add1(int) PROC
push 1
push DWORD PTR _a$[esp]
call int sum(int,int)
add esp, 8 ; this instruction will be removed
ret 0
int add1(int) ENDP
```
And version with `stdcall`:
```
__declspec(noinline) int __stdcall sum(int a, int b)
{
return a + b;
}
int add1(int a)
{
return sum(a, 1);
}
```
which compiles to:
```
int sum(int,int) PROC
mov eax, DWORD PTR _a$[esp-4]
add eax, DWORD PTR _b$[esp-4]
ret 8 ; 0 argument replaced with 8
int sum(int,int) ENDP
int add1(int) PROC
push 1
push DWORD PTR _a$[esp]
call int sum(int,int)
ret 0 ; extra instruction is missing here
int add1(int) ENDP
```
Notice how the 2nd example uses `ret 8` and the caller doesn't have an additional `add esp, 8`. |
7,846,938 | I am working with spring and tried to add a custom Annotation to an Entity-Bean.
All I want to do is, accessing the fields with the custom annotation @ runtime via reflection.
The Problem is, that although there are more than one Annotation on the fields, none of them are accessable at runtime:
```
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface ChangeableField {
}
```
The entity:
```
public class Order {
@NotNull
@Temporal(TemporalType.TIMESTAMP)
@DateTimeFormat(pattern = "dd:MM:yyyy HH:mm")
@ChangeableField
private Date scheduledStart;
@NotNull
@Temporal(TemporalType.TIMESTAMP)
@DateTimeFormat(pattern = "dd:MM:yyyy HH:mm")
@ChangeableField
private Date scheduledEnd;
//...
}
```
I have absolutely no idea what to do
```
Order.class.getField("scheduledStart").getAnnotation(ChangableField.class);
```
returns always null. (BTW all declared annotations on this field are null)
Maybe it has something to do with spring?
I would appreciate any help!
Thanks in advance
EDIT
----
I don't know why but now it's working properly:
```
for (Field currentField : order.getClass().getDeclaredFields()) {
if (currentField.getAnnotation(ChangeableField.class) != null
&& map.containsKey(currentField.getName())) {
//..
```
Thanks for your help
BTW It was just a typo in this post here.. | 2011/10/21 | [
"https://Stackoverflow.com/questions/7846938",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/925622/"
]
| Try this:
```
Order.class
.getDeclaredField("scheduledStart")
.getAnnotation(ChangableField.class);
```
[`Class.getField(fieldname)`](http://download.oracle.com/javase/6/docs/api/java/lang/Class.html#getField%28java.lang.String%29) retrieves public fields of the class and all super classes. Your field is private, so you need [`Class.getDeclaredField(fieldname)`](http://download.oracle.com/javase/6/docs/api/java/lang/Class.html#getDeclaredField%28java.lang.String%29), which retrieves fields of all visibilities, but limited to this class only. | Your annotation is of class "ChangeableField", but you are retrieving "ChangableField" (note the missing "e"). Is this just a typo in the post, or are you not retrieving what you think you are ? |
359,952 | I'm trying to make an electromagnet that's strength is constantly getting incremented by small amounts every second. I need to know, which would have a greater effect on the electromagnet's strength, amps or volts? (I know increasing the turns and/or density of the magnet wire will increase the strength, but I am looking for answers other than that particular one.) | 2018/03/06 | [
"https://electronics.stackexchange.com/questions/359952",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/180226/"
]
| Firstly, voltage plays no part in the strength of an electromagnet, it's only the current through the windings that generate the field. Consider a super-conducting magnet with zero resistance windings. There's no voltage, no power dissipation, and a large magnetic field.
However, most of us don't have the luxury of using a super-conductor to wind our magnets, we have to make do with a good-conductor, like copper. As it has resistance, we need to apply a voltage across it to push a current through it. This results in bad things like heating in the coil, whose temperature needs to be limited if it's to keep working.
For any given wound magnet, we do not have independent control over voltage and current. The magnet coil defines the ratio of those, it's called its resistance. If we apply a voltage, then (voltage/resistance) current flows. If we connect a current source, then the voltage across the coil responds, and becomes (resistance \* current).
The limit for both voltage and current is given by the coil's cooling. If we operate the coil for a very short time, we can increase the power supply, and allow the heat to be stored as a temperature rise in the windings, as long as we switch off before the coil overheats, to let it cool down before the next pulse. | In reality - it's both. The strength depends on the current, and the current depends on the DIFFERENCE between the applied voltage (e.g. the battery) and the INDUCED voltage (how fast the electromagnet is moving in relation to whatever strength you mean - usually a permanent magnet).
If you move or spin an electromagnet within a magnetic field, that causes (induces) voltage to flow through the coil. The faster you spin/move, the higher the induced voltage. If you spin it fast enough, that induced voltage becomes equal to the battery voltage (which means **no** current can flow at all). If you spin it faster still, it generates even more voltage than the battery, and you end up with a *negative* strength (charges the battery - otherwise known as regenerative breaking).
Most motors using electromagnets carry a "KV" rating, which tells you the speed it needs to be going to induce 1 volt (or the opposite - multiply it by your battery voltage to work out the fastest speed it can turn).
So to answer your question - you need to know how fast things are moving - if it's slow, a low voltage is fine. If it's very fast, you'll need a high voltage. After that - the current changes the strength, OR, the amount of time you turn it on for changes the strength. Normally, you cannot easily "change the current" - instead - you use PWM switching to turn it on and off at full current for short amounts of time... |
59,489,803 | I am trying to click a button using selenium so I made it find the element with the xpath since i couldn't find the id . EDIT: I didn't think the rest of the code had anything to do with it but i added it just in case
This is The Code
```
import requests
import os
import selenium
from selenium import webdriver
os.system("cls")
print(" ")
print("______________ _____________ ________________")
print("| | | | | | | | |______________|")
print("| |________ // | | __ | | | |")
print("| |________ \\\\ | | |__| | | | |")
print("| | | | | | | | | |")
print("| |__________| | |__|_______|_| |_|")
print("\u001b[34m Welcome To Movie Downloader")
print("\u001b[31m Please Make Sure To Not Put Every First Letter In Every Word Capital And Also Make Sure To Put Hyphens Instead Of Spaces Between Words, Also Put The Date The Movie Was Made")
print("\u001b[32m For Example: spider-man-homecoming-2017")
def Bot():
URL = input("\u001b[34m What Movie Do You Want To Download:\n")
r = requests.get("https://bila.egy.best/movie/" + URL + "/?ref=search-p1")
if r.status_code == 200:
print("\u001b[32m The Url Is Valid | Movie Has Been Found")
else:
print("\u001b[31m The Url Is Invalid")
print("\u001b[0m")
driver = webdriver.Chrome(executable_path=r'C:\chromedriver.exe')
driver.get("https://bila.egy.best/movie/" + URL + "/?ref=search-p1")
driver.find_element_by_xpath("//*[@id=watch_dl]/table/tbody/tr[2]/td[4]/a[1]").click()
Answer = input("Would You Like To Bot?")
if Answer == "Yes" or "yes" or "sure" or "Sure":
Bot()
```
This Is The Error
```
Traceback (most recent call last):
File "Movie_Download.py", line 32, in <module>
Bot()
File "Movie_Download.py", line 27, in Bot
driver = webdriver.Chrome(executable_path="C:\chromedriver.exe")
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 81, in __init__
desired_capabilities=desired_capabilities)
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 157, in __init__
self.start_session(capabilities, browser_profile)
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Failed to create a Chrome process.
``` | 2019/12/26 | [
"https://Stackoverflow.com/questions/59489803",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
]
| You need to take care of a couple of things:
* While passing the *absolute location* of **chromedriver** binary use a single forward slash along with the raw i.e. `r` switch. So the effective line of code will be:
```
driver = webdriver.Chrome(executable_path=r'C:\chromedriver.exe')
```
* Execute your `@Test` as **non-administrator** / **non-root** user.
---
Update
------
Another possible reason is *Chrome* is not installed in the default location as per the specification:
[](https://i.stack.imgur.com/nD4a6.png)
Solution
--------
There can be two approaches to solve this situation:
* Uninstall *Chrome* and reinstall *Chrome* at default location.
* Use `binary_location` property to point to the *chrome* binary location.
```
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
options = Options()
options.binary_location = "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe"
driver = webdriver.Chrome(chrome_options=options, executable_path="C:/Utility/BrowserDrivers/chromedriver.exe", )
driver.get('http://google.com/')
``` | you have to edit
```
driver = webdriver.Chrome(executable_path="C:\chromedriver.exe")
```
to
```
driver = webdriver.Chrome(executable_path="C:\\chromedriver.exe")
```
you miss `\`
If you get the same error, try running as administrator
or
move `chromedriver.exe` to other path like `c:/seleniumdriver/chromedriver.exe"`and edit `executable_path` |
59,489,803 | I am trying to click a button using selenium so I made it find the element with the xpath since i couldn't find the id . EDIT: I didn't think the rest of the code had anything to do with it but i added it just in case
This is The Code
```
import requests
import os
import selenium
from selenium import webdriver
os.system("cls")
print(" ")
print("______________ _____________ ________________")
print("| | | | | | | | |______________|")
print("| |________ // | | __ | | | |")
print("| |________ \\\\ | | |__| | | | |")
print("| | | | | | | | | |")
print("| |__________| | |__|_______|_| |_|")
print("\u001b[34m Welcome To Movie Downloader")
print("\u001b[31m Please Make Sure To Not Put Every First Letter In Every Word Capital And Also Make Sure To Put Hyphens Instead Of Spaces Between Words, Also Put The Date The Movie Was Made")
print("\u001b[32m For Example: spider-man-homecoming-2017")
def Bot():
URL = input("\u001b[34m What Movie Do You Want To Download:\n")
r = requests.get("https://bila.egy.best/movie/" + URL + "/?ref=search-p1")
if r.status_code == 200:
print("\u001b[32m The Url Is Valid | Movie Has Been Found")
else:
print("\u001b[31m The Url Is Invalid")
print("\u001b[0m")
driver = webdriver.Chrome(executable_path=r'C:\chromedriver.exe')
driver.get("https://bila.egy.best/movie/" + URL + "/?ref=search-p1")
driver.find_element_by_xpath("//*[@id=watch_dl]/table/tbody/tr[2]/td[4]/a[1]").click()
Answer = input("Would You Like To Bot?")
if Answer == "Yes" or "yes" or "sure" or "Sure":
Bot()
```
This Is The Error
```
Traceback (most recent call last):
File "Movie_Download.py", line 32, in <module>
Bot()
File "Movie_Download.py", line 27, in Bot
driver = webdriver.Chrome(executable_path="C:\chromedriver.exe")
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 81, in __init__
desired_capabilities=desired_capabilities)
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 157, in __init__
self.start_session(capabilities, browser_profile)
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Failed to create a Chrome process.
``` | 2019/12/26 | [
"https://Stackoverflow.com/questions/59489803",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
]
| If you are still getting this error then try to reinstall your chrome
It worked for me, I got the same issue, I tried all of the ways but still cannot fix it but after I reinstall my chrome browser It Worked! | you have to edit
```
driver = webdriver.Chrome(executable_path="C:\chromedriver.exe")
```
to
```
driver = webdriver.Chrome(executable_path="C:\\chromedriver.exe")
```
you miss `\`
If you get the same error, try running as administrator
or
move `chromedriver.exe` to other path like `c:/seleniumdriver/chromedriver.exe"`and edit `executable_path` |
59,489,803 | I am trying to click a button using selenium so I made it find the element with the xpath since i couldn't find the id . EDIT: I didn't think the rest of the code had anything to do with it but i added it just in case
This is The Code
```
import requests
import os
import selenium
from selenium import webdriver
os.system("cls")
print(" ")
print("______________ _____________ ________________")
print("| | | | | | | | |______________|")
print("| |________ // | | __ | | | |")
print("| |________ \\\\ | | |__| | | | |")
print("| | | | | | | | | |")
print("| |__________| | |__|_______|_| |_|")
print("\u001b[34m Welcome To Movie Downloader")
print("\u001b[31m Please Make Sure To Not Put Every First Letter In Every Word Capital And Also Make Sure To Put Hyphens Instead Of Spaces Between Words, Also Put The Date The Movie Was Made")
print("\u001b[32m For Example: spider-man-homecoming-2017")
def Bot():
URL = input("\u001b[34m What Movie Do You Want To Download:\n")
r = requests.get("https://bila.egy.best/movie/" + URL + "/?ref=search-p1")
if r.status_code == 200:
print("\u001b[32m The Url Is Valid | Movie Has Been Found")
else:
print("\u001b[31m The Url Is Invalid")
print("\u001b[0m")
driver = webdriver.Chrome(executable_path=r'C:\chromedriver.exe')
driver.get("https://bila.egy.best/movie/" + URL + "/?ref=search-p1")
driver.find_element_by_xpath("//*[@id=watch_dl]/table/tbody/tr[2]/td[4]/a[1]").click()
Answer = input("Would You Like To Bot?")
if Answer == "Yes" or "yes" or "sure" or "Sure":
Bot()
```
This Is The Error
```
Traceback (most recent call last):
File "Movie_Download.py", line 32, in <module>
Bot()
File "Movie_Download.py", line 27, in Bot
driver = webdriver.Chrome(executable_path="C:\chromedriver.exe")
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 81, in __init__
desired_capabilities=desired_capabilities)
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 157, in __init__
self.start_session(capabilities, browser_profile)
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Failed to create a Chrome process.
``` | 2019/12/26 | [
"https://Stackoverflow.com/questions/59489803",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
]
| You need to take care of a couple of things:
* While passing the *absolute location* of **chromedriver** binary use a single forward slash along with the raw i.e. `r` switch. So the effective line of code will be:
```
driver = webdriver.Chrome(executable_path=r'C:\chromedriver.exe')
```
* Execute your `@Test` as **non-administrator** / **non-root** user.
---
Update
------
Another possible reason is *Chrome* is not installed in the default location as per the specification:
[](https://i.stack.imgur.com/nD4a6.png)
Solution
--------
There can be two approaches to solve this situation:
* Uninstall *Chrome* and reinstall *Chrome* at default location.
* Use `binary_location` property to point to the *chrome* binary location.
```
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
options = Options()
options.binary_location = "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe"
driver = webdriver.Chrome(chrome_options=options, executable_path="C:/Utility/BrowserDrivers/chromedriver.exe", )
driver.get('http://google.com/')
``` | If you are still getting this error then try to reinstall your chrome
It worked for me, I got the same issue, I tried all of the ways but still cannot fix it but after I reinstall my chrome browser It Worked! |
849,741 | Lately I am writing (or trying) an emulator for the 6502 NES CPU.
I am learning many many things, some of them really surprise me and I was wondering what's the explanation for those, in particular, two things came to my mind
1. The existence of bugs, in particular the 6502 seems to have a bug in the indirect addressing mode, at least for the first processors (it affects the one used in the NES)
2. Unofficial operation codes: Again, really surprising that there are codes not official yet usable, some of them seem to be totally useless (like DOP and TOP which are variations of NOP), and some of them seem to be composition of other operation codes (such SAX or DCP).
The question is, how is it possible that when manufacturing millions of those CPUs, they ended up with bugs (such the indirect addressing mode) and also, why on earth would you as a manufacturer include unofficial operation codes that may be removed in following revisions? Does this happen also with newer CPUs? | 2014/12/07 | [
"https://superuser.com/questions/849741",
"https://superuser.com",
"https://superuser.com/users/396856/"
]
| The comments thread had a bunch of useful troubleshooting tips but it turned out the issue was with the browser. I recommend having a spare, 'pristine' browser for testing, so if your mimetypes are messed up, you can still check. The OP installed opera and it worked, when firefox didn't. In his shoes, I might consider purging firefox - which eliminates all config files (though resetting it may work) and reinstalling.
Other things worth testing for (Via comments made by myself, [agtoever](https://superuser.com/users/352717/agtoever) and [Dragonlord](https://superuser.com/users/73918/dragonlord))
* Check if apache is running with `sudo service apache2 status`
* Check package installs `sudo apt-get install php5 libapache2-mod-php5` to make sure apache and the apache/php module is installed. If they are freshly installed, make sure apache is restarted with `sudo service apache2 restart`
* Make sure `mod_php5` is set up to load when Apache is started. There should be a file in `/etc/apache2/mods-enabled` called `php5.load` with the text `LoadModule php5_module /usr/lib/apache2/modules/libphp5.so` ([*source*](http://www.linuxquestions.org/questions/linux-newbie-8/loadmodule-php5_module-modules-libphp5-so-904468/#post4479560)). If not, you might want to add this line to `/etc/apache2/apache2.conf`:
```
LoadModule php5_module /usr/lib/apache2/modules/libphp5.so
```
* Check file permissions.
* `telnet 127.0.0.1 80` to do an oldschool web server test.After some output, type "GET" and enter. Also try this with "GET index.php". This checks if apache2 actually serves your processed php file
* Check the settings in Firefox and Bluefish. In bluefish go to Edit, Preferences, External Programs. Under Browsers, Mozilla & Opera's command should read: "firefox %s". In Firefox, go to Help, Troubleshooting Information, Profile Directory: Show Folder. Try to delete the mimeTypes.rdf file in the Firefox Profile Folder. | My problem was that I was running the PHP files from Bluefish, which sent them to Firefox and appeared in the URL bar as file:///var/www/html/index.php. This is incorrect for PHP files to run on the local machine. Instead, the URL should've read: localhost/index.php. This reflects my index.php file stored in /var/www/html. This is the only way on the local machine that the PHP interpreter will work. I hope this helps someone on down the road. |
849,741 | Lately I am writing (or trying) an emulator for the 6502 NES CPU.
I am learning many many things, some of them really surprise me and I was wondering what's the explanation for those, in particular, two things came to my mind
1. The existence of bugs, in particular the 6502 seems to have a bug in the indirect addressing mode, at least for the first processors (it affects the one used in the NES)
2. Unofficial operation codes: Again, really surprising that there are codes not official yet usable, some of them seem to be totally useless (like DOP and TOP which are variations of NOP), and some of them seem to be composition of other operation codes (such SAX or DCP).
The question is, how is it possible that when manufacturing millions of those CPUs, they ended up with bugs (such the indirect addressing mode) and also, why on earth would you as a manufacturer include unofficial operation codes that may be removed in following revisions? Does this happen also with newer CPUs? | 2014/12/07 | [
"https://superuser.com/questions/849741",
"https://superuser.com",
"https://superuser.com/users/396856/"
]
| The comments thread had a bunch of useful troubleshooting tips but it turned out the issue was with the browser. I recommend having a spare, 'pristine' browser for testing, so if your mimetypes are messed up, you can still check. The OP installed opera and it worked, when firefox didn't. In his shoes, I might consider purging firefox - which eliminates all config files (though resetting it may work) and reinstalling.
Other things worth testing for (Via comments made by myself, [agtoever](https://superuser.com/users/352717/agtoever) and [Dragonlord](https://superuser.com/users/73918/dragonlord))
* Check if apache is running with `sudo service apache2 status`
* Check package installs `sudo apt-get install php5 libapache2-mod-php5` to make sure apache and the apache/php module is installed. If they are freshly installed, make sure apache is restarted with `sudo service apache2 restart`
* Make sure `mod_php5` is set up to load when Apache is started. There should be a file in `/etc/apache2/mods-enabled` called `php5.load` with the text `LoadModule php5_module /usr/lib/apache2/modules/libphp5.so` ([*source*](http://www.linuxquestions.org/questions/linux-newbie-8/loadmodule-php5_module-modules-libphp5-so-904468/#post4479560)). If not, you might want to add this line to `/etc/apache2/apache2.conf`:
```
LoadModule php5_module /usr/lib/apache2/modules/libphp5.so
```
* Check file permissions.
* `telnet 127.0.0.1 80` to do an oldschool web server test.After some output, type "GET" and enter. Also try this with "GET index.php". This checks if apache2 actually serves your processed php file
* Check the settings in Firefox and Bluefish. In bluefish go to Edit, Preferences, External Programs. Under Browsers, Mozilla & Opera's command should read: "firefox %s". In Firefox, go to Help, Troubleshooting Information, Profile Directory: Show Folder. Try to delete the mimeTypes.rdf file in the Firefox Profile Folder. | Based on the above answers if you go into bluefish preferences and change firefox to "firefox -remote 'openURL(%p)' || firefox localhost/'%n'&" or make a new one called TestFox with that and set it to default if you want to be safe. It should then work like you want. |
849,741 | Lately I am writing (or trying) an emulator for the 6502 NES CPU.
I am learning many many things, some of them really surprise me and I was wondering what's the explanation for those, in particular, two things came to my mind
1. The existence of bugs, in particular the 6502 seems to have a bug in the indirect addressing mode, at least for the first processors (it affects the one used in the NES)
2. Unofficial operation codes: Again, really surprising that there are codes not official yet usable, some of them seem to be totally useless (like DOP and TOP which are variations of NOP), and some of them seem to be composition of other operation codes (such SAX or DCP).
The question is, how is it possible that when manufacturing millions of those CPUs, they ended up with bugs (such the indirect addressing mode) and also, why on earth would you as a manufacturer include unofficial operation codes that may be removed in following revisions? Does this happen also with newer CPUs? | 2014/12/07 | [
"https://superuser.com/questions/849741",
"https://superuser.com",
"https://superuser.com/users/396856/"
]
| My problem was that I was running the PHP files from Bluefish, which sent them to Firefox and appeared in the URL bar as file:///var/www/html/index.php. This is incorrect for PHP files to run on the local machine. Instead, the URL should've read: localhost/index.php. This reflects my index.php file stored in /var/www/html. This is the only way on the local machine that the PHP interpreter will work. I hope this helps someone on down the road. | Based on the above answers if you go into bluefish preferences and change firefox to "firefox -remote 'openURL(%p)' || firefox localhost/'%n'&" or make a new one called TestFox with that and set it to default if you want to be safe. It should then work like you want. |
6,190,900 | I have a simple ASP.NET page:
```
sub Page_Load
//Get data form databse and show it
end sub
sud deletsome(Source As Object, e As EventArgs)
//delete one record when user click on submit button
end sub
```
When I click the button, the page reload, all the data have no change, I must re-enter the page again, the record I have delete disappear.
Can you show me why?
The full code here:
```
<%@ Import Namespace="System.Data.OleDb" %>
<script runat="server">
sub Page_Load
dim dbconn,sql,dbcomm,dbread
dbconn=New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Persist Security Info=False;data source=" & server.mappath("/data/test.accdb"))
dbconn.Open()
sql="SELECT * FROM [user]"
dbcomm=New OleDbCommand(sql,dbconn)
dbread=dbcomm.ExecuteReader()
customers.DataSource=dbread
customers.DataBind()
dbread.Close()
dbconn.Close()
end sub
sub deletesome(Source As Object, e As EventArgs)
dim dbconn,sql,dbcomm
dbconn=New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Persist Security Info=False;data source=" & server.mappath("/data/test.accdb"))
dbconn.Open()
sql="DELETE FROM [user]WHERE id = @ID"
dbcomm=New OleDbCommand(sql,dbconn)
dbcomm.Parameters.AddWithValue("ID", tb1.Text)
dbcomm.ExecuteNonQuery()
end sub
</script>
<html>
<body>
<form runat="server">
<asp:TextBox id="tb1" runat="server" />
<asp:Button id="b1" Text="Submit" runat="server" OnClick="deletesome" />
<asp:Repeater id="customers" runat="server">
<HeaderTemplate>
<table border="1" width="100%">
<tr bgcolor="#b0c4de">
<th>ID</th>
<th>Address</th>
<th>City</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr bgcolor="#f0f0f0">
<td><%#Container.DataItem("id")%> </td>
<td><%#Container.DataItem("username")%> </td>
<td><%#Container.DataItem("userphone")%> </td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
</form>
<hr />
</body>
</html>
``` | 2011/05/31 | [
"https://Stackoverflow.com/questions/6190900",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/749854/"
]
| In asp page life cycle, page load happens before the button click (I know, it's kind of strange). The easiest work around is to place your code in the page "PreRender" event. | You have not added the `!IsPostBack` condition in your page load event. When you click the button your page's load event is first called before the click event handler and it will reload the data again. That's the issue.
It should be like...
```
sub Page_Load
IF(!IsPostBack) ' This condition will be true when the page loads the first time
dim dbconn,sql,dbcomm,dbread
dbconn=New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Persist Security Info=False;data source=" & server.mappath("/data/test.accdb"))
dbconn.Open()
sql="SELECT * FROM [user]"
dbcomm=New OleDbCommand(sql,dbconn)
dbread=dbcomm.ExecuteReader()
customers.DataSource=dbread
customers.DataBind()
dbread.Close()
dbconn.Close()
EndIf
end sub
``` |
6,190,900 | I have a simple ASP.NET page:
```
sub Page_Load
//Get data form databse and show it
end sub
sud deletsome(Source As Object, e As EventArgs)
//delete one record when user click on submit button
end sub
```
When I click the button, the page reload, all the data have no change, I must re-enter the page again, the record I have delete disappear.
Can you show me why?
The full code here:
```
<%@ Import Namespace="System.Data.OleDb" %>
<script runat="server">
sub Page_Load
dim dbconn,sql,dbcomm,dbread
dbconn=New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Persist Security Info=False;data source=" & server.mappath("/data/test.accdb"))
dbconn.Open()
sql="SELECT * FROM [user]"
dbcomm=New OleDbCommand(sql,dbconn)
dbread=dbcomm.ExecuteReader()
customers.DataSource=dbread
customers.DataBind()
dbread.Close()
dbconn.Close()
end sub
sub deletesome(Source As Object, e As EventArgs)
dim dbconn,sql,dbcomm
dbconn=New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Persist Security Info=False;data source=" & server.mappath("/data/test.accdb"))
dbconn.Open()
sql="DELETE FROM [user]WHERE id = @ID"
dbcomm=New OleDbCommand(sql,dbconn)
dbcomm.Parameters.AddWithValue("ID", tb1.Text)
dbcomm.ExecuteNonQuery()
end sub
</script>
<html>
<body>
<form runat="server">
<asp:TextBox id="tb1" runat="server" />
<asp:Button id="b1" Text="Submit" runat="server" OnClick="deletesome" />
<asp:Repeater id="customers" runat="server">
<HeaderTemplate>
<table border="1" width="100%">
<tr bgcolor="#b0c4de">
<th>ID</th>
<th>Address</th>
<th>City</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr bgcolor="#f0f0f0">
<td><%#Container.DataItem("id")%> </td>
<td><%#Container.DataItem("username")%> </td>
<td><%#Container.DataItem("userphone")%> </td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
</form>
<hr />
</body>
</html>
``` | 2011/05/31 | [
"https://Stackoverflow.com/questions/6190900",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/749854/"
]
| You have not added the `!IsPostBack` condition in your page load event. When you click the button your page's load event is first called before the click event handler and it will reload the data again. That's the issue.
It should be like...
```
sub Page_Load
IF(!IsPostBack) ' This condition will be true when the page loads the first time
dim dbconn,sql,dbcomm,dbread
dbconn=New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Persist Security Info=False;data source=" & server.mappath("/data/test.accdb"))
dbconn.Open()
sql="SELECT * FROM [user]"
dbcomm=New OleDbCommand(sql,dbconn)
dbread=dbcomm.ExecuteReader()
customers.DataSource=dbread
customers.DataBind()
dbread.Close()
dbconn.Close()
EndIf
end sub
``` | try this
```
<%@ Import Namespace="System.Data.OleDb" %>
<script runat="server">
sub Page_Load
If Page.IsPostBack = False Then
LoadData()
end sub
sub deletesome(Source As Object, e As EventArgs)
dim dbconn,sql,dbcomm
dbconn=New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Persist Security Info=False;data source=" & server.mappath("/data/test.accdb"))
dbconn.Open()
sql="DELETE FROM [user]WHERE id = @ID"
dbcomm=New OleDbCommand(sql,dbconn)
dbcomm.Parameters.AddWithValue("ID", tb1.Text)
dbcomm.ExecuteNonQuery()
LoadData()
end sub
sub LoadData
dim dbconn,sql,dbcomm,dbread
dbconn=New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Persist Security Info=False;data source=" & server.mappath("/data/test.accdb"))
dbconn.Open()
sql="SELECT * FROM [user]"
dbcomm=New OleDbCommand(sql,dbconn)
dbread=dbcomm.ExecuteReader()
customers.DataSource=dbread
customers.DataBind()
dbread.Close()
dbconn.Close()
end sub
</script>
<html>
<body>
<form runat="server">
<asp:TextBox id="tb1" runat="server" />
<asp:Button id="b1" Text="Submit" runat="server" OnClick="deletesome" />
<asp:Repeater id="customers" runat="server">
<HeaderTemplate>
<table border="1" width="100%">
<tr bgcolor="#b0c4de">
<th>ID</th>
<th>Address</th>
<th>City</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr bgcolor="#f0f0f0">
<td><%#Container.DataItem("id")%> </td>
<td><%#Container.DataItem("username")%> </td>
<td><%#Container.DataItem("userphone")%> </td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
</form>
<hr />
</body>
</html>
``` |
6,190,900 | I have a simple ASP.NET page:
```
sub Page_Load
//Get data form databse and show it
end sub
sud deletsome(Source As Object, e As EventArgs)
//delete one record when user click on submit button
end sub
```
When I click the button, the page reload, all the data have no change, I must re-enter the page again, the record I have delete disappear.
Can you show me why?
The full code here:
```
<%@ Import Namespace="System.Data.OleDb" %>
<script runat="server">
sub Page_Load
dim dbconn,sql,dbcomm,dbread
dbconn=New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Persist Security Info=False;data source=" & server.mappath("/data/test.accdb"))
dbconn.Open()
sql="SELECT * FROM [user]"
dbcomm=New OleDbCommand(sql,dbconn)
dbread=dbcomm.ExecuteReader()
customers.DataSource=dbread
customers.DataBind()
dbread.Close()
dbconn.Close()
end sub
sub deletesome(Source As Object, e As EventArgs)
dim dbconn,sql,dbcomm
dbconn=New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Persist Security Info=False;data source=" & server.mappath("/data/test.accdb"))
dbconn.Open()
sql="DELETE FROM [user]WHERE id = @ID"
dbcomm=New OleDbCommand(sql,dbconn)
dbcomm.Parameters.AddWithValue("ID", tb1.Text)
dbcomm.ExecuteNonQuery()
end sub
</script>
<html>
<body>
<form runat="server">
<asp:TextBox id="tb1" runat="server" />
<asp:Button id="b1" Text="Submit" runat="server" OnClick="deletesome" />
<asp:Repeater id="customers" runat="server">
<HeaderTemplate>
<table border="1" width="100%">
<tr bgcolor="#b0c4de">
<th>ID</th>
<th>Address</th>
<th>City</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr bgcolor="#f0f0f0">
<td><%#Container.DataItem("id")%> </td>
<td><%#Container.DataItem("username")%> </td>
<td><%#Container.DataItem("userphone")%> </td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
</form>
<hr />
</body>
</html>
``` | 2011/05/31 | [
"https://Stackoverflow.com/questions/6190900",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/749854/"
]
| In asp page life cycle, page load happens before the button click (I know, it's kind of strange). The easiest work around is to place your code in the page "PreRender" event. | Use if(!IsPostBack) on page load. |
6,190,900 | I have a simple ASP.NET page:
```
sub Page_Load
//Get data form databse and show it
end sub
sud deletsome(Source As Object, e As EventArgs)
//delete one record when user click on submit button
end sub
```
When I click the button, the page reload, all the data have no change, I must re-enter the page again, the record I have delete disappear.
Can you show me why?
The full code here:
```
<%@ Import Namespace="System.Data.OleDb" %>
<script runat="server">
sub Page_Load
dim dbconn,sql,dbcomm,dbread
dbconn=New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Persist Security Info=False;data source=" & server.mappath("/data/test.accdb"))
dbconn.Open()
sql="SELECT * FROM [user]"
dbcomm=New OleDbCommand(sql,dbconn)
dbread=dbcomm.ExecuteReader()
customers.DataSource=dbread
customers.DataBind()
dbread.Close()
dbconn.Close()
end sub
sub deletesome(Source As Object, e As EventArgs)
dim dbconn,sql,dbcomm
dbconn=New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Persist Security Info=False;data source=" & server.mappath("/data/test.accdb"))
dbconn.Open()
sql="DELETE FROM [user]WHERE id = @ID"
dbcomm=New OleDbCommand(sql,dbconn)
dbcomm.Parameters.AddWithValue("ID", tb1.Text)
dbcomm.ExecuteNonQuery()
end sub
</script>
<html>
<body>
<form runat="server">
<asp:TextBox id="tb1" runat="server" />
<asp:Button id="b1" Text="Submit" runat="server" OnClick="deletesome" />
<asp:Repeater id="customers" runat="server">
<HeaderTemplate>
<table border="1" width="100%">
<tr bgcolor="#b0c4de">
<th>ID</th>
<th>Address</th>
<th>City</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr bgcolor="#f0f0f0">
<td><%#Container.DataItem("id")%> </td>
<td><%#Container.DataItem("username")%> </td>
<td><%#Container.DataItem("userphone")%> </td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
</form>
<hr />
</body>
</html>
``` | 2011/05/31 | [
"https://Stackoverflow.com/questions/6190900",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/749854/"
]
| Use if(!IsPostBack) on page load. | try this
```
<%@ Import Namespace="System.Data.OleDb" %>
<script runat="server">
sub Page_Load
If Page.IsPostBack = False Then
LoadData()
end sub
sub deletesome(Source As Object, e As EventArgs)
dim dbconn,sql,dbcomm
dbconn=New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Persist Security Info=False;data source=" & server.mappath("/data/test.accdb"))
dbconn.Open()
sql="DELETE FROM [user]WHERE id = @ID"
dbcomm=New OleDbCommand(sql,dbconn)
dbcomm.Parameters.AddWithValue("ID", tb1.Text)
dbcomm.ExecuteNonQuery()
LoadData()
end sub
sub LoadData
dim dbconn,sql,dbcomm,dbread
dbconn=New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Persist Security Info=False;data source=" & server.mappath("/data/test.accdb"))
dbconn.Open()
sql="SELECT * FROM [user]"
dbcomm=New OleDbCommand(sql,dbconn)
dbread=dbcomm.ExecuteReader()
customers.DataSource=dbread
customers.DataBind()
dbread.Close()
dbconn.Close()
end sub
</script>
<html>
<body>
<form runat="server">
<asp:TextBox id="tb1" runat="server" />
<asp:Button id="b1" Text="Submit" runat="server" OnClick="deletesome" />
<asp:Repeater id="customers" runat="server">
<HeaderTemplate>
<table border="1" width="100%">
<tr bgcolor="#b0c4de">
<th>ID</th>
<th>Address</th>
<th>City</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr bgcolor="#f0f0f0">
<td><%#Container.DataItem("id")%> </td>
<td><%#Container.DataItem("username")%> </td>
<td><%#Container.DataItem("userphone")%> </td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
</form>
<hr />
</body>
</html>
``` |
6,190,900 | I have a simple ASP.NET page:
```
sub Page_Load
//Get data form databse and show it
end sub
sud deletsome(Source As Object, e As EventArgs)
//delete one record when user click on submit button
end sub
```
When I click the button, the page reload, all the data have no change, I must re-enter the page again, the record I have delete disappear.
Can you show me why?
The full code here:
```
<%@ Import Namespace="System.Data.OleDb" %>
<script runat="server">
sub Page_Load
dim dbconn,sql,dbcomm,dbread
dbconn=New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Persist Security Info=False;data source=" & server.mappath("/data/test.accdb"))
dbconn.Open()
sql="SELECT * FROM [user]"
dbcomm=New OleDbCommand(sql,dbconn)
dbread=dbcomm.ExecuteReader()
customers.DataSource=dbread
customers.DataBind()
dbread.Close()
dbconn.Close()
end sub
sub deletesome(Source As Object, e As EventArgs)
dim dbconn,sql,dbcomm
dbconn=New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Persist Security Info=False;data source=" & server.mappath("/data/test.accdb"))
dbconn.Open()
sql="DELETE FROM [user]WHERE id = @ID"
dbcomm=New OleDbCommand(sql,dbconn)
dbcomm.Parameters.AddWithValue("ID", tb1.Text)
dbcomm.ExecuteNonQuery()
end sub
</script>
<html>
<body>
<form runat="server">
<asp:TextBox id="tb1" runat="server" />
<asp:Button id="b1" Text="Submit" runat="server" OnClick="deletesome" />
<asp:Repeater id="customers" runat="server">
<HeaderTemplate>
<table border="1" width="100%">
<tr bgcolor="#b0c4de">
<th>ID</th>
<th>Address</th>
<th>City</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr bgcolor="#f0f0f0">
<td><%#Container.DataItem("id")%> </td>
<td><%#Container.DataItem("username")%> </td>
<td><%#Container.DataItem("userphone")%> </td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
</form>
<hr />
</body>
</html>
``` | 2011/05/31 | [
"https://Stackoverflow.com/questions/6190900",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/749854/"
]
| In asp page life cycle, page load happens before the button click (I know, it's kind of strange). The easiest work around is to place your code in the page "PreRender" event. | try this
```
<%@ Import Namespace="System.Data.OleDb" %>
<script runat="server">
sub Page_Load
If Page.IsPostBack = False Then
LoadData()
end sub
sub deletesome(Source As Object, e As EventArgs)
dim dbconn,sql,dbcomm
dbconn=New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Persist Security Info=False;data source=" & server.mappath("/data/test.accdb"))
dbconn.Open()
sql="DELETE FROM [user]WHERE id = @ID"
dbcomm=New OleDbCommand(sql,dbconn)
dbcomm.Parameters.AddWithValue("ID", tb1.Text)
dbcomm.ExecuteNonQuery()
LoadData()
end sub
sub LoadData
dim dbconn,sql,dbcomm,dbread
dbconn=New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Persist Security Info=False;data source=" & server.mappath("/data/test.accdb"))
dbconn.Open()
sql="SELECT * FROM [user]"
dbcomm=New OleDbCommand(sql,dbconn)
dbread=dbcomm.ExecuteReader()
customers.DataSource=dbread
customers.DataBind()
dbread.Close()
dbconn.Close()
end sub
</script>
<html>
<body>
<form runat="server">
<asp:TextBox id="tb1" runat="server" />
<asp:Button id="b1" Text="Submit" runat="server" OnClick="deletesome" />
<asp:Repeater id="customers" runat="server">
<HeaderTemplate>
<table border="1" width="100%">
<tr bgcolor="#b0c4de">
<th>ID</th>
<th>Address</th>
<th>City</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr bgcolor="#f0f0f0">
<td><%#Container.DataItem("id")%> </td>
<td><%#Container.DataItem("username")%> </td>
<td><%#Container.DataItem("userphone")%> </td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
</form>
<hr />
</body>
</html>
``` |
47,836,853 | I'm looking for a little advice regarding the best way to execute multiple ajax calls and then combine the results. My problem is that according to the documentation of the when function it will map the resulting argument differently when there are multiple arguments vs just a single argument.
<https://api.jquery.com/jquery.when/>
This resulted in code that looks like the following. The check seems ugly to me and as far as I can tell would need to be done everytime $.when.apply is used. Is there a way to pass in an array of deferreds to the when function so that the output is of a consistent shape?
```
//Returns an array of promises that are simple ajax get requests
var getEventFramesPromises = self.webServiceAdapter.getEventFrames(distinctEventFramePaths);
$.when.apply($, getEventFramesPromises).then(function () {
var eventFrames;
//Now "arguments" will either be an array with three arguments it the length of the getEventFramesPromises ===1
if (getEventFramesPromises.length === 1) {
eventFrames = [arguments[0]];
} else {
//Or it will be an array of arrays where each item in the array represents a deferred result
eventFrames = _.map(arguments, function (args) {
return args[0];
});
}});
``` | 2017/12/15 | [
"https://Stackoverflow.com/questions/47836853",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/565792/"
]
| jQuery `$.when()` is probably the worst designed API in the jQuery set. Not only does it return a different data type based on what you pass it, but it also doesn't even accept an array as an argument which is the most common and flexible way to use it. What I'd suggest is a simple wrapper that "fixes" the design to be consistent:
```
// Takes an array of promises and always returns an array of results, even if only one result
$.all = function(promises) {
if (!Array.isArray(promises)) {
throw new Error("$.all() must be passed an array of promises");
}
return $.when.apply($, promises).then(function () {
// if single argument was expanded into multiple arguments, then put it back into an array
// for consistency
var args = Array.prototype.slice.call(arguments, 0);
if (promises.length === 1 && arguments.length > 1) {
// put arguments into an array for consistency
return [args];
} else {
return args;
}
});
};
```
And, here's a slightly different implementation that also takes the three element array that `$.ajax()` resolves to and makes it just be the single data value so your resolved value is just a simple array of single element results:
```
// jQuery replacement for $.when() that works more like Promise.all()
// Takes an array of promises and always returns an array of results, even if only one result
$.all = function (promises) {
if (!Array.isArray(promises)) {
throw new Error("$.all() must be passed an array of promises");
}
return $.when.apply($, promises).then(function () {
// if single argument was expanded into multiple arguments, then put it back into an array
// for consistency
var args = Array.prototype.slice.call(arguments, 0);
var returnVal;
if (promises.length === 1 && arguments.length > 1) {
// put arguments into an array for consistency
returnVal = [args];
} else {
returnVal = args;
}
// now make Ajax results easier to use by making it be just an array of results, not an array of arrays
//
return returnVal.map(function(item) {
// see if this looks like the array of three values that jQuery.ajax() resolves to
if (Array.isArray(item) && item.length === 3 && typeof item[2] === "object" && typeof item[2].done === "function") {
// just the data
return item[0];
} else {
return item;
}
});
});
};
``` | Not sure about why this question is getting down-voted. I think the question is reasonable and I point to the exact documentation in question. So I ended up taking Kevin's advice and wrote a quick helper function that will extract the results of the jquery calls taking into account the behavior when there is only a single value in the array.
```
function extractValuesFromPromises() {
if (arguments.length === 3 && typeof arguments[2].then === 'function') {
return [arguments[0]];
} else {
return _.map(arguments, function (args) {
return args[0];
});
}
}
```
Then in your code you can do this....
```
var getEventFramesPromises = self.webServiceAdapter.getEventFrames(distinctEventFramePaths);
$.when.apply($, getEventFramesPromises)
.then(extractValuesFromPromises)
.then(function (eventFrames) {
//Do whatever with ajax results
});
``` |
54,559,751 | I have this tables:
timelines
```
id | post_id | group_id
```
post\_views
```
id | post_id | user_id
```
My query is like:
```
SELECT distinct on (t.post_id) post_id, t.group_id, t.id, t.created_at
FROM timelines t join post_views pv USING(post_id)
WHERE t.group_id IN (1, 2, 78)
```
It's "working", but I need to get other field named 'seen', and that field will receive true if has t.post\_id = pv.post\_id AND user\_id = 100, or else return false or NULL
I can't do the `WHERE` in `JOIN` clause.
Thanks
---
Example:
<https://www.db-fiddle.com/f/m2HdHrZD5fY98tpGa1Eqsw/0>
Guys, I made the example above to help you to help me :D | 2019/02/06 | [
"https://Stackoverflow.com/questions/54559751",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10240618/"
]
| I have found a solution to the problem which works 100% of the time, however it's slightly inconvenient.
When trying to open the VBA > References, it will crash therefore I cannot find the missing reference.
My workaround is to clear all trusted documents, which brings the 'Enable Content' pop up. Before enabling content, I will go back to VBA > References, remove and re-add OLE Automation.
The next step is to save the file, enable content and you're good to go! | Steps:
1. panic
2. Repaired Microsoft Office
3. removed personal.xlsb file from XLStart to test
4. Opened blank excel, Alt + F11 to open VBA
5. Tools -> References -> Object Library
6. Search for missing objects
7. Corrected if found
8. These steps didn't resolve, so renamed the file opened in safe mode (win + R type Excel.exe /safe)
9. Updated dates, changed a few items and saved
10. Opened file normally, issue resolved.
Alternatively, try to have someone else open the file/update name and change a few things for you. the file is likely corrupt |
54,559,751 | I have this tables:
timelines
```
id | post_id | group_id
```
post\_views
```
id | post_id | user_id
```
My query is like:
```
SELECT distinct on (t.post_id) post_id, t.group_id, t.id, t.created_at
FROM timelines t join post_views pv USING(post_id)
WHERE t.group_id IN (1, 2, 78)
```
It's "working", but I need to get other field named 'seen', and that field will receive true if has t.post\_id = pv.post\_id AND user\_id = 100, or else return false or NULL
I can't do the `WHERE` in `JOIN` clause.
Thanks
---
Example:
<https://www.db-fiddle.com/f/m2HdHrZD5fY98tpGa1Eqsw/0>
Guys, I made the example above to help you to help me :D | 2019/02/06 | [
"https://Stackoverflow.com/questions/54559751",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10240618/"
]
| Steps:
1. panic
2. Repaired Microsoft Office
3. removed personal.xlsb file from XLStart to test
4. Opened blank excel, Alt + F11 to open VBA
5. Tools -> References -> Object Library
6. Search for missing objects
7. Corrected if found
8. These steps didn't resolve, so renamed the file opened in safe mode (win + R type Excel.exe /safe)
9. Updated dates, changed a few items and saved
10. Opened file normally, issue resolved.
Alternatively, try to have someone else open the file/update name and change a few things for you. the file is likely corrupt | Try opening it in the Mac version of Excel. I tried this in last ditch desperation after no other recommendations worked (I couldn't try opening in online version because the file is password protected which isn't supported there). Mac Excel was able to open it without any complaints. I was then able to save it out just fine, and Windows (10, 64 bit- where the file was originally created) Excel was then able to read like normal. Using the various recovery methods with Windows Excel, the best I could get was a version that preserved the formulas but lost all of the VBA and all of the named ranges.
BTW, one other feature of my problem: I was working on the file for about a week. In that time, I never closed and reopened it. I did, however, save many, many times. Including saving versions in new files. I discovered the problem when I finally did close & reopen. And I discovered that every single version I had saved in the past five days was also corrupt. |
54,559,751 | I have this tables:
timelines
```
id | post_id | group_id
```
post\_views
```
id | post_id | user_id
```
My query is like:
```
SELECT distinct on (t.post_id) post_id, t.group_id, t.id, t.created_at
FROM timelines t join post_views pv USING(post_id)
WHERE t.group_id IN (1, 2, 78)
```
It's "working", but I need to get other field named 'seen', and that field will receive true if has t.post\_id = pv.post\_id AND user\_id = 100, or else return false or NULL
I can't do the `WHERE` in `JOIN` clause.
Thanks
---
Example:
<https://www.db-fiddle.com/f/m2HdHrZD5fY98tpGa1Eqsw/0>
Guys, I made the example above to help you to help me :D | 2019/02/06 | [
"https://Stackoverflow.com/questions/54559751",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10240618/"
]
| I have found a solution to the problem which works 100% of the time, however it's slightly inconvenient.
When trying to open the VBA > References, it will crash therefore I cannot find the missing reference.
My workaround is to clear all trusted documents, which brings the 'Enable Content' pop up. Before enabling content, I will go back to VBA > References, remove and re-add OLE Automation.
The next step is to save the file, enable content and you're good to go! | When all else failed, this worked for me. I opened my workbook in Excel online (Office 365, in the browser, which doesn't support macros anyway), saved it with a new file name (still using .xlsm file extension), and reopened in the desktop software. It worked. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.