websphere interview questions
Top websphere frequently asked interview questions
I would like to know where are the WebSphere configuration details saved?
Specifically, configuration details that are shown in the Administrative Console (from the web) or from the console using wsadmin.
Some of the examples would be:
- Java and Process Management: Class
loader, Process definition, Process
execution
- Container Settings:
Session management, SIP Container
Settings, Web Container Settings,
Portlet Container Settings
Are there XML files that persist these configuration details?
Nicholas
Source: (StackOverflow)
I am using IBM Websphere Application Server v6 and Java 1.4 and am trying to write large CSV files to the ServletOutputStream
for a user to download. Files are ranging from a 50-750MB at the moment.
The smaller files aren't causing too much of a problem but with the larger files it appears that it is being written into the heap which is then causing an OutOfMemory error and bringing down the entire server.
These files can only be served out to authenticated users over HTTPS which is why I am serving them through a Servlet instead of just sticking them in Apache.
The code I am using is (some fluff removed around this):
resp.setHeader("Content-length", "" + fileLength);
resp.setContentType("application/vnd.ms-excel");
resp.setHeader("Content-Disposition","attachment; filename=\"export.csv\"");
FileInputStream inputStream = null;
try
{
inputStream = new FileInputStream(path);
byte[] buffer = new byte[1024];
int bytesRead = 0;
do
{
bytesRead = inputStream.read(buffer, offset, buffer.length);
resp.getOutputStream().write(buffer, 0, bytesRead);
}
while (bytesRead == buffer.length);
resp.getOutputStream().flush();
}
finally
{
if(inputStream != null)
inputStream.close();
}
The FileInputStream
doesn't seem to be causing a problem as if I write to another file or just remove the write completely the memory usage doesn't appear to be a problem.
What I am thinking is that the resp.getOutputStream().write
is being stored in memory until the data can be sent through to the client. So the entire file might be read and stored in the resp.getOutputStream()
causing my memory issues and crashing!
I have tried Buffering these streams and also tried using Channels from java.nio
, none of which seems to make any bit of difference to my memory issues. I have also flushed the OutputStream
once per iteration of the loop and after the loop, which didn't help.
Source: (StackOverflow)
My application server ibm websphere.
I'm getting the following error in the application server logs.
Where can I websphere settings?
[19.09.2012 14:56:54:940 EEST] 0000000a SystemErr R SLF4J: Class path contains multiple SLF4J bindings.
[19.09.2012 14:56:54:940 EEST] 0000000a SystemErr R SLF4J: Found binding in [wsjar:file:/C:/Lib/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
[19.09.2012 14:56:54:941 EEST] 0000000a SystemErr R SLF4J: Found binding in
[bundleresource://217.fwk37356669:1/org/slf4j/impl/StaticLoggerBinder.class]
[19.09.2012 14:56:54:941 EEST] 0000000a SystemErr R SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
Source: (StackOverflow)
I am using Rational Application Developer v7.0 that ships with an integrated test environment. When I get to debugging my webapp, the server startup time in debug mode is close to 5-6 minutes - enough time to take a coffe break!
At times, it so pisses me off that I start cursing IBM for building an operating system! instead of an app server: Spawning 20+ processes and useless services with no documented configuration to tuning it, to starting any faster.
I am sure there are many java developers out there, who would agree with me on this. Now, I tried to disable the default apps and a set of services via my admin console, however, that hasn't helped much.
I have no webservices, no enterprise beans, no queues, just a simple web app which requires a connection pool. Have you done something in the past to make your integrated test environment, start fast in debug mode and there by consume less RAM?
UPDATE:
I tried disabling a few services (internationaliztion, default apps etc...) and now the websphere server went from bad to worse. Not only doesn't it take horrifying startup time, it keeps freezing every now and then for upto 2 minutes. :-( Sounds like, optimization is not such a good thing, always!
Source: (StackOverflow)
I was trying to understand more on Transfer-Encoding:chunked
. referred some articles:
http://zoompf.com/blog/2012/05/too-chunky and "Transfer-Encoding: chunked" header in PHP.
I still didn't get very clear picture. I understand setting this encoding allows server to set content in chunk to the browser and cause partial rendering of content at a time that makes web site responsive.
If I've a web application that serves dynamic content (ex: JSF based web app) hosted on IBM WAS, most of the web pages are designed to server rich static content with lots of CSS and JS files + dynamic content. How can I set transfer-encoding 'chunked' for my pages? Or in other words:
- How do you decide which page will have
'Transfer-Encoding: chunked'
and how do you set it for that page?
Your personal experience will certainly be valuable for my understanding.
Source: (StackOverflow)
What is the difference between a dead letter Queue and a back out queue?
In WebSphere MQ terms and in terms of Application Servers.
All J2EE/JEE app servers have a MQ Provider do they also have a construct of a Dead Letter Queue or is that something specific to WebSphere MQ?
My understanding of a back out queue is as follows:
If MQ is unable to deliver the message to a destination after a specified number of attempts it moves the message to the back out queue.
I do not have a clear understanding of a Dead Letter queue.
Appreciate any assistance.
Source: (StackOverflow)
I'm trying to convince my providers to use ANT instead of Rational Application Development so anyone can recompile, recheck, redeploy the solution anyplace, anytime, anyhow. :P
I started a build.xml for a project that generates a JAR file but stopped there and I need real examples to compare notes. My good friends! I don't have anyone close to chat about this!
This is my build.xml so far.
(*) I edited my question based in the suggestion of to use pastebin.ca
Source: (StackOverflow)
I'm build a Portlet application deployed to a WebSphere Portal Server running on Linux. Every Portlet WAR uses Log4j for logging with a configuration like this, having every WAR two Log files:
log4j.logger.im.the.package=DEBUG, InfoAppender, DebugAppender
log4j.appender.InfoAppender=org.apache.log4j.RollingFileAppender
log4j.appender.InfoAppender.Threshold=INFO
log4j.appender.InfoAppender.File=/tmp/infoWARName.log
log4j.appender.InfoAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.InfoAppender.layout.ConversionPattern=%d %p [%c] - %m%n
log4j.appender.DebugAppender=org.apache.log4j.RollingFileAppender
log4j.appender.DebugAppender.Threshold=DEBUG
log4j.appender.DebugAppender.File=/tmp/debugWARName.log
log4j.appender.DebugAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.DebugAppender.layout.ConversionPattern=%d %p [%c] - %m%n
After deployment, everything works like charm and log files started filling. After some hours, and at the same time, the Logging stops and info.log
and debug.log
aren't updated at all. We need to redeploy the Portlet WAR in the server to get the logging starting again.
Any ideas?
Update:
I'm starting to suspect it has to do with my Logging JARS. Currently, this are the JAR's inside my WEB-INF/lib
folder:
com.springsource.org.apache.commons.logging-1.1.1.jar
com.springsource.org.apache.log4j-1.2.15.jar
com.springsource.slf4j.api-1.5.6.jar
slf4j-log4j12-1.5.6.jar
Second Update:
At hours from the bounty to end, this is how Log4j is configured in every Portlet Application. Here's web.xml
:
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>classpath:miAppLog4j.properties</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>
And miAppLog4j.properties
file is located in folder external to the WAR and to the Portal. We made it availbale in Portlet Classpath through a Shared Library in WebSphere Portal.
Source: (StackOverflow)
I am trying to get visualvm and websphere 7 to work together on my local windows desktop. I try to connect through JMX but no luck. Has anybody managed to get visialvm and websphere 7 to work and ow did you do it?
Regards
FF
Source: (StackOverflow)
I'm using Websphere Portal 7.0 and creating a portlet with RAD 8.0. My portlet is trying to make a db2 connection to a remote server. I wrote a java program locally to do a basic JDBC connection to the server and get records from a table. The code works fine; however, when I add the code to my portlet as well as the db2jcc4.jar, the connection doesn't work. I'm using the basic:
Connection connection = DriverManager.getConnection("jdbc:db2://server:port/db:user=user;password=pw;");
I figure that using the Websphere datasource is the right way to go. I know the JNDI name for the datasource, but I'm not finding clear cut examples on how to make a connection. Several examples use a DataSource class (I typed this in and this doesn't seem like it comes from a native java package so what import do I use here?) coupled with a Context. I've come across code like:
Context ctx = new InitialContext();
ctx.lookup("jdbc/xxxx");
...
Can someone break this down for me?
EDIT 1
I've updated my code per the answers listed. I really think I'm getting closer. Here is my getConnection() method:
private Connection getConnection() throws SQLException {
javax.naming.InitialContext ctx = null;
javax.sql.DataSource ds = null;
System.out.println("Attempting connection..." + DateUtil.now() );
try {
ctx = new javax.naming.InitialContext();
ds = (javax.sql.DataSource) ctx.lookup("java:comp/env/jdbc/db");
connection = ds.getConnection();
} catch (NamingException e) {
System.out.println("peformanceappraisalstatus: COULDN'T CREATE CONNECTION!");
e.printStackTrace();
}
System.out.println("connection: " + connection.getClass().getName() + " at " + DateUtil.now());
return connection;
}
My entire web.xml file looks like:
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<display-name>PeformanceAppraisalStatus</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<resource-ref>
<description>
Datasource connection to Db</description>
<res-ref-name>jdbc/db</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
</web-app>
I am seeing an error that describes the very thing you guys are telling me Websphere should prompt me to do, but doesn't:
SRVE0169I: Loading Web Module: PeformanceAppraisalStatus.
[8/23/11 18:08:02:166 CDT] 00000009 InjectionProc E CWNEN0044E: A resource reference binding could not be found for the jdbc/db resource reference, defined for the PeformanceAppraisalStatus component.
[8/23/11 18:08:02:169 CDT] 00000009 InjectionEngi E CWNEN0011E: The injection engine failed to process bindings for the metadata.
Yes, I know that I've mispelled performance as peformance throughout the app.
SOLUTION
I was so very close. Here are the missing bits that made it all fall into place:
web.xml:
<resource-ref>
<description>
Datasource connection to db</description>
<res-ref-name>jdbc/db</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
<mapped-name>jdbc/db</mapped-name>
</resource-ref>
ibm-web-bnd.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-bnd
xmlns="http://websphere.ibm.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://websphere.ibm.com/xml/ns/javaee http://websphere.ibm.com/xml/ns/javaee/ibm-web-bnd_1_0.xsd"
version="1.0">
<virtual-host name="default_host" />
<resource-ref name="jdbc/db" binding-name="jdbc/mydatasource" />
</web-bnd>
It appears that the ibm-web-bnd.xml file handles the binding between the project resource name and the datasource in websphere. Once I added the line:
<resource-ref name="jdbc/db" binding-name="jdbc/mydatasource" />
Websphere Portal seemed appeased. My code is working and connecting to the database now.
Source: (StackOverflow)
We have been facing Out of Memory errors in our App server for sometime. We see the used heap size increasing gradually until finally it reaches the available heap in size. This happens every 3 weeks after which a server restart is needed to fix this.
Upon analysis of the heap dumps we find the problem to be objects used in JSPs.
Can JSP objects be the real cause of Appserver memory issues? How do we free up JSP objects (Objects which are being instantiated using usebean or other tags)?
We have a clustered Websphere appserver with 2 nodes and an IHS.
EDIT: The findings above are based on the heap-dump and nativestderr log analysis given below using the IBM support assistant
nativestd err log analysis:
Heap dump analysis:
![alt text][2]
Heap dump analysis showing the immediate dominators (2 levels up of hastable entry in the image above)
![alt text][3]
The last image shows that the immediate dominators are in fact objects being used in JSPs.
EDIT2: More info available at http://saregos.com/?p=43
Source: (StackOverflow)
I get the following error...
Unsupported configuration attributes: [permitAll]
When adding ....
<sec:intercept-url pattern="/nonsecure/**" access="permitAll" />
I'm on Websphere with Spring 2.5.
Can anyone help?
Jeff Porter
Source: (StackOverflow)
Let me explain the set up first.
We have an oracle server running on a 2GB RAM machine. The Db instance has the init parameter "sessions" set to 160.
We have the application deployed on Websphere 6.1. The connection pool settings is Min 50 and Max 150.
When we run Load test on 40 Users (concurrent, using jMeter), everything goes fine.
But when we increase the concurent users to Beyond 60, Oracle throws and exception that it is out of sessions.
We checked the application for any connection leaks but could not find any.
So does it mean that the concurrency of 40 is what this setup can take ? Is increasing the Oracle sessions/process the only way to obtain higher concurrency ?
How exactly are the DB sessions and Connection in the Connection pool related ? In my understanding, the connections cannot exceed the sessions and so setting the Max Connection pool to more than sessions may not really matter. Is that correct ?
Source: (StackOverflow)
I would like to use JConsole to monitor my Websphere application, but I am not sure how to enable JMX.
Source: (StackOverflow)
I am working on a Java application that uses Spring and Hibernate and runs on a Websphere.
I have run into a problem, where I expect Spring to load a Dao into my object, but for some reason that doesn't happen. (Another Dao that is specified in much the same way is loaded fine.)
The question is - how can I debug how Spring decides what to load in?
Can I turn on logging for Spring, and where?
Source: (StackOverflow)