remote call is hanging when starting tomee with already deployed war

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

remote call is hanging when starting tomee with already deployed war

zsaade
Dear All

I have the below project structure:
-EAR file to be deployed under <tomee-home>\apps
-WAR file (contain a remote call for EJB's available under the EAR file)

case 1 (OK)
-When I start tomee (EAR file already available under <tomee-home>\apps) and
wait till tomee start successfully and when copy past the WAR file under
<tomee-home>\webapps the war will be deployed successfully and I'm able to
access the web application

case 1 (KO)
-When I restart tomee the EAR is deployed however during the WAR deployment
I can notice that tomee is hanging on the remote ejb call, to fix the matter
I need to stop tomee remove the war file and it's related folder clean the
work directory, start tomee wait till the server is start successfully; then
copy past again the war file inside <tomee-home>\webapps.
 
Kindly advice how to fix the matter, is there any configuration to be
applied?

Best Regards  



--
Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Dev-f982480.html
Reply | Threaded
Open this post in threaded view
|

Re: remote call is hanging when starting tomee with already deployed war

jgallimore
Hi

Are you able to provide a small example for us? That would help us debug,
and ultimately we could build a test out of it for the test suite.

Many thanks

Jon

On Fri, Mar 8, 2019 at 2:44 PM zsaade <[hidden email]> wrote:

> Dear All
>
> I have the below project structure:
> -EAR file to be deployed under <tomee-home>\apps
> -WAR file (contain a remote call for EJB's available under the EAR file)
>
> case 1 (OK)
> -When I start tomee (EAR file already available under <tomee-home>\apps)
> and
> wait till tomee start successfully and when copy past the WAR file under
> <tomee-home>\webapps the war will be deployed successfully and I'm able to
> access the web application
>
> case 1 (KO)
> -When I restart tomee the EAR is deployed however during the WAR deployment
> I can notice that tomee is hanging on the remote ejb call, to fix the
> matter
> I need to stop tomee remove the war file and it's related folder clean the
> work directory, start tomee wait till the server is start successfully;
> then
> copy past again the war file inside <tomee-home>\webapps.
>
> Kindly advice how to fix the matter, is there any configuration to be
> applied?
>
> Best Regards
>
>
>
> --
> Sent from:
> http://tomee-openejb.979440.n4.nabble.com/TomEE-Dev-f982480.html
>
Reply | Threaded
Open this post in threaded view
|

Re: remote call is hanging when starting tomee with already deployed war

zsaade
Hi jgallimore

Thanks for you reply:

Note that the mentioned WAR contain's a remote EJB call at deployment event;

it seems that we can't call any remote EJB during tomee startup process
(possible the ports aren't ready yet) and in case we initiate a remote EJB
call during deployment event during tomee startup (WAR already deployed
under <tomee-home>\webapps) the server will hang.

Please provide your feedback if any.

Best Regards



--
Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Dev-f982480.html
Reply | Threaded
Open this post in threaded view
|

Re: remote call is hanging when starting tomee with already deployed war

zsaade
In reply to this post by jgallimore
Dear jgallimore

Find below an example for an ejb remote client war (considering that you
have already an ejb (war file) deployed under <tomee-home>\webapps):

1-Create a Web Project
2-Under the web project create a Servlet
3-Inside the Servlet init Method lookup and call an ejb

public void init() throws ServletException
    {
              //To Do Look up and call a method from a remote ejb.
    }


4-Inside the Web Project open web.xml file and add the below to let the
server start at the deploymnet event:

        <servlet>
                <servlet-name>ServletName</servlet-name>
                <servlet-class>package.location.of.serfvlet.ServletName</servlet-class>
                <load-on-startup>1</load-on-startup>
        </servlet>

5-Export the web project as war file.

6-Make sure that the ejb project is already deployed and add the exported
war under <tomee-home>\webapps

7-The project will be able to start correctly (OK scenario)

8-Stop TomEE

9-Start TomEE the server will hang on EJB calling.


PS1: EJB project always start before the client project
PS2: I'm using apache-tomee-plume-7.1.0

if you need further details don't hesitate to contact me.

Thanks in advance

Best Regards



--
Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Dev-f982480.html
Reply | Threaded
Open this post in threaded view
|

Re: remote call is hanging when starting tomee with already deployed war

jgallimore
I just re-read this thread. Thanks for the additional detail. When the .war
containing the EJB client starts (and gets stuck hanging), has the EAR file
already been deployed?

Also, how is the servlet in your EJB client .war making the call - are you
using the LocalInitialContextFactory, or remote? I'd suspect the latter may
fail as the connector might not have started at that point.

I'm a little swamped, but I'll put together a sample as soon as I can.

Jon

On Thu, Mar 14, 2019 at 1:00 PM zsaade <[hidden email]> wrote:

> Dear jgallimore
>
> Find below an example for an ejb remote client war (considering that you
> have already an ejb (war file) deployed under <tomee-home>\webapps):
>
> 1-Create a Web Project
> 2-Under the web project create a Servlet
> 3-Inside the Servlet init Method lookup and call an ejb
>
> public void init() throws ServletException
>     {
>               //To Do Look up and call a method from a remote ejb.
>     }
>
>
> 4-Inside the Web Project open web.xml file and add the below to let the
> server start at the deploymnet event:
>
>         <servlet>
>                 <servlet-name>ServletName</servlet-name>
>
> <servlet-class>package.location.of.serfvlet.ServletName</servlet-class>
>                 <load-on-startup>1</load-on-startup>
>         </servlet>
>
> 5-Export the web project as war file.
>
> 6-Make sure that the ejb project is already deployed and add the exported
> war under <tomee-home>\webapps
>
> 7-The project will be able to start correctly (OK scenario)
>
> 8-Stop TomEE
>
> 9-Start TomEE the server will hang on EJB calling.
>
>
> PS1: EJB project always start before the client project
> PS2: I'm using apache-tomee-plume-7.1.0
>
> if you need further details don't hesitate to contact me.
>
> Thanks in advance
>
> Best Regards
>
>
>
> --
> Sent from:
> http://tomee-openejb.979440.n4.nabble.com/TomEE-Dev-f982480.html
>
Reply | Threaded
Open this post in threaded view
|

Re: remote call is hanging when starting tomee with already deployed war

zsaade
Dear Jon

Yes; the EAR or the WAR files that contains the EJB are being deployed
before the WAR client (Contain the EJB Call).


The Servlet is using the below remote call:
h.put(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.openejb.client.RemoteInitialContextFactory");
h.put(Context.PROVIDER_URL,  "http://localhost:8080/tomee/ejb");

Should I use the "LocalInitialContextFactory" call in order to resolve the
problem, and if yes which URL should I use?

Thanks for your usual support.

Best Regards



--
Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Dev-f982480.html
Reply | Threaded
Open this post in threaded view
|

Re: remote call is hanging when starting tomee with already deployed war

zsaade
This post was updated on .
In reply to this post by jgallimore
Dear Jon

I tried to use LocalInitialContextFactory instead of remote;

-->h.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.LocalInitialContextFactory");

I received the below error:
-->ERROR = java.lang.ClassCastException (At startup).

Thanks and Best Regards




--
Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Dev-f982480.html
Reply | Threaded
Open this post in threaded view
|

Re: remote call is hanging when starting tomee with already deployed war

zsaade
In reply to this post by jgallimore
Dear Jon

Hope you are fine?

Any feedback from your side?

Best Regards



--
Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Dev-f982480.html