Reusing the Initial Context Object
Hi all
Environment: Weblogic 452
JNDI implementation of Weblogic 452 is based on Javasoft JNDI 1.1 and
SPI specifications.(refer: Developer docs for 452).Javadoc of
InitialContext for JNDI 1.1 says (refer -
http://java.sun.com/products/jndi/javadoc/index.html)
An InitialContext instance is not synchronized against concurrent access
by multiple threads. Multiple threads each manipulating their own
InitialContext
instances need not synchronize. Threads that need to access a single
InitialContext instance concurrently should synchronize amongst
themselves
and provide the necessary locking
1. Does reusing the InitialContext object accross threads for lookup and
then execution of remote methods cause any problems? or should we
synchronize access?
How weblogic 452 handles this.
2. Let say i do this
a. get InitialContext
b. do lookup
c. get remote reference
d. close context
e. execute methods on the remote reference got in step c.
does doing d ie..closing context cause problems in step e or later
on....
3. What happens if we dont close the intial context...
Does WLS 452 intelligently garbage collect them and release any
resources held internally by the initial context object?
How much is the overhead?
Is Initial Context heavy ie.. holds resources like sockets/etc...?
thanks in advance
I do not have an exact answer for most of your questions. From my
experience and from research, I would suggest that the following is safe:
Within an HTTP request, instantiate an InitialContext and using it for the
duration of the request only (i.e. same auth info, same thread). I believe
the same holds true for home interfaces. That is within the "web
container", though. The choice of "caching" the context in the "ejb
container" is a even easier for threads (ejb guarantee -- only one thread
with access to your ejb at a time), but harder due to lack of clear spec on
auth issues.
Cameron Purdy, LiveWater
"S Rajesh" <[email protected]> wrote in message
news:[email protected]...
Hi all
Environment: Weblogic 452
JNDI implementation of Weblogic 452 is based on Javasoft JNDI 1.1 and
SPI specifications.(refer: Developer docs for 452).Javadoc of
InitialContext for JNDI 1.1 says (refer -
http://java.sun.com/products/jndi/javadoc/index.html)
An InitialContext instance is not synchronized against concurrent access
by multiple threads. Multiple threads each manipulating their own
InitialContext
instances need not synchronize. Threads that need to access a single
InitialContext instance concurrently should synchronize amongst
themselves
and provide the necessary locking
1. Does reusing the InitialContext object accross threads for lookup and
then execution of remote methods cause any problems? or should we
synchronize access?
How weblogic 452 handles this.
2. Let say i do this
a. get InitialContext
b. do lookup
c. get remote reference
d. close context
e. execute methods on the remote reference got in step c.
does doing d ie..closing context cause problems in step e or later
on....
3. What happens if we dont close the intial context...
Does WLS 452 intelligently garbage collect them and release any
resources held internally by the initial context object?
How much is the overhead?
Is Initial Context heavy ie.. holds resources like sockets/etc...?
thanks in advance
Similar Messages
-
App client can't instantiate the initial context factory
hi
i wrote an application client and a stateless session bean that i deployed with the deploytool from sun to the j2ee application server. now when i start my application client i get the following message:
NoInitialContextException: Cannot instantiate class: COM.sun.enterprise.naming.SerialInitContextFactory. Root exception is java.lang.ClassNotFoundException: COM.sun.enterprise.naming.SerialInitContextFactory
at java.net.URLClassLoader$1.run
my jndi.properties looks like this:
java.naming.factory.initial=COM.sun.enterprise.naming.SerialInitContextFactory
java.naming.factory.url.pkgs=COM.sun.enterprise.naming
and my server runs on the same computer as the client. the classpath variable is set to the j2ee.jar file ( and this file contains the selected initial factory ). i could not understand why i get this errormessage. has anyone a idea?thanks to all
now i got it working. i'm using the orion application server and to get access from a remote computer ( outside the application server ) i have to set the environment properties in the following way:
Properties prop = new Properties();
prop.put(Context.INITIAL_CONTEXT_FACTORY,"com.evermind.server.rmi.RMIInitialContextFactory");
prop.put(Context.PROVIDER_URL,"ormi://localhost/TestBean02");
prop.put(Context.SECURITY_PRINCIPAL,"admin");
prop.put(Context.SECURITY_CREDENTIALS,"123");
InitialContext initial = new InitialContext(prop);
Object objref = initial.lookup("MyBeanel");
home = (TestBeanHome)PortableRemoteObject.narrow(objref, TestBeanHome.class);
this works, the client needs only the j2ee.jar and the orion.jar in the classpath. -
Different ways to get the initial context within the container
Hi there,
Simple question concerning WLS61:
Is there a difference between getting the context like this:
Context ctx = T3Services.getT3Services().name().getInitialContext();
and getting it like:
Context ctx = new InitialContext();
The only difference I see is that the second version is portable.
Is there a performance difference?
Thanks
JuergHi Floris,
You can also use RANK: http://www.dba-oracle.com/oracle_news/oracle_faq/faq_beg_sql_top_n_rows.htm
Regards Pete -
How to organize the context object through out the application process
Hi,
Here in my application is using the following steps for a process.
- Login
- Search
- Update
- Logout
In those above steps, Login, Search, and Update actions are touching to database/LDAP every time. In each time, Im creating new Context object, I think this is a bad approach. When I hit the login, I need to get the connection object and use that for rest of the actions(search and update).
So can we organize the single context object through out the application? And where do we need to close the Context object?Don't worry about it. The provider will reuse connections behind the scenes. They're not tied directly to Contexts.
-
Context object not visible in the Expression Editor
Hi ,
I have created a context object and assigned it to the sender interface ( outbound interface) but i couldn't see the created object in the Expression editor.
Can anyone tell me why it is like this? It shows only the technical context objects .
with Regards
VasSHi Vasagam,
Please try out the following and see if it works:
- Did you set the "Adapter-Specific Message Properties" in the Sender File Communication Channel.You have to select this check box and also select the "File Name" check box(this will be visible once the initially mentioned check box is selected)
- Is the interface to which the context object is assigned an outbound Interface(Sender Interface) in receiver determination? Only then the context object will be visible.
Regards,
abhy -
Reusing the same web dynpro callable object
I have created a web dynpro callable object and I want to reuse the same callable object in all the actions of that process.
I am getting the current action ID in execute() method of interface controller in WDP callable object.Now I want to generate screens for different actions based on that actionID.
for Ex if(actionID ="1")
fireplug to second scrren.
else
to next screen
But I am not getting where to write this If eles condition to get different scrrens at runtime according to the actionID.
Can anyone please help me.hi ritu,
to get the input and output parameter of the callable object in your view you do the following things.
1.you create the context elements in interface controller.
and assign the values of input parameters of the callable object, to the interface controllers context attribute value. using the following code.
IGPStructure input = executionContext.getInputStructure();
wdcontext.currentContextElement().set..urattribute name=input.getAttributeas..type of the attribut("specify your input parameter");
2.then map the context elements of interface controller to component controller,and then component controller context to view context.
Then we will get the input parameters of the callable object in view.
If you want any further clarification on this please explain your scenario detailly.
with regards
shanto aloor -
Error in getting Initial Context
Hello,
I am facing the following exception while trying to get the Initial Context. Following
is the snippet of code that I use for getting the Context -
Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");p.
put(Context.PROVIDER_URL, url);
if (user != null) {
p.put(Context.SECURITY_PRINCIPAL, user);
if (password == null)
password = "";
p.put(Context.SECURITY_CREDENTIALS, password);
return new InitialContext(p);
The following is the exception that I encounter -
javax.naming.AuthenticationException. Root exception is java.lang.SecurityException:
attempting to add an object which is not an instance of java.security.Principal
to a Subject's Principal Set
Am i missing anything. Thanks for your time.
See the attached file for the details of the exception
Thanks,
Ashutosh
[trace.txt]Hi Tim,
If you are running within a browser, you will not have access to anything
outside the sandbox which includes making RMI calls. Try signing the applet.
You can find more information on signing applets on the sun java website.
Regards
Arjuna
"Tim" <[email protected]> wrote in message
news:3c5ab818$[email protected]..
>
I get the following eror when I try to get the Initial Context in anapplet:
>
java.lang.ExceptionInInitializerError: java.security.Acc
ess denied (java.util.PropertyPermission * read,write)
atjava.security.AccessControlContext.checkPermission(AccessControlConte
xt.java:272)
atjava.security.AccessController.checkPermission(AccessController.java:
399)
Does anyone have any idea what would cause this? The code works finerunning
from an application. From what I understand there might be a problem withmy
policy file. However, it seems to look ok. Any ideas? -
Here is some debug output from a simple test I run against a WL6.1
Server. Notice the 35 secs. it takes to get Initial Context.
-- Initializing bean access.
-- Succeeded getting naming context.
-- Execution time: 35047 ms.
-- Succeeded looking up jndi name.
-- Execution time: 453 ms.
-- Succeeded casting Home interface.
-- Execution time: 94 ms.
Second time I run the test from the same machine I get this.
-- Initializing bean access.
-- Succeeded getting naming context.
-- Execution time: 1907 ms.
-- Succeeded looking up jndi name.
-- Execution time: 312 ms.
-- Succeeded casting Home interface.
-- Execution time: 31 ms.
The pattern is consistent. First attempt to get the Initial Context
from any of my client boxes will take about 30 secs more than any
consecutive attempts.
Here is the code for getting the Context:
long startTime = 0;
if (logging) {
log("Initializing bean access.");
startTime = System.currentTimeMillis();
try {
//get naming context
Context ctx = getInitialContext();
if (logging) {
long endTime = System.currentTimeMillis();
log("Succeeded getting naming context.");
log("Execution time: " + (endTime - startTime) + " ms.");
startTime =endTime;
//look up jndi name
Object ref = ctx.lookup("DynamicPool");
if (logging) {
long endTime = System.currentTimeMillis();
log("Succeeded looking up jndi name.");
log("Execution time: " + (endTime - startTime) + " ms.");
startTime =endTime;
//cast to Home interface
dynamicPoolHome = (DynamicPoolHome) PortableRemoteObject.narrow(ref,
DynamicPoolHome.class);
if (logging) {
long endTime = System.currentTimeMillis();
log("Succeeded casting Home interface.");
log("Execution time: " + (endTime - startTime) + " ms.");
catch(Exception e) {
if (logging) {
log("Failed initializing bean access.");
e.printStackTrace();
Am I missing something here ?
Regards,
KlausMy first guess would be a DNS problem.
Also, creating an InitialContext loads a fair amount of classes. If you're
loading them over the network, that could also account for the slow-down.
-- Rob
Klaus Preisler wrote:
Here is some debug output from a simple test I run against a WL6.1
Server. Notice the 35 secs. it takes to get Initial Context.
-- Initializing bean access.
-- Succeeded getting naming context.
-- Execution time: 35047 ms.
-- Succeeded looking up jndi name.
-- Execution time: 453 ms.
-- Succeeded casting Home interface.
-- Execution time: 94 ms.
Second time I run the test from the same machine I get this.
-- Initializing bean access.
-- Succeeded getting naming context.
-- Execution time: 1907 ms.
-- Succeeded looking up jndi name.
-- Execution time: 312 ms.
-- Succeeded casting Home interface.
-- Execution time: 31 ms.
The pattern is consistent. First attempt to get the Initial Context
from any of my client boxes will take about 30 secs more than any
consecutive attempts.
Here is the code for getting the Context:
long startTime = 0;
if (logging) {
log("Initializing bean access.");
startTime = System.currentTimeMillis();
try {
//get naming context
Context ctx = getInitialContext();
if (logging) {
long endTime = System.currentTimeMillis();
log("Succeeded getting naming context.");
log("Execution time: " + (endTime - startTime) + " ms.");
startTime =endTime;
//look up jndi name
Object ref = ctx.lookup("DynamicPool");
if (logging) {
long endTime = System.currentTimeMillis();
log("Succeeded looking up jndi name.");
log("Execution time: " + (endTime - startTime) + " ms.");
startTime =endTime;
//cast to Home interface
dynamicPoolHome = (DynamicPoolHome) PortableRemoteObject.narrow(ref,
DynamicPoolHome.class);
if (logging) {
long endTime = System.currentTimeMillis();
log("Succeeded casting Home interface.");
log("Execution time: " + (endTime - startTime) + " ms.");
catch(Exception e) {
if (logging) {
log("Failed initializing bean access.");
e.printStackTrace();
Am I missing something here ?
Regards,
Klaus -
JNDI obj not binding to initial context--10gRel 2 issue only,works in rel3
hi all,
The issue I am writing about is an issue only in OAS 10g release 2 (10.1.2.0.2) and not in release 3. I have an issue where in I am trying to bind a data source object to the initial context. This data source object reference is created dynamically and is not specified in any XML file (say like web.xml or server.xml). The business requirement driving this is that for each user we need to create a data source dynamically and attach it to the JNDI and then this JNDI name is passed on to Crystal Reports which will use this data source to retrieve its data from the DB. The code for creating the data source dynamically is as below,
private String setDataSource(String username, String password) throws NamingException {
String prefix = "jdbc";
InitialContext ic = new InitialContext();
// Construct BasicDataSource reference
Reference ref = new Reference("javax.sql.DataSource", CustomDataSourceFactory.class.getName(), null);
ref.add(new StringRefAddr("url", xxxxxx));
ref.add(new StringRefAddr("schema",xxxxx));
ref.add(new StringRefAddr("xxxxxx", xxxxx));
ref.add(new StringRefAddr("password", xxxxx));
try {
ic.listBindings(prefix);
} catch (NameNotFoundException exp) {
ic.createSubcontext(prefix);
String datasourceName = prefix + "/" + oneNumber;
ic.rebind(datasourceName, ref);
return datasourceName;
As you can see the reference to the data source is added dynamically. Now when I try to obtain this object by looking up the context for its JNDI name I get a object not found error. This is how I look up the object through my code,
private void testDataSource(String dsName){
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
try {
InitialContext ic = new InitialContext();
javax.sql.DataSource ds = (javax.sql.DataSource) ic.lookup(dsName);
conn = ds.getConnection();
stmt = conn.createStatement();
rs = stmt.executeQuery("select sysdate from dual");
String result = rs.getString(1);
System.out.println("----YOGI----Result of query execution is AAA -----" + result);
} catch (Exception ex ){
System.out.println("----YOGI----the exception from this specific block is " + ex.getLocalizedMessage());
finally {
try {
if (null!= rs)
rs.close();
if(null !=stmt)
stmt.close();
if(null !=conn)
conn.close();
} catch (Exception ex){
System.out.println("Hopeless");
When I do this I get this exception message --> jdbc/1562 not found in MyAPP
jdbc/1562 is the data source JNDI name I generated in the first method and "MyAPP" is the name of my application. I decided to make the JNDI globally available in the context and hence I used "java:global/jdbc/1562" for my datasource name and even that did not work even though the JNDI name is not bound to the application in specific.
I am really at a loss here as this is a simple add/retrieve operation to a object bound to the context. Can someone tell what is wrong here? The same code works fine in release 3 OAS and also in tomcat and websphere. Any help will be appreciated.
Regards,
YogiOK, I seem to be getting a new exception, not sure if I did any change but ran into this exception in the logs,
11/08/24 18:45:08 ----YOGI----the exception from this specific block is javax.naming.Reference cannot be cast to javax.sql.DataSource*
From what I read on the web, this is prevalent in glassfish and jboss. The reason could be that missing j2ee.jar in classpath or duplicate jdbc jars. I added j2ee.jar to my application library in oc4j dint resolve the issue. I removed jdbc jar from the OAS lib folder and restarted, it dint help.
Any other clues, anyone? -
Initial Context Security Issue
Hi, I wonder if someone can help me with this one??
The problem we are experiencing is that we have a remote client that connects
to 2 completely independent Weblogic 6.1 instances, and it appears that, under
certain circumstances, that the initial contexts actually become "confused", so
as to create a situation both initial contexts have been initialized successfully,
and after a while it appears that a connection to server B is attempted with the
principal and credential values of server A, obviously causing account lockouts
seeing as the user account does not exist on server B.
I have established through testing that this condition can be avoided by either
setting InitialContext.SECURITY_AUTHENTICATION = "none" and by not providing InitialContext.SECURITY_PRINCIPAL
and InitialContext.SECURITY_CREDENTIALS values for both client connections, or
by setting InitialContext.SECURITY_AUTHENTICATION = "simple", supplying valid
InitialContext.SECURITY_PRINCIPAL and InitialContext.SECURITY_CREDENTIALS values
for each server, and by reinitializing the InitialContext object before each and
every remote lookup.
We have decided to implement a InitialContext.SECURITY_AUTHENTICATION = "none"
policy, allowing us not to reinitialize the InitialContext objects every single
time. Obviously, this is not the preferred way!
I would appreciate any light on this, as this is causing us huge headaches, not
to mention the fact that one of the connections become completely unusable and
therefore denies any service whatsoever from one of the servers
Thanks in advance!Hi,
This should probably have to be handled with Cisco directly or through the company that got you the license.
To my understanding there is a possibility that the you would first install one license key and the other license might be upgrade from the previous license to the next limit of the licensed feature.
I have had several occasions where I have been provided with the wrong license and have had to contact Cisco/supplier again to get the correct licenses for my device.
While I was posting this reply I checked the Licensing document for the ASA models. It would seem to me that there is no 25 Security Content License for the ASAs. The closes are 20 SC license and 50 SC license
Check this document:
http://www.cisco.com/en/US/docs/security/asa/asa84/configuration/guide/intro_license.html#wp1230400
- Jouni -
How to configure initial-context-factory and provider_url on Websphere MQ
I have a few questions about WebSphere MQ. Currently, my application is able work well with other JMS provider. But I would like to move to use WebSphere instead.
Can anyone suggest me how to configure the application connecting WebSphere?
� I�m using the Initial java naming factory as bellows: com.sun.jndi.fscontext.RefFSContextFactoryIs it the correct class?
� About the java-naming-factory-url, How do I know what object that I should use? I found this example in JMSAdmin.config � iiop://localhost:7555� What�s iiop ?
� What jar file that I should add in my classpath?Hi,
You have a few options...
1. Use WebSphere Application Server as the JNDI provider
2. Don't use JNDI
3. Use the File System Context as the JNDI provider
Exploring these options in a bit more detail...
1. Use WebSphere Application Server as the JNDI provider
Assuming you have WAS, the best way of obtaining your queue is to define the Queue and Queue Connection Factory objects in WAS using the admin console, then obtain them from the Initial Context as per the following article
http://publib.boulder.ibm.com/infocenter/wasinfo/v6r0/index.jsp?topic=/com.ibm.websphere.express.doc/info/exp/ae/rnam_example_prop2.html
If you prefer not to do JNDI lookups in your code a great alternative is to use Spring (www.springframework.org). If you haven't come across spring before it's well worth a look. One of it's many features is a bean factory for creating your objects. There is lots of support for retrieving JMS objects from JNDI, so in the main all you have to do is write some XML similar to the following...
<bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
<property name="environment">
<props>
<prop key="java.naming.factory.initial">${jndi.initialContextFactory}</prop>
<prop key="java.naming.provider.url">${jndi.providerUrl}</prop>
</props>
</property>
</bean>
<bean id="queueConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiTemplate" ref="jndiTemplate"/>
<property name="jndiName" value="${jndi.queueConnectionFactory}"/>
</bean>
<bean id="queueName" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiTemplate" ref="jndiTemplate"/>
<property name="jndiName" value="${jndi.queueName}"/>
</bean>There's a bit more to it than this, but not much. I've been meaning to write a tutorial on this for a while so if you're interested let me know.
2. Don't use JNDI
This approach involves using the creating the native MQ Queue Connection Factory and Queue classes. You can hard code this, but it's much better to abstract it from your application. Again you can use Spring. The definition would look something like the following...
<bean id="MQJMS_TP_CLIENT_MQ_TCPIP"
class="org.springframework.beans.factory.config.FieldRetrievingFactoryBean">
<property name="staticField">
<value>com.ibm.mq.jms.JMSC.MQJMS_TP_CLIENT_MQ_TCPIP</value>
</property>
</bean>
<bean id="queueConnectionFactory" class="com.ibm.mq.jms.MQQueueConnectionFactory">
<property name="transportType" ref="MQJMS_TP_CLIENT_MQ_TCPIP" />
<property name="queueManager" value="${mq.queueManager}" />
<property name="hostName" value="${mq.host}" />
<property name="port" value="${mq.port}" />
<property name="channel" value="${mq.channel}" />
</bean>
<bean id="publishInvoiceQ" class="com.ibm.mq.jms.MQQueue">
<constructor-arg value="${mq.queueName}" />
</bean>
3. Use the File System Context
The file system context is just like a JNDI context, but instead of using a url like iiop://host:port you have to specify a file system url. Because FSContext is just another JNDI context you can still use the spring configuration from option 1, but just change the relevant parameters.
In order to define you queues and queue connection factory using the File System Context, you need to download a swing application called JMS Admin. Get it here
http://www-1.ibm.com/support/docview.wss?rs=171&uid=swg24004691&loc=en_US&cs=utf-8&lang=en
With regards your specific questions...
IIOP is just another communication protocol. If you want more details I'm sure typing "what is iiop" into google will provide plenty of hits.
I'll do my best to answer the remain two tomorrow - I wrote an application a few months ago which used the File System Context, but don't have the details to hand. -
hi everybody,
i am new to this forum. any body help me to solve the problem
i am trying to communicate statelessbean with console client thro' weblogic 8.1 server. but i got an error during initial context object creation time. that error is
Exception in thread "main" java.lang.NoClassDefFoundError: javax/security/auth/callback/CallbackHandler
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFactory.java:131)
at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.init(Unknown Source)
at javax.naming.InitialContext.<init>(Unknown Source)
at com.anand.StateLess.HelloTestClient.getContextInfo(HelloTestClient.java:61)
at com.anand.StateLess.HelloTestClient.main(HelloTestClient.java:104)
kindly give me a solution
thanx in advance
bye
regards
muruganandamThis is what I get when I started the agents, I am using weblogic8.1 . Are we missing any other jars in the classpath.
Exception in thread "main" java.lang.NoClassDefFoundError: javax/security/auth/callback/CallbackHandler
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFactory.java:131)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:665)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:246)
at javax.naming.InitialContext.init(InitialContext.java:222)
at javax.naming.InitialContext.<init>(InitialContext.java:198)
at javax.naming.directory.InitialDirContext.<init>(InitialDirContext.java:83)
at com.yantra.interop.util.YIFMessageBrowser.getInitialDirContext(YIFMessageBrowser.java:212)
at com.yantra.interop.util.YIFMessageBrowser.init(YIFMessageBrowser.java:156)
at com.yantra.interop.util.YIFMessageBrowser.<init>(YIFMessageBrowser.java:85)
at com.yantra.ycp.agent.server.YCPAgentTrigger.queueHasMessages(YCPAgentTrigger.java:101)
at com.yantra.ycp.agent.server.YCPAgentTrigger.hasTrigger(YCPAgentTrigger.java:113)
at com.yantra.ycp.agent.server.YCPAgentTrigger.sendMessage(YCPAgentTrigger.java:74)
at com.yantra.ycp.agent.server.YCPAgentTrigger.main(YCPAgentTrigger.java:53) -
Initial context lookup error??
hi, i keep having a problem with the initial context lookup .
my bean is RoomManagerBean and its JNDI is IRMS/hotel/RoomManagerBean.
this is the code:
Object obj = context.lookup("IRMS/hotel/RoomManagerBean");
however, the result is always NULL. when i try to edit the path to:
Object obj = context.lookup("java:comp/env/IRMS/hotel/RoomManagerBean");
, i will get the error: object not bound to name: java:comp/env/IRMS/hotel/RoomManagerBean
is it becasue my path name is wrong? or the JNDI name? pls help me with this, highly appreciated :)ok here's my web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>
index.jsp
</welcome-file>
</welcome-file-list>
<ejb-local-ref>
<ejb-ref-name>IRMS/hotel/RoomManager</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local-home>IRMS.hotel.RoomManagerLocalHome</local-home>
<local>IRMS.hotel.RoomManagerLocal</local>
<ejb-link>IRMS-EJBModule.jar#RoomManager</ejb-link>
</ejb-local-ref>
</web-app>
as u can see, the ejb ref is there. however, when i try to run the file, it gives me the error: Unresolved: <ejb-link>. what does it mean and how to solve it? because i checked the JNDI name for room manager, it's IRMS/hotel/RoomManager. and under the ejb-jar.xml, here is a portion of it in relation to the roommanager:
<session>
<display-name>RoomManagerSB</display-name>
<ejb-name>RoomManager</ejb-name>
<local-home>IRMS.hotel.RoomManagerLocalHome</local-home>
<local>IRMS.hotel.RoomManagerLocal</local>
<ejb-class>IRMS.hotel.RoomManagerEJB</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Bean</transaction-type>
<ejb-local-ref>
<ejb-ref-name>ejb/Room</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<local-home>IRMS.hotel.RoomLocalHome</local-home>
<local>IRMS.hotel.RoomLocal</local>
<ejb-link>Room</ejb-link>
</ejb-local-ref>
<ejb-local-ref>
<ejb-ref-name>IRMS/hotel/Room</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<local-home>IRMS.hotel.RoomLocalHome</local-home>
<local>IRMS.hotel.RoomLocal</local>
<ejb-link>Room</ejb-link>
</ejb-local-ref>
<ejb-local-ref>
<ejb-ref-name>IRMS/hotel/Room</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<local-home>IRMS.hotel.RoomLocalHome</local-home>
<local>IRMS.hotel.RoomLocal</local>
<ejb-link>Room</ejb-link>
</ejb-local-ref>
<ejb-local-ref>
<ejb-ref-name>IRMS/hotel/RoomManager</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local-home>IRMS.hotel.RoomManagerLocalHome</local-home>
<local>IRMS.hotel.RoomManagerLocal</local>
<ejb-link>RoomManager</ejb-link>
</ejb-local-ref>
</session>
can u solve this? thanks -
Hi!
I am using a jndi initial context object to lookup my ejbs in weblogic.
There are places, where I initialize the initial context differently. I was
wondering if it's ok to do that.
For example,
Scenario A:
InitialContext context = new InitialContext();
context.lookup("some bean");
Scenario B:
HashMap prop = new HashMap();
prop.set(contextFactory, ...);
prop.set(providerUrl, ...);
InitialContext context = new InitialContext();
context.lookup("some bean");
Should I foresee any kind of problems with Scenario A. Does weblogic know
what context factory and provider url to use if I don't mention it.
Thanks in advance,
VanIf you are creating InitialContext inside the container, you
do not need to specify any properties - it is container's responsibility
to set them up.
van saravanan <[email protected]> wrote:
Hi!
I am using a jndi initial context object to lookup my ejbs in weblogic.
There are places, where I initialize the initial context differently. I was
wondering if it's ok to do that.
For example,
Scenario A:
InitialContext context = new InitialContext();
context.lookup("some bean");
Scenario B:
HashMap prop = new HashMap();
prop.set(contextFactory, ...);
prop.set(providerUrl, ...);
InitialContext context = new InitialContext();
context.lookup("some bean");
Should I foresee any kind of problems with Scenario A. Does weblogic know
what context factory and provider url to use if I don't mention it.
Thanks in advance,
Van--
Dimitri -
I was running the example that this in the tutorial but I am having problems.
The code is:
public static void main(String[] args) {
String name = "autoexec.bat";
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.ldap.LdapCtxFactory");
try {
// Create the initial context
Context ctx = new InitialContext(env);
// Look up an object
Object obj = ctx.lookup(name);
// Print it
System.out.println(name + " is bound to: " + obj);
} catch (NamingException e) {
System.err.println("Problem looking up " + name + ": " + e);
And the error is:
Problem looking up autoexec.bat: javax.naming.CommunicationException: localhost:389 [Root exception is java.net.ConnectException: Connection refused: connect]you are trying to connect to an LDAP directory server, but obviously there is no such server running on your machine.
If you want to work with LdapCtxFactory, you need an LDAP server, e.g. openldap, which is included in most LINUX distributions (see also www.openldap.org).
Maybe you are looking for
-
I am running OS 10.6.7 on an iMac.
-
Loading xml file to javascript
hi, i want to load xml file from javascript and to get the tree structure dynamically.. xml file is: <?xml version="1.0"?> <personal>Personal Details <name>Premshree Pillai</name> <***>male</***> <websites>Websites
-
Hi, experts Sometimes after I did goods receipt with MIGO for purchsing order, the TR was not created by system. Normally after MIGO system create material document and TR at same time, then I use LT06 with reference the document no. place it to the
-
Module Pool - I/O fields - Two different kinds of display
Hello Everyone, In order to distinguish the texts in I/O (default and entered by the User), I am trying to change the Font / Color etc. in I/O fields I have tried implementing class CL_DD_AREA but that doesnt fulfill all the charateristics required f
-
Material to material stock transfer
Is it possible to do material to material stock transfer when the material that is being transfered to recieving material is in Quality?. I am getting error in doing so. Please advice. Thanks, Sam