#EJB injection fails when remote ejb app is restarted - java

I am using EJB3.0. I have an application running on websphere app server v7 who is executing a remote ejb 3.0 running in a different application on the same app server.
I use #EJB annotation to inject remote interface in my code. It runs fine, so I am sure all configuration and code is ok.
When the other application (containing the ejb) is restarted (it may be deployed because of a fix elsewhere in the code) my application and its client does not run anymore, it seems to lose the reference of the ejb stub.
I can fix the problem simply restarting my application, but it is not a good practice in our production environment.
I would like to re-inject or renew the ejb if needed. Is it possible?
Another way should be creating ejb stubs and adding them to my application (not a good thing anyway, I would avoid it).
I also tried to switch to the old 'lookup' way through InitialContext but only get a ClassCastException on stubs... again, it seems to need concrete stubs again...
Is there a simple solution to this 'classic' scenario?
Thank you
MMad

I remember seeing such problems in earlier WebSphere 7 versions, but they were fixed in more recent versions. You should install the latest fix pack for 7.0, and if the problem still persists, open a PMR with IBM.

Related

Re-deploy spring boot service without restart?

I have developed a micro service (Spring Boot REST service, deployed as executable JAR) to track all activities from third party projects as my requirement and its working now.
Currently it's working apart of some projects, and now I have updated service with some additional features.
But I can't move it to live server without restarting the existing service as it is deployed as jar. I'm afraid to restart my service, restart may be leads to lose data of integrated projects.
What improvements can I make in my architecture to solve my problem?
What about JRebel plugin. It worked perfectly for me, but, unfortunately, it's not a free app. Like alternative, (i used this approach with Spring MVC, with Spring Boot it could be otherwise), I set up a soft link in work directory on a compiled path in JBoss (in my case it was dir with name target and *.class and *.jar files). As for me, the first solution with JRebel is the most appropriate for you.
Finally got a solution as commented by #Gimby .
We can do it by deploying multiple instances of services and it bound to a service registry ,Here i achieved it by using eureka as registry service and also used zuul as proxy .

make a bean run on application start. EJB3/websphere6.1/Java1.5

I am a little new to J2EE. I have a EJB3 project and I want to run a class on application start-up, how can I do that?
I know in EJB3.1 I can use #startup and #singleton unfortunately that is not a option and I have to use EJb3 and java 5. I have done some research and there were a few solutions but I have been unable to make it work.
WebSphere Application Server version 6.1 does not support EJB3 with a standard installation. You also need to have a feature pack for EJB 3.0 installed.
See this information on the IBM site.
If this is not your issue you should update your question with more detail of what goes wrong.
Your only options prior to WebSphere 8 (with EJB 3.1 support) are:
WebSphere startup beans. These are a programming model extension
Package a WAR with the application, and use a ServletContextListener to initialize state used by the EJBs.

Class compiled using an application server Java EE jars deployed in another application server

I have WebLogic (10.3.5) application server installed in a server and in an another
server JBoss AS (7.1.1) installed.
ServletA.java gets compiled using Java EE specific jars in JBoss AS and deployed in WebLogic (during
runtime WebLogic will be using its own Java EE specific jars to execute). Currently, when I access the servlet in WebLogic, I'm not getting any errors, it's working fine.
My question is, is this approach OK or will this create any problems in the future?
As long as you stick to the classes in the Java EE spec and don't use any JBoss specific classes or features this approach is OK.
What can still go wrong is if you rely on server specific behavior (hard to test) or run into bugs on one server.

Calling web service from another ejb on startup

Using jboss-esb 5.1.0.GA
I have a web service that an EJB that I have makes calls on when it is started. This EJB may be installed in the same JBoss instance as the web service. If I start JBoss, let it come up completely, then deploy my EJB into the same instance, all is well. However, if I leave it deployed and restart JBoss, when the EJB gets to the point where it makes a call on the web service, the Application Server start-up process hangs. Now the WebService was deployed prior to the EJB according to the logs. It acts like the web server that is serving the WS calls is not yet up either. I can try to access the WSDL via a web browser and that fails until the JBoss instance is fully started. i can see if I have my dependencies wrong and it would error out on deployment, but I get no error, it just hangs indefinitely. Any ideas where to go from here. Any more information you need?
Thanks,
-Rob
You can ensure the order of deployment if you bundle your webservice war and ejb jar into one single ear file. In this case the ejb jar is always deployed first.
Appears there is a bug in the version of JBoss that we are using. We were required to register for an event to notify us when JBoss was up, then we made our WS calls and things work fine now.

Deploying spring message driven pojo on weblogic 8.1

I am trying to deploy a spring message message driven POJO on weblogic 8.1. It is a simple POJO, and it works fine being run outside of an application server, but the messages do not seem to be picked up at all. I have created empty home and remote interfaces, as well as a container bean class that contains an instance of the pojo which it gets from the application context. I then added this container bean class to the ejb-jar.xml as a . I have not been able to get the messages pick up.
Does anyone have any suggestions as to what I am doing wrong? Could anyone point me to a tutorial on how to deploy a MDP?
Thanks.
Here's a tutorial:
http://java-x.blogspot.com/2006/12/implementing-jms-with-spring-message.html
I have no idea what you're talking about when you say "home and remote interfaces". You said Spring POJO, but home and remote interfaces are EJB 2.0 artifacts.
The important question to answer is: Are your message driven component EJBs (MDB) or Spring POJO (MDP)? If they're EJBs, I totally understand why you need home and remote interfaces. If not, I would say this could be a pure web app, packaged in a WAR, without the EJB XML.
You also need a JMS queue to be set up. Have you done that properly? WebLogic 8.1 means JMS 1.0.2.
That's an OLD version of WebLogic and JDK. Why aren't you using WebLogic 10 and JDK 6?

Categories

Resources