NamingException and ClassCastException during jndi lookup
Hi,
I am trying to access the SAP database(MaxDb)using JNDI lookup in WebDynpro simple java project.
But, during lookup I am getting the following error
com.sap.engine.services.jndi.persistent.exceptions.NamingException: Exception during lookup operation of object with name : jdbc/VSLOOKUP , can not resolve object reference [Root exception is java.lang.ClassCastException]
at com.sap.engine.services.jndi.implclient.ClientContext.lookup(ClientContext.java:469)
at com.sap.engine.services.jndi.implclient.ClientContext.lookup(ClientContext.java:558)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at com.vitalspring.healthbenefits.dbaccess.DBAccessHelper.main(DBAccessHelper.java:51)
Caused by: java.lang.ClassCastException
at com.sap.engine.services.connector.ResourceObjectFactory.getObjectInstance(ResourceObjectFactory.java:149)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:301)
at com.sap.engine.services.jndi.implclient.ClientContext.lookup(ClientContext.java:466)
... 3 more
Can anybody throw some light on it?
Because, it's urgent for my project.
I would appreciate any kind of help in this regard.
Thanks & Regards,
Rambabu Kancharla
Hello Anilkumar,
Sorry for delay in reply as I was on out of work and didn't get chance to check the SDN forums.
I was able to do it in latest version sneak preview 11.
I think the problem with the version.
Thanks,
Rambabu
Similar Messages
-
Hello everyone,
I developed a Web Service prototype accessing remote EJB using the EJB
control with special syntax in the jndi-name attribute: @jws:ejb
home-jndi-name="t3://10.10.245.70:7131/AccountDelegatorEJB"
Everything works fine, but I get an error when I restrict access to my web
service with a declarative security model by implementing steps provided in
help doc:
- Define the web resource you wish to protect
- Define which security role is required to access the web resource
- Define which users are granted the required security role
- Configure WebLogic Server security for my web service(Compatibility
Security/Users)
I launch the service by entering the address in a web browser. When prompted
to accept the digital certificate, click Yes, when prompted for network
authentication information, enter username and password, navigate to the
Test Form tab of Test View, invoke the method by clicking the button and I
get the following exception:
<error>
<faultcode>JWSError</faultcode>
<faultstring>Error during JNDI lookup from
jndi:t3://10.10.245.70:7131/AccountDelegatorEJB[Lookup failed for
name:t3://10.10.245.70:7131/AccountDelegatorEJB]</faultstring>
<detail>
<jwErrorDetail> weblogic.jws.control.ControlException: Error during JNDI
lookup from jndi:t3://10.10.245.70:7131/AccountDelegatorEJB[Lookup failed
for name:t3://10.10.245.70:7131/AccountDelegatorEJB] at
weblogic.knex.control.EJBControlImpl.acquireResources(EJBControlImpl.java:27
8) at
weblogic.knex.context.JwsInternalContext.acquireResources(JwsInternalContext
.java:220) at
weblogic.knex.control.ControlHandler.invoke(ControlHandler.java:260) at
ibas.AccountControl.getTransactionHistory(AccountControl.ctrl) at
ibas.GetSecure.retrieveVisaHistoryTxn(GetSecure.jws:64) </jwErrorDetail>
</detail>
</error>
I have a simple Hello method as well in my WebService (which is also
restricted) and it works fine, but remote EJB access doesn't. I tested my
prototype on Weblogic 7.2 and 8.1 platforms - same result.
Is that a bug or I am missing some additional configuration in order to get
that working. Has anyone seen similar behavior? Is there a known resolution?
Or a suggested way to work around the problem?
Thank you.
AndreAndre,
It would be best if this issue is handled as an Eval Support case. Please
BEA Customer Support at http://support.beasys.com along with the required
files, and request that an Eval support case be created for this issue.
Thanks
Raj Alagumalai
WebLogic Workshop Support
"Andre Shergin" <[email protected]> wrote in message
news:[email protected]...
Anurag,
I removed "t3", still get an error but a different one (Unable to create
InitialContext:null):
<error>
<faultcode>JWSError</faultcode>
<faultstring>Error during JNDI lookup from
jndi://secuser1:[email protected]:7131/AccountDelegatorEJB[Unable to
create InitialContext:null]</faultstring>
<detail>
<jwErrorDetail> weblogic.jws.control.ControlException: Error during JNDI
lookup from
jndi://secuser1:[email protected]:7131/AccountDelegatorEJB[Unable to
create InitialContext:null] at
weblogic.knex.control.EJBControlImpl.acquireResources(EJBControlImpl.java:27
8) at
weblogic.knex.context.JwsInternalContext.acquireResources(JwsInternalContext
.java:220) at
weblogic.knex.control.ControlHandler.invoke(ControlHandler.java:260) at
ibas.AccountControl.getTransactionHistory(AccountControl.ctrl) at
ibas.GetVisaHistoryTransactions.getVisaHistoryTxn(GetVisaHistoryTransactions
.jws:67) </jwErrorDetail>
</detail>
</error>
Note: inter-domain communication is configured properly. The Web Service to
remote EJB works fine without a declarative security.
Any other ideas?
Thank you for your help.
Andre
"Anurag" <[email protected]> wrote in message
news:[email protected]...
Andre,
It seems you are using the URL
jndi:t3://secuser1:[email protected]:7131/AccountDelegatorEJB
whereas you should not be specifying the "t3:" protocol.
The URL should be like
jndi://secuser1:[email protected]:7131/AccountDelegatorEJB
Please do let me know if you see any issues with this.
Note that this will only allow you to access remote EJBs in the same WLS
domain. For accessing EJBs on another domain, you need to configure
inter-domain communication by
following a few simple steps as mentioned at
http://e-docs.bea.com/wls/docs81/ConsoleHelp/jta.html#1106135. This link has
been provided in the EJB Control Workshop documentation.
Regards,
Anurag
"Andre Shergin" <[email protected]> wrote in message
news:[email protected]...
Raj,
I tried that before, it didn't help. I got similar error message:
<error>
<faultcode>JWSError</faultcode>
<faultstring>Error during JNDI lookup from
jndi:t3://secuser1:[email protected]:7131/AccountDelegatorEJB[Lookup
failed for
name:t3://secuser1:[email protected]:7131/AccountDelegatorEJB]</faultstr
ing>
<detail>
<jwErrorDetail> weblogic.jws.control.ControlException: Error during JNDI
lookup from
jndi:t3://secuser1:[email protected]:7131/AccountDelegatorEJB[Lookup
failed for
name:t3://secuser1:[email protected]:7131/AccountDelegatorEJB] at
weblogic.knex.control.EJBControlImpl.acquireResources(EJBControlImpl.java:27
8) at
weblogic.knex.context.JwsInternalContext.acquireResources(JwsInternalContext
.java:220) at
weblogic.knex.control.ControlHandler.invoke(ControlHandler.java:260) at
ibas.AccountControl.getTransactionHistory(AccountControl.ctrl) at
ibas.GetSecure.retrieveVisaHistoryTxn(GetSecure.jws:64) </jwErrorDetail>
</detail>
</error>
Anything else should I try?
P.S. AccountDelegatorEJB, the remote EJB my Web Service calls is NOTaccess
restricted.
I hope there is a solution.
Thanks,
Andre
"Raj Alagumalai" <[email protected]> wrote in message
news:[email protected]...
Andre,
Can you try using the following url with username and password
jndi://username:password@host:7001/my.resource.jndi.object ?
once you add webapp level security, the authenticated is the user who
invokes the EJB.
http://e-docs.bea.com/workshop/docs81/doc/en/workshop/guide/controls/ejb/con
CreatingANewEJBControl.html?skipReload=true
has more info on using remote EJB's.
Hope this helps.
Thanks
Raj Alagumalai
WebLogic Workshop Support
"Alla Resnik" <[email protected]> wrote in message
news:[email protected]...
Hello everyone,
I developed a Web Service prototype accessing remote EJB using the EJB
control with special syntax in the jndi-name attribute: @jws:ejb
home-jndi-name="t3://10.10.245.70:7131/AccountDelegatorEJB"
Everything works fine, but I get an error when I restrict access to my
web
service with a declarative security model by implementing steps
provided
in
help doc:
- Define the web resource you wish to protect
- Define which security role is required to access the web resource
- Define which users are granted the required security role
- Configure WebLogic Server security for my web service(Compatibility
Security/Users)
I launch the service by entering the address in a web browser. Whenprompted
to accept the digital certificate, click Yes, when prompted for
network
authentication information, enter username and password, navigate tothe
Test Form tab of Test View, invoke the method by clicking the buttonand
I
get the following exception:
<error>
<faultcode>JWSError</faultcode>
<faultstring>Error during JNDI lookup from
jndi:t3://10.10.245.70:7131/AccountDelegatorEJB[Lookup failed for
name:t3://10.10.245.70:7131/AccountDelegatorEJB]</faultstring>
<detail>
<jwErrorDetail> weblogic.jws.control.ControlException: Error during
JNDI
lookup from jndi:t3://10.10.245.70:7131/AccountDelegatorEJB[Lookupfailed
for name:t3://10.10.245.70:7131/AccountDelegatorEJB] at
weblogic.knex.control.EJBControlImpl.acquireResources(EJBControlImpl.java:27
8) at
weblogic.knex.context.JwsInternalContext.acquireResources(JwsInternalContext
.java:220) at
weblogic.knex.control.ControlHandler.invoke(ControlHandler.java:260)at
ibas.AccountControl.getTransactionHistory(AccountControl.ctrl) at
ibas.GetSecure.retrieveVisaHistoryTxn(GetSecure.jws:64)</jwErrorDetail>
</detail>
</error>
I have a simple Hello method as well in my WebService (which is also
restricted) and it works fine, but remote EJB access doesn't. I testedmy
prototype on Weblogic 7.2 and 8.1 platforms - same result.
Is that a bug or I am missing some additional configuration in order
to
get
that working. Has anyone seen similar behavior? Is there a knownresolution?
Or a suggested way to work around the problem?
Thank you.
Andre -
Javax.naming.NamingException: Failed in WD JNDI lookup
Hi,
I have deployed wdj applications,some times its working fine ,but some other times its through the following errors.
javax.naming.NamingException: Failed in WD JNDI lookup
Any one please suggest me
Thanks,
VenuHi Friend,
I am not sure what Other Reason can be for this problem mean while check these links. Hope it will help.
/message/6928201#6928201 [original link is broken]
/message/6315352#6315352 [original link is broken]
Regards
Jeetendra -
SOAP Handler and ClassCastException during Header Processing
Hello,
I am getting a ClassCastException when trying to process the SOAPHeader in a SOAP
handler. I tried the following...inside the handleRequest(MessageContext context)
method:
SOAPPart soapPart=null;
SOAPEnvelope soapEnvelope=null;
SOAPHeader soapHeader=null;
SOAPMessageContext soapContext=(SOAPMessageContext) context;
System.out.println("handleRequest");
SOAPMessage soapMessage=soapContext.getMessage();
System.out.println("SOAPMessage: "+soapMessage.toString());
try
soapPart=soapMessage.getSOAPPart();
soapEnvelope=soapPart.getEnvelope();
soapHeader=soapEnvelope.getHeader();
System.out.println("SOAPHeader: "+soapHeader.toString());
soapHeader.addTextNode("CustomNode");
Iterator allHeaders=soapHeader.examineHeaderElements("http://someuri.com");
The examineHeaderElements throws a ClassCastException, no matter what method gets
invoked on the soapHeader object. I tried casting this to the weblogic.webservice.core....
implemented objects. The result is the same.
I appreciate any help.
Thanks,
Adam
Athi D. Athimuthu
[WLSSOAPHeaderIssue.txt]Hi Mike,
Thank you for your response. Yes, I was trying to cast the elements returned from
examineHeaderElements to SOAPHeaderElement. This was throwing a ClassCastException.
Now, I am using
soapHeader.getChildElements(nodeName)
This seems to work fine. Where I created the nodeName through SOAPEnvelope's createNode()
method. Don't know what the original problem was. But, now I avoided using that
API. Will let you know if I get any more information.
Regards,
Adam
"Michael Wooten" <[email protected]> wrote:
>
Hi Adam,
The java.util.Iterator returned from the examineHeaderElements() method,
should
contain javax.xml.soap.SOAPHeaderElement objects. Is that what you are
trying
to cast to?
Regards,
Mike Wooten
"Adam Athimuthu" <[email protected]> wrote:
Hello,
I am getting a ClassCastException when trying to process the SOAPHeader
in a SOAP
handler. I tried the following...inside the handleRequest(MessageContext
context)
method:
SOAPPart soapPart=null;
SOAPEnvelope soapEnvelope=null;
SOAPHeader soapHeader=null;
SOAPMessageContext soapContext=(SOAPMessageContext) context;
System.out.println("handleRequest");
SOAPMessage soapMessage=soapContext.getMessage();
System.out.println("SOAPMessage: "+soapMessage.toString());
try
soapPart=soapMessage.getSOAPPart();
soapEnvelope=soapPart.getEnvelope();
soapHeader=soapEnvelope.getHeader();
System.out.println("SOAPHeader: "+soapHeader.toString());
soapHeader.addTextNode("CustomNode");
Iterator allHeaders=soapHeader.examineHeaderElements("http://someuri.com");
The examineHeaderElements throws a ClassCastException, no matter what
method gets
invoked on the soapHeader object. I tried casting this to the weblogic.webservice.core....
implemented objects. The result is the same.
I appreciate any help.
Thanks,
Adam
Athi D. Athimuthu -
5.1sp8
I always thought that cost of a local JNDI lookup is pretty
small, but just found that it is not:
application JSP's extend common superclass which does(did!) JNDI
lookup based on the URI and sets a threadlocal variable before
invoking jspservice() method.
During performance testing replacing JNDI with a static hashtable
improved thoughput by ~25-30% (pages themselves are very fast -
mostly jsp cache tags hits).
Weird.
DimitriFirst of all I am not caching the Initial Context. I am caching the results
of the initial context lookup into a hashmap (I have changed this from
hashtable, which I proposed originally in my posting - see my latest post).
Second, if you have client running in seperate JVM, can not lookup the
hashmap created by the server.
Third, on the server side, you cannot get a reference of a startup class.
The server simply instantiates the class and invoke startup() method (from
T3StartupDef interface) and it does not keep reference after startup()
method returns. But you could use another class that you want to get an
instance of by creating it within the startup class and provide a static
method to create/return that instance. I guess the proper way of saying it
would be create the hashmap as a class variable in a singleton class
(hopefully you get the idea)...
.raja
-----Original Message-----
From: Mittal, Raj [mailto:[email protected]]
Sent: Wednesday, June 20, 2001 1:16 PM
To: '[email protected]'
Subject: Re: cost of a local JNDI lookup
Raja,
We are also wrapping all the JNDI requirements in a startup class and WL
loads it automatically. Now my problem is how to access the InitalContext
(initialized by startup class) by a client and also on the server side. If
you have any code that explains that, please pass it along.
Thanks
Raj Mittal
Front Office Group
NEUBERGER BERMAN
*(646) 497-4224
"Raja Mukherjee" <[email protected]> wrote in message
news:[email protected]...
Mike,
Thanks for the reply to the previous message. For the particularbenchmark,
I knew all the JNDI lookup requirements at the design time (I think that
would be the case in most applications), so I wrapped them into a startup
class.
.raja
"mike " <[email protected]> wrote in message
news:[email protected]...
In the code where you need the context ...
static Hashtable h=new Hashtable();
ctx=h.get(ctx_name);
if(ctx == null){
ctx=new InitialContext(... args ...);
h.put(ctx_name, ctx);
mike
Kirk Everett <[email protected]> wrote:
Can you explan what you mean by "use a static hash table"? We did some
load
testing on 6.0 SP 1 and saw that
creating an local initial context is fairly costly and I would like to
understand your solution. Thanks.
Kirk
Raja Mukherjee wrote:
Dimitri,
I was surprised to see that in WLS 5.1. I have seen this on 6.0 and
understood that JNDI lookups need to be sereilized because of the newclass
loader. In the recent benchmark, for 6.0 we found that the about
15-20%
of
the (client's) application CPU time was spent on JNDI lookup
(serealization). We changed it to a static hash table.
Unfortunately, I am only seeing marginal gain in 5.1sp8.
For all 6.0 applications we are going to use static hashtable. Mightas well
do it now for 5.1 so that your migration to 6.0 will be easier :).
.raja
"Daniel Hoppe" <[email protected]> wrote in message
news:[email protected]...
This is irritating. If I remember correctly, until now the official
statement was that it's not even worth caching an InitialContext ifit's
a local one. Guess I'll have to review my application for this as
well.
>>>>
Daniel
-----Ursprüngliche Nachricht-----
Von: Dimitri Rakitine [mailto:[email protected]]
Bereitgestellt: Freitag, 15. Juni 2001 05:17
Bereitgestellt in: performance
Unterhaltung: cost of a local JNDI lookup
Betreff: cost of a local JNDI lookup
5.1sp8
I always thought that cost of a local JNDI lookup is pretty
small, but just found that it is not:
application JSP's extend common superclass which does(did!) JNDI
lookup based on the URI and sets a threadlocal variable before
invoking jspservice() method.
During performance testing replacing JNDI with a static hashtable
improved thoughput by ~25-30% (pages themselves are very fast -
mostly jsp cache tags hits).
Weird.
Dimitri -
Objects returned via JNDI Lookup
All,
I have had this nagging question in my head about JNDI lookups for some time
now, but haven't had the time to do the proper research. The question is
simple.
The setup is simple as well. Suppose that we have a typical WLS setup, with
WLS running in a JVM on a server host somewhere, with objects bound to its
JNDI tree (we'll leave clustering out of the picture for simplicity's sake),
and we also have a WLS client Java application. The client connects to WLS
and performs various JNDI lookups on the server. Some of these objects
implement java.io.Serializable, some do not.
The question is, if the client uses JNDI to lookup an object that exsts in a
separate JVM, and that object does not implement Serializable, how does this
object come to be instantiated on the client?
This leads to a second question: What exactly is getting returned from a
JNDI lookup? A reference to an object or a copy of it? I can see that
lookups within a single JVM would return a reference, but the cross-JVM
lookup is less clear to me.
Any and all help appreciated,
-jcThis leads to a second question: What exactly is getting returned from a
JNDI lookup?From how I understand it, only Serializable objects are returned such as RMI
stubs, which serve as proxies to EJB or other RMI servers registered in JNDI.
- Thomas
(ex-BONY too)
Jonathan Castellani wrote:
All,
I have had this nagging question in my head about JNDI lookups for some time
now, but haven't had the time to do the proper research. The question is
simple.
The setup is simple as well. Suppose that we have a typical WLS setup, with
WLS running in a JVM on a server host somewhere, with objects bound to its
JNDI tree (we'll leave clustering out of the picture for simplicity's sake),
and we also have a WLS client Java application. The client connects to WLS
and performs various JNDI lookups on the server. Some of these objects
implement java.io.Serializable, some do not.
The question is, if the client uses JNDI to lookup an object that exsts in a
separate JVM, and that object does not implement Serializable, how does this
object come to be instantiated on the client?
This leads to a second question: What exactly is getting returned from a
JNDI lookup? A reference to an object or a copy of it? I can see that
lookups within a single JVM would return a reference, but the cross-JVM
lookup is less clear to me.
Any and all help appreciated,
-jc -
EJB 3.0 and jndi lookup (simple question)
hi all,
i am newbie on Weblogic Application Server and i have some issues,
i have weblogic application server 10.0, also i have oracle timesten in-memory database, i have configured datasource and deploy my ejb 3.0 application, but i could not done jndi lookup?
here is my example:
1. one stateless session bean :
import javax.ejb.Remote;
@Remote
public interface InsertSubscriber {
public void insertSubscriber(SubscriberT subscriberT);
} 2. here is it's implementation :
@Remote(InsertSubscriber.class)
@Stateless
public class InsertSubscriberBean implements InsertSubscriber {
@PersistenceContext(unitName = "TimesTenDS")
private EntityManager oracleManager;
public void insertSubscriber(SubscriberT subscriber)
try {
System.out.println("started");
oracleManager.persist(subscriber);
System.out.println("end");
} catch (Exception e) {
e.printStackTrace();
}3 and my test client :
public class Client {
public static void main(String[] args) {
Context ctx = null;
Hashtable ht = new Hashtable();
ht.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
ht.put(Context.PROVIDER_URL, "t3://192.9.200.222:7001");
try {
ctx = new InitialContext(ht);
InsertSubscriber usagefasade = (InsertSubscriber) ctx
.lookup("ejb.InsertSubscriberBean");
} catch (NamingException e) {
e.printStackTrace();
} finally {
try {
ctx.close();
} catch (Exception e) {
e.printStackTrace();
}what i did incorrect ???
i got error like this : Name not fount exception
when i tried to view jndi tree on weblogic server application console i found this :
Binding Name:
TimestenExampleTimestenExample_jarInsertSubscriberBean_InsertSubscriber
Class:
test.InsertSubscriberBean_o7jk9u_InsertSubscriberImpl_1000_WLStub
Hash Code:
286
toString Results:
weblogic.rmi.internal.CollocatedRemoteRef - hostID: '2929168367193491522S::billing_domain:AdminServer', oid: '286', channel: 'null'what does it mean how i can done lookup to jndi ?
Regards,
Paata Lominadze,
Magticom LTD.
Georgia.Hi All,
I am using the weblogic cluster with session replication and EJB 2.0 with Local entity beans.
for fail-over session should be replicated to another server so we can achive the same session if 1st server fails.
Suppose i m using two managed server(server1,server2) in the cluster.I am storing the object of class ABC into session and object contains the instance of Local-EntityBean home but i put that as a transient.I have also override the readObject and write object method.
when write object is called on 1st server,readObject method should be called on second server so we will be sure that session is replicating properly.
pleaase find the code below : -
public IssuerPageBean() {
initEJB();
private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException {
stream.defaultReadObject();
initEJB();
initializeCommonObject();
private void writeObject(java.io.ObjectOutputStream stream) throws IOException {
stream.defaultWriteObject();
private void initEJB() {
try {
ic = new InitialContext();
issuerHome = (LocalIssuerHome) ic.lookup("java:comp/env/Issuer");
} catch (NamingException e) {
e.printStackTrace();
in my case if i am calling the constructor IssuerPageBean(),it calls the initEJB() method and lookeup the entity local home properly but when readObject method is called on another server only initEJB() method is called directly and getting the exception below :
WARNING: Error during create -
javax.naming.NameNotFoundException: remaining name: env/ejb/Client
at weblogic.j2eeclient.SimpleContext.resolve(Ljavax/naming/Name;Z)Ljavax/naming/Context;(SimpleContext.java:35)
at weblogic.j2eeclient.SimpleContext.resolve(Ljavax/naming/Name;)Ljavax/naming/Context;(SimpleContext.java:39)
at weblogic.j2eeclient.SimpleContext.lookup(Ljavax/naming/Name;)Ljava/lang/Object;(SimpleContext.java:57)
at weblogic.j2eeclient.SimpleContext.lookup(Ljavax/naming/Name;)Ljava/lang/Object;(SimpleContext.java:57)
at weblogic.j2eeclient.SimpleContext.lookup(Ljava/lang/String;)Ljava/lang/Object;(SimpleContext.java:62)
at weblogic.jndi.factories.java.ReadOnlyContextWrapper.lookup(Ljava/lang/String;)Ljava/lang/Object;(ReadOnlyCont
extWrapper.java:45)
at weblogic.jndi.internal.AbstractURLContext.lookup(Ljava/lang/String;)Ljava/lang/Object;(AbstractURLContext.jav
a:130)
at javax.naming.InitialContext.lookup(Ljava/lang/String;)Ljava/lang/Object;(InitialContext.java:347)
at com.lb.equities.veda.tools.salesvault.jsp.ClientPageBean.initEJB()V(ClientPageBean.java:218)
at com.lb.equities.veda.tools.salesvault.jsp.ClientPageBean.readObject(Ljava/io/ObjectInputStream;)V(ClientPageB
ean.java:191)
at java.lang.LangAccessImpl.readObject(Ljava/lang/Class;Ljava/lang/Object;Ljava/io/ObjectInputStream;)V(Unknown
Source)
at java.io.ObjectStreamClass.invokeReadObject(Ljava/lang/Object;Ljava/io/ObjectInputStream;)V(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Ljava/lang/Object;Ljava/io/ObjectStreamClass;)V(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Z)Ljava/lang/Object;(Unknown Source)
at java.io.ObjectInputStream.readObject0(Z)Ljava/lang/Object;(Unknown Source)
at java.io.ObjectInputStream.readObject()Ljava/lang/Object;(Unknown Source)
at java.util.HashMap.readObject(Ljava/io/ObjectInputStream;)V(Unknown Source)
at java.lang.LangAccessImpl.readObject(Ljava/lang/Class;Ljava/lang/Object;Ljava/io/ObjectInputStream;)V(Unknown
Source)
at java.io.ObjectStreamClass.invokeReadObject(Ljava/lang/Object;Ljava/io/ObjectInputStream;)V(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Ljava/lang/Object;Ljava/io/ObjectStreamClass;)V(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Z)Ljava/lang/Object;(Unknown Source)
at java.io.ObjectInputStream.readObject0(Z)Ljava/lang/Object;(Unknown Source)
at java.io.ObjectInputStream.defaultReadFields(Ljava/lang/Object;Ljava/io/ObjectStreamClass;)V(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Ljava/lang/Object;Ljava/io/ObjectStreamClass;)V(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Z)Ljava/lang/Object;(Unknown Source)
at java.io.ObjectInputStream.readObject0(Z)Ljava/lang/Object;(Unknown Source)
at java.io.ObjectInputStream.readObject()Ljava/lang/Object;(Unknown Source)
at weblogic.common.internal.ChunkedObjectInputStream.readObject()Ljava/lang/Object;(ChunkedObjectInputStream.jav
a:120)
at weblogic.rjvm.MsgAbbrevInputStream.readObject(Ljava/lang/Class;)Ljava/lang/Object;(MsgAbbrevInputStream.java:
121)
at weblogic.cluster.replication.ReplicationManager_WLSkel.invoke(ILweblogic/rmi/spi/InboundRequest;Lweblogic/rmi
/spi/OutboundResponse;Ljava/lang/Object;)Lweblogic/rmi/spi/OutboundResponse;(Unknown Source)
at weblogic.rmi.internal.BasicServerRef.invoke(Lweblogic/rmi/extensions/server/RuntimeMethodDescriptor;Lweblogic
/rmi/spi/InboundRequest;Lweblogic/rmi/spi/OutboundResponse;)V(BasicServerRef.java:492)
Please help .
Thanks in Advance.
Edited by hforever at 03/04/2008 7:28 AM -
NamingException on EJB jndi lookup
I have two applications - deployed under the "default instance".
When I start up OC4J and deloy app1 and app2, then app1 can do a JNDI lookup on a session bean that resides in App2. It uses the RMIInitialContextFactory.
Provider is "ormi://localhost/app2"
My problem is that if I undeploy and redeploy app2, then app1 suddenly can't do a lookup to any sessionBean found in app2 anymore, even though the jndi name still shows up in the browser, and if I try to look it up from an external application running outside of oc4j (with exactly the same code as I'm using in app1), it also works.
So why is app1 not able to find app2 via jndi after a redeployment?
DAvi - thank you for your response.
First of all, I run on Suse Linux 10.1. Dunno if that's any help, but hey, more info can't help :)
Let's answer your questions:
1.) OCJ4 Version: 10.1.3.0.0 (build 060119.1546.05277)
2.) JDK Version: 1.5.0_07-b03
As for your suggestions:
1.) app1 = parent of app2.
I'm rather new to Oracle, so maybe I made a mistake during my investigations. Still, I'd like to give a breakdown: I built a framework-type application, and thought about deploying "child modules" (plug-in applications) underneath it, as you proposed.
This worked fine, but there comes a problem whenever you try to use something like Hibernate in any application that's not deployed in the root (ie any app that's deployed as a child of another). The problem came in 2 flavours:
A) If you use a jar in the parent and try to do resource loading from the child, the context of the parent is used the whole time. Since the search-policy of the class-loader is loaded->parent->shared->local, and if Hibernate is already used in the parent, it never gets to the child and thus trying to load a resource in the child is futile since parent can't see child context.
B) Lets say you're not using Hibernate at all in the parent application. When doing resource loading (eg the hibernate.cfg.xml file), Hibernate tries to locate the resource via Thread.currentThread().getContextClassLoader(). OC4J returns the parent-app's thread as the currentThread, NOT that of the child-application that you're actually running the code from, thus it will never be able to pick up resources from within a jar part of the child application. The only way that I managed to get it to work, was to include the Hibernate3.jar as part of the EAR deployment (ie listed it as <library path...> in the orion-application.xml. Putting it in shared-libs or app-libs didn't work...ever. Also, if I happened to use Hibernate in the parent-application, it doesn't matter if I put hibernate3.jar in the EAR of the child - the parent-version gets picked up and used due to the search-policy... NOTE: This is in a JAR - I'm not using WAR's so cannot force local loading as is possible with web-apps...
I then opted to deploy applications seperately under the root, and using RMI to communicate from the framework-application to its "modules", and vice-versa. The master doesn't know the exact type of the remote interface of whatever child-module it needs to call, so it uses reflection to call the "create" on the EJBHome of whatever child-module it needs to invoke as well as the method on the actual remote-interface.
Please note, if I deploy both applications (master and child), and perform JNDI lookups from master to child, it works perfectly. As soon as I do a redeploy (or explicity undeploy, deploy), JNDI fails. External clients, though, works all the time. Also, if I redeploy the child before ever calling it from the parent-application, it also works after I did redeployment. It's as if, when you do a JNDI lookup the first time, it caches something and from there on it breaks if you do a redeploy and perform a consequent app-to-app JNDI lookup...
2.) dedicated.rmicontext=true
I tried this by setting it as a JNDI property before getting the InitialContext - makes no difference, unfortunately.
//========CODE============================
// This is in a SessionBean inside the Master Application. For the time being I've hard-coded the provider-url of the client-application.
// NOTE: This EXACT same code is used in the external java client - there it works perfect every time, whether I redeploy or not.
//========================================
Hashtable<String, String> env = new Hashtable<String, String>();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.rmi.RMIInitialContextFactory");
env.put(Context.PROVIDER_URL, "ormi://localhost/client-application");
env.put(Context.SECURITY_PRINCIPAL, "oc4jadmin");
env.put(Context.SECURITY_CREDENTIALS, "MyPassword");
env.put("dedicated.rmicontext","true");
InitialContext ctx = null;
try {
ctx = new InitialContext(env);
// WHEN I REDEPLOY, CODE CRASHES ON THE NEXT LINE
Object home = ctx.lookup("ejb/TestWorkerAProxyBean");
EJBHome obHome = (EJBHome) PortableRemoteObject.narrow(home, EJBHome.class);
System.out.println("EJBHOME Is [" + obHome + "]");
final Object invocationTarget = MethodUtils.invokeExactMethod(obHome,"create",new Object[0]);
System.out.println("invocation target = [" + invocationTarget + "]");
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
IWorkerProxy proxy = (IWorkerProxy)Proxy.newProxyInstance(classLoader, new Class[]{IWorkerProxy.class}, new InvocationHandler() {
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
try {
Method remoteEjbMethod = invocationTarget.getClass().getMethod(method.getName(),method.getParameterTypes());
return remoteEjbMethod.invoke(invocationTarget, args);
} catch (Exception e) {
ExceptionHandler.handle(e);
return null;
} catch (NamingException ne) {
System.out.println("NamingException");
ne.printStackTrace();
} catch (NoSuchMethodException e) {
System.out.println("NoSuchMethodException");
e.printStackTrace();
} catch (Exception e) {
System.out.println("Other Exception");
e.printStackTrace();
==========================
===========EXCEPTION (ONLY IF I REDEPLOY - IT WORKS PERFECT IF I RUN IT FIRST TIME)=================
==========================
06/09/25 17:15:51 NamingException
06/09/25 17:15:51 javax.naming.NameNotFoundException: ejb/TestWorkerAProxyBean not found
06/09/25 17:15:51 at com.evermind.server.rmi.RMIClientContext.lookup(RMIClientContext.java:51)
06/09/25 17:15:51 at javax.naming.InitialContext.lookup(InitialContext.java:351)
06/09/25 17:15:51 at com.myapp.master.RequestProcessorBean.processRequest(RequestProcessorBean.java:140)
06/09/25 17:15:51 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
06/09/25 17:15:51 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
06/09/25 17:15:51 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
06/09/25 17:15:51 at java.lang.reflect.Method.invoke(Method.java:585)
06/09/25 17:15:51 at com.evermind.server.ejb.interceptor.joinpoint.EJBJoinPointImpl.invoke(EJBJoinPointImpl.java:35)
06/09/25 17:15:51 at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
06/09/25 17:15:51 at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
06/09/25 17:15:51 at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
06/09/25 17:15:51 at com.evermind.server.ejb.interceptor.system.TxSupportsInterceptor.invoke(TxSupportsInterceptor.java:37)
06/09/25 17:15:51 at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
06/09/25 17:15:51 at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
06/09/25 17:15:51 at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
06/09/25 17:15:51 at com.evermind.server.ejb.StatelessSessionEJBObject.OC4J_invokeMethod(StatelessSessionEJBObject.java:86)
06/09/25 17:15:51 at RequestProcessorLocal_StatelessSessionBeanWrapper4.processRequest(RequestProcessorLocal_StatelessSessionBeanWrapper4.java:37)
06/09/25 17:15:51 at com.myapp.master.gateway.FrameworkGatewayBean.processObjectRequest(FrameworkGatewayBean.java:172)
06/09/25 17:15:51 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
06/09/25 17:15:51 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
06/09/25 17:15:51 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
06/09/25 17:15:51 at java.lang.reflect.Method.invoke(Method.java:585)
06/09/25 17:15:51 at com.evermind.server.ejb.interceptor.joinpoint.EJBJoinPointImpl.invoke(EJBJoinPointImpl.java:35)
06/09/25 17:15:51 at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
06/09/25 17:15:51 at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
06/09/25 17:15:51 at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
06/09/25 17:15:51 at com.evermind.server.ejb.interceptor.system.TxSupportsInterceptor.invoke(TxSupportsInterceptor.java:37)
06/09/25 17:15:51 at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
06/09/25 17:15:51 at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
06/09/25 17:15:51 at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
06/09/25 17:15:51 at com.evermind.server.ejb.StatelessSessionEJBObject.OC4J_invokeMethod(StatelessSessionEJBObject.java:86)
06/09/25 17:15:51 at FrameworkGatewayRemote_StatelessSessionBeanWrapper10.processObjectRequest(FrameworkGatewayRemote_StatelessSessionBeanWrapper10.java:94)
06/09/25 17:15:51 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
06/09/25 17:15:51 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
06/09/25 17:15:51 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
06/09/25 17:15:51 at java.lang.reflect.Method.invoke(Method.java:585)
06/09/25 17:15:51 at com.evermind.server.rmi.RmiMethodCall.run(RmiMethodCall.java:53)
06/09/25 17:15:51 at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
06/09/25 17:15:51 at java.lang.Thread.run(Thread.java:595) -
Hello,
i hope to find a solution, but i think there's something wrong:
i did my JUnit test case and i instantiate the glassfish v3 EJBContainer in my @BeforeClass method
running the test, deploy messages are something like this:
INFO: Portable JNDI names for EJB PhaseHandler : [java:global/ejb-app4338883541443661181/classes/MyEJB!my.package.MyEJB, java:global/ejb-app4338883541443661181/classes/MyEJB]i would like to lookup for the ejb in my @Before methods... but... which jndi name should i use to fetch the EJB if the app name is random?
i've tried some tries:
java:global/classes/MyEJB (read from a tutorial)
java:app/classes/MyEJB (thought it could work but.. no it doesn't)
java:module/MyEJB (failed :/ )
any suggestion? any help will be greatly appreciated
follows my maven dependency configuration
<repositories>
<repository>
<id>maven2-repository.dev.java.net</id>
<name>Java.net Repository for Maven</name>
<url>http://download.java.net/maven/glassfish</url>
<layout>default</layout>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.glassfish.extras</groupId>
<artifactId>glassfish-embedded-all</artifactId>
<version>3.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>6.0</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
</dependencies>and this is my test case:
@BeforeClass
public static void startContainer() {
container = EJBContainer.createEJBContainer();
@AfterClass
public static void stopContainer() {
if (container != null) {
container.close();
* @throws NamingException
@Before
public void setup() throws NamingException {
myEjb =(MyEJB)container.getContext().lookup(
"which jndi should i use?");
}i did my JUnit test case and i instantiate the glassfish v3 EJBContainer in my @BeforeClass methodWhat is "your jUnit test case"?
You don't have to implement jUnit tests, and if you do, you generally benefit to have more than one.
Moreover, you shouldn't think it as "doing jUnit test cases", but merely as "doing unit-testing using jUnit" -
EJB 3.0 JNDI lookup gives ClassCastException
The object returned by the JNDI lookup of a EJB 3.0 Statefull Session Bean is not of the expected type, but rather of an obviously generated Proxy type (ejb_DistributionProcessor_LocalProxy_4h350 instead of expected DistributionProcessor). Does anybody have any idea about what this could be?
Details:
We are using annotations @Statefull and @Local and are deploying on a standalone OC4J 10.1.3.1. The beans are presumably loaded correctly since they get listed in Enterprise Managers list of beans for the application. There is also obviously an object at the desired JNDI location, presumably some kind of proxy. Unfortunately the proxy cannot be cast to the original type making the retrieved object useless.
I can supply more details if necessary, but really don't know what more is relevant.Well, I figured it out, it seems I had the classes in both the EJB and the WEB deployment, so when casting it tried to cast X from EJB to X from WEB application and since they reside in different locations they weren't the same file and therefore not castable.
-
JNDI Lookup in OC4J *AND* Tomcat 5 (not either/or)
I've been struggling to get a web application to deploy and run correctly on Tomcat 5.x. I couldn't ADF to look up the Datasource I'd set up in the Tomcat configs. After reading this forum post:
Problem deploying BC4J Toy Store app on Tomcat 4
I was able to run my test app successfully on Tomcat by prepending 'java:comp/env/' to the JNDI name of my Datasource in bc4j.xcfg. Unfortunately, specifying the JNDI name in this way breaks the JNDI lookup in the embedded OC4J container. The impression I got from the above forum post was that OC4J should be able to look up the data source when the name is specified as either jndi/myDataSource or java:comp/env/jndi/myDataSource. I can only get it to work with the former.
Is there a way to specify the JNDI name of a datasource in bc4j.xcfg such that both Tomcat AND the embedded OC4J container within JDeveloper will be able to look it up?
Thanks,
-MattTo answer my own question, a fairly straight-forward way of achieving this is to use two configurations for the application module: one for testing locally (the supplied configuration), and another one for deployment that is a copy of the first except for the JNDI name. I can switch between the configurations via the Databindings depending on whether I want to test locally or deploy to Tomcat.
This is certainly a useable solution, but I'm bothered by the fact that I need to reference the JNDI name in two different ways. Shouldn't this be container-independent?
-Matt -
JNDI lookups on Tomcat 5.5 and Oracle XE
Hi there!
I'm using Oracle 10g XE and Tomcat 5.5.9. I just wanna get advice on how to do JNDI lookups. I know XE doesn't have native support for Java and servlets and I noticed the "jndi.jar" file is missing in XE, unlike in Oracle 10g EE. Is "jndi.jar" required for JNDI functionality on XE, or can I just use Tomcat's JNDI functionality to do the lookups? Any input would be appreciated. Tnx!
LeslieHmmm
After some search and restart the oracle-xe and checking the "alert_XE.log" file I found some strange!
Some lib files was missing (no link was made in the /usr/lib path)
And the dbf file "/usr/lib/oracle/xe/oradata/XE/control.dbf" was missing......
I remove the installation (rpm -e oracle-xe)
and then reinstall it.
Run the config and now I can access the host!
It seams that the installation scripts is not perfect!
I hope this will help some other.
//TEW -
Hi there,
I am doing some tests on Glassfish v3 and new EJB 3.1 features. I've migrated some beans I previously had to bind to the web layer and now I can have in the EJB layer thanks to the new Singleton concept. The problem is that I don't know if I can get them with a JNDI lookup as I do with session beans. In Glassfish log I only see entries about JNDI names for the SSBs, not for the Singletons.
Are they visible in the JNDI naming system? How can I know the names? (I am migrating from JBoss 5.1 so I am also a bit new to Glassfish)
I cannot do a Dependency injection @EJB as I am using struts2 actions. I can only use JNDI (not right?) :-)
Thanks for any help,
IgnacioHi there,
I am doing some tests on Glassfish v3 and new EJB 3.1 features. I've migrated some beans I previously had to bind to the web layer and now I can have in the EJB layer thanks to the new Singleton concept. The problem is that I don't know if I can get them with a JNDI lookup as I do with session beans. In Glassfish log I only see entries about JNDI names for the SSBs, not for the Singletons.
Are they visible in the JNDI naming system? How can I know the names? (I am migrating from JBoss 5.1 so I am also a bit new to Glassfish)
I cannot do a Dependency injection @EJB as I am using struts2 actions. I can only use JNDI (not right?) :-)
Thanks for any help,
Ignacio -
OC4J, JNDI lookup and UserManager
Hi
Recently we decided to upgrade our Oracle9iAS to 9.0.3 from 9.0.2 and its JVM to 1.4.2_02 from 1.3.1.
We have 2 customs implementations of UserManager that worked in the earlier version and, after the upgrade, it became unstable. Each UserManager uses a connection to a database provided by a DataSource, which is retrieved by a JNDI lookup. This lookup throws a NameNotFoundException after some time of execution. A container restart solves the problem, but it appears again later.
What´s happening?
Jose Antonio.Hi
Recently we decided to upgrade our Oracle9iAS to 9.0.3 from 9.0.2 and its JVM to 1.4.2_02 from 1.3.1.
We have 2 customs implementations of UserManager that worked in the earlier version and, after the upgrade, it became unstable. Each UserManager uses a connection to a database provided by a DataSource, which is retrieved by a JNDI lookup. This lookup throws a NameNotFoundException after some time of execution. A container restart solves the problem, but it appears again later.
What´s happening?
Jose Antonio. -
ClassCastException on ejb jndi lookup
Hello,
I try to get an standalone remote client to to connect to my stateless session bean:
java.util.Properties props = new java.util.Properties();
props.put("java.naming.provider.url", "181.205.12.19:50004");
props.put("java.naming.factory.initial", "com.sap.engine.services.jndi.InitialContextFactoryImpl" );
props.put("java.naming.security.authentication", "simple");
props.put("java.naming.security.principal", "j2ee_admin");
props.put("java.naming.security.credentials", "*****");
jndiContext = new InitialContext(props);
fetching of jndi context is fine, but once I try to lookup my home interface I get a class cast exception:
home = (ToEdifactConverterHome) PortableRemoteObject.narrow(jndiContext.lookup ("sap.com/EdifactEar/ToEdifactConverterBean"), ToEdifactConverterHome.class);
java.lang.ClassCastException
at com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:293)
at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:134)
at test.cceag.transform.TransformTester.setUp(TransformTester.java:74)
at test.cceag.transform.TransformTester.main(TransformTester.java:48)
The jndi lookup seems to return the bean implementation object, but not the home interface itself.
Thanks for any hints
MatthiasHi Matthias,
i think the guide
"How to...EJB: Accessing EJB Applications Using JNDI"
will help you to solve the ejb lookup problem:
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/0736159e-0301-0010-9ea4-c63d83d0797b
good luck, Katharina
Maybe you are looking for
-
Is there a way to mute audio when capturing video?
I have the FCPX installed and want to background capture video without listening to the audio. There was a small preview checkbox with the audio meteres in FCP 7. Is there a similar option in FCPX?
-
Hi, I am trying to open EPM System Configurator but getting error: "The Vital Product Data registry is in use by another installer. Please start this installer after the other installtion is complete." I am not installing the EPM system. It is alread
-
hi, the first column of my alv grid display is check boxes. i want all the check boxes to be checked when the user clicks on the select all button present on the grid.it very urgently required.plz give me the code. thanks & regards, santosh Edited by
-
Exam certification check online on oracle website.
Dear All, Is there any link to be checked the exam certification credentials online, apart from Prometric website. Thanks,
-
Saving valuable thread to your account
Dear all; I have been using the forum as a learning tool and I was just wondering if there is a way to save threads you find valuable to your account without having to comment on it so that it can be retrieved in the near future as a reference when a