Hi JB,
I was able to narrow it down to this line in my @Configuration method:
configureConsole().ignoreLocalConsole().ignoreRemoteShell(),
With the above option, the root instance never finishes initializing:
SSH Port | RMI Registry | RMI Server | State | PID | Name
-------------------------------------------------------------
8101 | 1099 | 44444 | Starting | 7354 | root
8102 | 1100 | 44445 | Stopped | 0 | LA1
Without it, the root instance initializes successfully, but not the child
instance:
SSH Port | RMI Registry | RMI Server | State | PID | Name
------------------------------------------------------------
8101 | 1099 | 44444 | Started | 7240 | root
8102 | 1100 | 44445 | Stopped | 0 | LA1
and this exception is thrown in the logs:
2015-12-02 12:08:03,103 | INFO | 1]-nio2-thread-2 | ServerSession
| 1 - org.apache.sshd.core - 0.14.0 | Server session created from
/127.0.0.1:53673
2015-12-02 12:08:03,103 | WARN | 1]-nio2-thread-2 | ServerSession
| 1 - org.apache.sshd.core - 0.14.0 | Exception caught
java.io.IOException: Connection reset by peer
at sun.nio.ch.FileDispatcherImpl.read0(Native Method)[:1.8.0_45]
at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39)[:1.8.0_45]
at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)[:1.8.0_45]
at sun.nio.ch.IOUtil.read(IOUtil.java:197)[:1.8.0_45]
at
sun.nio.ch.UnixAsynchronousSocketChannelImpl.implRead(UnixAsynchronousSocketChannelImpl.java:508)[:1.8.0_45]
at
sun.nio.ch.AsynchronousSocketChannelImpl.read(AsynchronousSocketChannelImpl.java:276)[:1.8.0_45]
at
sun.nio.ch.AsynchronousSocketChannelImpl.read(AsynchronousSocketChannelImpl.java:297)[:1.8.0_45]
at
java.nio.channels.AsynchronousSocketChannel.read(AsynchronousSocketChannel.java:420)[:1.8.0_45]
at
org.apache.sshd.common.io.nio2.Nio2Session.startReading(Nio2Session.java:170)[1:org.apache.sshd.core:0.14.0]
at
org.apache.sshd.common.io.nio2.Nio2Acceptor$AcceptCompletionHandler.onCompleted(Nio2Acceptor.java:135)[1:org.apache.sshd.core:0.14.0]
at
org.apache.sshd.common.io.nio2.Nio2Acceptor$AcceptCompletionHandler.onCompleted(Nio2Acceptor.java:120)[1:org.apache.sshd.core:0.14.0]
at
org.apache.sshd.common.io.nio2.Nio2CompletionHandler$1.run(Nio2CompletionHandler.java:32)
at java.security.AccessController.doPrivileged(Native Method)[:1.8.0_45]
at
org.apache.sshd.common.io.nio2.Nio2CompletionHandler.completed(Nio2CompletionHandler.java:30)[1:org.apache.sshd.core:0.14.0]
at sun.nio.ch.Invoker.invokeUnchecked(Invoker.java:126)[:1.8.0_45]
at sun.nio.ch.Invoker$2.run(Invoker.java:218)[:1.8.0_45]
at
sun.nio.ch.AsynchronousChannelGroupImpl$1.run(AsynchronousChannelGroupImpl.java:112)[:1.8.0_45]
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_45]
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_45]
at java.lang.Thread.run(Thread.java:745)[:1.8.0_45]
Any idea what is going on?
> On Dec 2, 2015, at 11:12 AM, Alex Soto <[email protected]> wrote:
>
> I am using very similar method, using the executeCommand, almost identical
> to how Cellar is doing it.
> I see the instance directory being created but there is nothing in the log
> file of the child instance.
>
> Thanks for the help!
>
>
>> On Dec 2, 2015, at 10:34 AM, Jean-Baptiste Onofré <[email protected]
>> <mailto:[email protected]>> wrote:
>>
>> It's @Ignore due to some hazelcast issue. I will re-enable it.
>>
>> With Karaf 4.0.0, you can see:
>>
>> protected void createCellarChild(String name, boolean debug, int port) {
>> int instances = 0;
>> String createCommand = "instance:create --featureURL " +
>> System.getProperty("cellar.feature.url") + " --feature cellar ";
>> if (debug && port > 0) {
>> createCommand = createCommand + String.format(DEBUG_OPTS, port);
>> }
>> System.err.println(executeCommand(createCommand + " " + name));
>> System.err.println(executeCommand("instance:start " + name));
>>
>> //Wait till the node is listed as Starting
>> System.err.print("Waiting for " + name + " to start ");
>> for (int i = 0; i < 5 && instances == 0; i++) {
>> String response = executeCommand("instance:list | grep " + name +
>> " | grep -c " + INSTANCE_STARTED, COMMAND_TIMEOUT, true);
>> instances = Integer.parseInt(response.trim());
>> System.err.print(".");
>> try {
>> Thread.sleep(3000);
>> } catch (InterruptedException e) {
>> //Ignore
>> }
>> }
>>
>> if (instances > 0) {
>> System.err.println(".Started!");
>> } else {
>> System.err.println(".Timed Out!");
>> }
>>
>> }
>>
>> It's what I used and it should work.
>>
>> Do you do the same ?
>>
>> Do you use the Instance service directly or the commands ?
>>
>> Regards
>> JB
>>
>> On 12/02/2015 04:27 PM, Alex Soto wrote:
>>> Downloaded Cellar from the Head at https://github.com/apache/karaf-cellar
>>> <https://github.com/apache/karaf-cellar>
>>> All Integration Tests have the @Ignore annotation.
>>>
>>> Is anybody able to launch a second Karaf instance from a Pax-Exam
>>> integration test?
>>> If so, can you point me to a working example?
>>>
>>>
>>>> On Dec 1, 2015, at 3:12 PM, Alex Soto <[email protected]
>>>> <mailto:[email protected]>
>>>> <mailto:[email protected] <mailto:[email protected]>>> wrote:
>>>>
>>>> Hmm, I tried downloading Cellar and all the mirrors fail with not
>>>> found error.
>>>> How do I get the source code?
>>>>
>>>>
>>>>> On Dec 1, 2015, at 3:00 PM, Alex Soto <[email protected]
>>>>> <mailto:[email protected]>
>>>>> <mailto:[email protected] <mailto:[email protected]>>> wrote:
>>>>>
>>>>> JB:
>>>>>
>>>>> Yes, it works outside of Pax-Exam.
>>>>> I will take a look at Cellar.
>>>>>
>>>>> Thanks
>>>>>
>>>>>> On Dec 1, 2015, at 2:54 PM, Jean-Baptiste Onofré <[email protected]
>>>>>> <mailto:[email protected]>
>>>>>> <mailto:[email protected] <mailto:[email protected]>>> wrote:
>>>>>>
>>>>>> Hey Alex,
>>>>>>
>>>>>> I guess it works fine "outside" of Pax Exam, right ?
>>>>>>
>>>>>> You can take a look on Cellar as I use instance to simulate multiple
>>>>>> nodes.
>>>>>>
>>>>>> Let me try with 4.0.3.
>>>>>>
>>>>>> Regards
>>>>>> JB
>>>>>>
>>>>>> On 12/01/2015 08:16 PM, Alex Soto wrote:
>>>>>>> Hello,
>>>>>>>
>>>>>>> I am using Karaf version 4.0.3. In my integration test I want to launch
>>>>>>> a second instance of Karaf, but it always times out, so I am now
>>>>>>> wondering if it is because the root instance is not yet finished
>>>>>>> starting.
>>>>>>>
>>>>>>> In order to troubleshoot this issue, I have now added the
>>>>>>> ‘instance:list’ command to my test:
>>>>>>>
>>>>>>> String listOutput = executeCommand("instance:list");
>>>>>>> log.info(listOutput);
>>>>>>>
>>>>>>> I call the above from my @Test method, but the output always shows:
>>>>>>>
>>>>>>> SSH Port | RMI Registry | RMI Server | State | PID | Name
>>>>>>> -------------------------------------------------------------
>>>>>>> 8101 | 1099 | 44444 | Starting | 2914 | root
>>>>>>>
>>>>>>> No matter how much I wait, it always shows the same status. Meaning the
>>>>>>> container never finishes starting. I can manually run the exact same
>>>>>>> container that was created under 'target/exam/<guid>’ folder, and issue
>>>>>>> the above command and get:
>>>>>>>
>>>>>>> SSH Port | RMI Registry | RMI Server | State | PID | Name
>>>>>>> ------------------------------------------------------------
>>>>>>> 8101 | 1099 | 44444 | Started | 3409 | root
>>>>>>>
>>>>>>> So, it appears to be some kind of issue with the way the PAM-EXAM test
>>>>>>> is wired. I have added this dependency to try to cope with the
>>>>>>> problem:
>>>>>>>
>>>>>>> @Inject
>>>>>>> @Filter(timeout = SERVICE_TIMEOUT)
>>>>>>> protected BootFinished bootFinished;
>>>>>>>
>>>>>>> but so far, I have not been able to solve it. As I said before, my
>>>>>>> ultimate goal is to run a child instance, but I suspect that won’t
>>>>>>> happen until the main instance is successfully started. Any hints?
>>>>>>>
>>>>>>> Best regards,
>>>>>>> Alex Soto
>>>>>>>
>>>>>>
>>>>>> --
>>>>>> Jean-Baptiste Onofré
>>>>>> [email protected] <mailto:[email protected]>
>>>>>> <mailto:[email protected] <mailto:[email protected]>>
>>>>>> http://blog.nanthrax.net <http://blog.nanthrax.net/>
>>>>>> Talend - http://www.talend.com <http://www.talend.com/>
>>>>>
>>>>
>>>
>>
>> --
>> Jean-Baptiste Onofré
>> [email protected] <mailto:[email protected]>
>> http://blog.nanthrax.net <http://blog.nanthrax.net/>
>> Talend - http://www.talend.com <http://www.talend.com/>