Application startup status in Websphere - java

I have a web application deployed in Websphere. At server startup, I am trying to load some values from database through ServletContextListener. If any exception occurs at that time, I want the web application start up status as failed.
In order to achieve this, I am throwing a Runtime exception from ServletContextListener. This is working fine on Tomcat as it is not starting the webapp. But, on Websphere, the application start up status is showing as Success.
Please let me know the way to handle this for a normal webapp, which does not use EJBs.

The section Application Status list all avaiable status. You can notice there is no fail or something like that.
Websphere does not support the behavior that you expected in 8.x or older version.
There is a discussion : Stop application on servlet initialization failure.
It mention a possible solution but the customize implementation is not released yet.

Related

Accessing EJBs deployed in WildFly from an application running in Jboss5

I am running an application in integration with another team's application.
My application is running on JBoss5 and jdk6
Other Application is running on Wildfly8 with jdk8
My application calls an EJB Bean deployed as part of other application but this look up fails.
I am not willing to migrate to wildfly as it could be little time taking task but I am not even getting rid of it.
Any suggestions guys so I can avoid this migration.
See the below links which describes to configure an EJB client in JBoss:
https://docs.jboss.org/author/display/AS71/EJB+invocations+from+a+remote+client+using+JNDI
https://docs.jboss.org/author/display/AS71/EJB+invocations+from+a+remote+server+instance

install4j: how can i check whether my apache tomcat server started successfully or not

I've created installer using install4j, which installs tomcat as service and starts service.
Start service involves starting of my apache tomcat server (including my spring web application).
Here, i wants to perform a check whether my application in apache tomcat server got started successfully or not.
This can be checked by hitting one url of my web app, now how can i halt installer to wait till the apache tomcat gets started successfully, any Idea?
Whether this is possible using java class or not?
If yes then please give an idea.
Thanks
Satish Lakhani
You can use a "Wait for HTTP server" action for that purpose.

Spring Boot Application quits unexpectedly with "Killed"

I am running a small webservice application with Spring Boot, Maven, Spring Data, Hibernate which is usually working fine. It has just a single webservice request mapping. The application is a standalone JAR and started in a shell with "screen".
Nearly once per day it just quits itself. There is nobody that forces the app to stop or so. It just says "Killed" in the shell. There is no exception, error or any other message. I already tried to activate logging in application.properties with:
logging.level.org.springframework.web=ERROR
logging.level.org.hibernate=ERROR
but that does not help. Also added exception handling to the webservice mapping trying to catch any exception thrown. But also nothing.
Does anyone know why the app could have been stopped or how I can display the problem?
Thanks in advance!
I encountered with the same problem and I had resolved it by creating swap area. I think it is a typical memory problem. I recommend you to create swap area if you are deploying the application in a linux environment. Check memory usage before..
This happens often when system kills your Java process because it started to consume a lot of memory.
Try to inspect your deployment target limitations and adjust heap size below that limit.

how to make a code run once on the cluster during the server startup and will also work on non cluster environment

Background: What I need is a way to subscribe to the external system only once during the server startup on clustered environment. So far we were using ApplicationLifecycleListener to run the subscription. In our code we were trying to find a winner node to make the subscription but for some reason it does not work and all 4 are sending their request. (the code was written on Weblogic 8.1)
Now after we've migrated to the weblogic 11g I've found a SingletonService that did the trick. Unfortunately we cannot use it as when we develop our application locally we test it on non-cluster environment and Singleton Service does not work on it.
My question: Is there a way to register SingletonService after the application is started and we, eg. in ApplicationLifecycleListener discover that we are on the cluster? If not, do you have any suggestions on how to solve our problem?
Can you use a startup class and only target it to one machine instead of all 4? You will need to add the startup class to the server's classpath. You can view startup/shutdown classes in the weblogic console under "Environment".
Here is a brief example: http://buttso.blogspot.com/2009/09/weblogic-server-startup-and-shutdown.html

Web service is not working on GlassFish

I am generating web service client in Eclipse Helios by Axis 1.4 version. The client stubs are working fine as per the expectation by using local main programs, but when I deploy the stub and application on GlassFish server, I am getting the following exception:
Edited : Now it gives exception like this ..
java.lang.IllegalStateException: WEB9031: WebappClassLoader unable to load resource [META-INF/services/org.apache.axis.EngineConfigurationFactory], because it has not yet been started, or was already stopped
at org.glassfish.web.loader.WebappClassLoader.findResourceInternal(WebappClassLoader.java:2074)
at org.glassfish.web.loader.WebappClassLoader.findResource(WebappClassLoader.java:1034)
at org.glassfish.web.loader.WebappClassLoader.getResource(WebappClassLoader.java:1169)
Can anyone tell me why it is happening?
Its happening only when I deploy the application on GlassFish server.
Thanks,
Gunjan.
This refers to the similar problem you have. So as I mention in my comment, remove all Axis related stuff from global glassfish classpath, add them into your application and it should all be fine.
It is not a very good practice to keep framework specific libraries in the server global libraries. In the global classpath should go libs like JDBC, logging frameworks, but not WS stack specific libraries.

Categories