File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Websphere and the fly likes Adjusting ejb-jar.xml settings with Admin UI Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Products » Websphere
Bookmark "Adjusting ejb-jar.xml settings with Admin UI" Watch "Adjusting ejb-jar.xml settings with Admin UI" New topic
Author

Adjusting ejb-jar.xml settings with Admin UI

Terry Jeske
Greenhorn

Joined: Apr 06, 2004
Posts: 17
Hello,
I am fairly new to WS, and am working on an application where a previous developer added code that looked at the ejb-jar.xml file for settings. I guess the hope was/is that certain values can be adjusted w/o a redeploy. However, I cannot find any place on the production environment to adjust these values. Does anyone know if it is possible to ajust these values through some sort of UI on the Admin Console? (our client wants to fiddle with some settings).
TIA
Rufus BugleWeed
Ranch Hand

Joined: Feb 22, 2002
Posts: 1551
Most of the settings in ejb-jar.xml and web.xml are modifiable through the normal administration or deployment of an application. If you would list the code where the developer performed data driven development, I think we could tell you how to mod the app or appserver.
Terry Jeske
Greenhorn

Joined: Apr 06, 2004
Posts: 17
Hi thx for the response,
Still getting my feet wet with WS, so I am not quite sure what you were asking for. Here is the node in the ejb-jar.xml entry. the value that is being read is for blockSize.
<session id="SequenceSession">
<ejb-name>SequenceSession</ejb-name>
<home>il.dba.ejb.sb.SequenceSessionHome</home>
<remote>il.dba.ejb.sb.SequenceSession</remote>
<ejb-class>il.dba.ejb.sb.SequenceSessionBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<env-entry id="EnvEntry_14">
<env-entry-name>blockSize</env-entry-name>
<env-entry-type>java.lang.Integer</env-entry-type>
<env-entry-value>10</env-entry-value>
</env-entry>
<env-entry id="EnvEntry_15">
<env-entry-name>retryCount</env-entry-name>
<env-entry-type>java.lang.Integer</env-entry-type>
<env-entry-value>5</env-entry-value>
</env-entry>
</session>
It is read using the following method in SequenceSessionBean.java
/**
* setSessionContext
*/
public void setSessionContext(javax.ejb.SessionContext ctx) {
mySessionCtx = ctx;
try {
javax.naming.Context namingContext = new javax.naming.InitialContext();
Object o1 = namingContext.lookup("java:comp/env/blockSize");
Object o2 = namingContext.lookup("java:comp/env/retryCount");
_blockSize = ((Integer) namingContext.lookup("java:comp/env/blockSize")).intValue();
_retryCount = ((Integer) namingContext.lookup("java:comp/env/retryCount")).intValue();

_sequenceHome = (il.dba.ejb.eb.SequenceHome) namingContext.lookup("il/dba/ejb/eb/SequenceHome");
}
catch(javax.naming.NamingException e) {
throw new javax.ejb.EJBException(e);
}
}
Hope that is what you were looking for.
Rufus BugleWeed
Ranch Hand

Joined: Feb 22, 2002
Posts: 1551
In ejb-jar.xml these are in DTD syntax
<!ELEMENT env-entry (description?, env-entry-name, env-entry-type,
env-entry-value?)>
where in your case something like
env-entry-name == blockSize
env-entry-type == java.lang.Integer
env-entry-value == 10
Normally this value is set at deployment.
On a given machine the deployment descriptor might be located in a
directory like
C:\ws5\AppServer\config\cells\DELL\applications\
petstore.ear\deployments\petstore\petstore-ejb.jar\META-INF
Now a client can edit this file, stop the application, and restart it through the admin console.
I think that this possible. Hopefully one of the gurus will correct me if I am wrong.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Adjusting ejb-jar.xml settings with Admin UI