This week's book giveaway is in the Design and Architecture forum.
We're giving away four copies of Communication Patterns: A Guide for Developers and Architects and have Jacqui Read on-line!
See this thread for details.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

problem while creating InitialContext .....

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi guys
i am trying to create InitialContext Object using the code:
Hashtable env = new Hashtable();
InitialContext ic = null;
try
{
env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
env.put(Context.PROVIDER_URL, "t3://172.25.150.65:7001");
ic = new InitialContext(env);
}
catch(Exception e){}
and trying to lookup a bean and i am running WebLogic Server.This i am running from a client application,a Java program.
while i am running this application, it is giving the error as :
java.io.StreamCorruptedException: Type code out of range, is 0
at java.io.ObjectInputStream.peekCode(ObjectInputStream.java:1280)
at java.io.ObjectInputStream.SkipToEndOfBlockData(ObjectInputStream.java
:1211)
at java.io.ObjectInputStream.inputClassDescriptor (ObjectInputStream.java
:776)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:353)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:232)
at java.io.ObjectInputStream.inputObject(ObjectInputStream.java:978)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:232)
at weblogic.common.internal. ChunkedObjectInputStream.readObject(ChunkedO
bjectInputStream.java:110)
at weblogic.common.internal.ChunkedObjectInputStream.readObject(ChunkedO
bjectInputStream.java:123)
at weblogic.rjvm.ConnectionManager.readPeerInfo (ConnectionManager.java:6
83)
at weblogic.rjvm.ConnectionManagerClient.handleIdentifyResponse(Connecti
onManagerClient.java:140)
at weblogic.rjvm.ConnectionManager.dispatch(ConnectionManager.java:624)
at weblogic.rjvm.t3.T3JVMConnection.dispatch(T3JVMConnection.java, Compi
led Code)
at weblogic.socket.JavaSocketMuxer.processSockets2(JavaSocketMuxer.java,
Compiled Code)
at weblogic.socket.JavaSocketMuxer.processSockets(JavaSocketMuxer.java,
Compiled Code)
at weblogic.socket.SocketReaderRequest.execute(SocketReaderRequest.java:
24)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, Compiled Code)
--------------- nested within: ------------------
weblogic.utils.AssertionError: ***** ASSERTION FAILED ***** - with nested except
ion:
[java.io.StreamCorruptedException: Type code out of range, is 0]
at weblogic.rjvm.ConnectionManager.readPeerInfo(ConnectionManager.java:6
85)
at weblogic.rjvm.ConnectionManagerClient. handleIdentifyResponse( Connecti
onManagerClient.java:140)
at weblogic.rjvm.ConnectionManager. dispatch(ConnectionManager.java:624)
at weblogic.rjvm.t3.T3JVMConnection. dispatch(T3JVMConnection.java, Compi
led Code)
at weblogic.socket.JavaSocketMuxer. processSockets2(JavaSocketMuxer.java,
Compiled Code)
at weblogic.socket.JavaSocketMuxer. processSockets(JavaSocketMuxer.java,
Compiled Code)
at weblogic.socket.SocketReaderRequest. execute(SocketReaderRequest.java:
24)
at weblogic.kernel.ExecuteThread. execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread. run(ExecuteThread.java, Compiled Code)
exp :
[Root exception is java.net.ConnectException: t3://172.25.150.65:7001: Bootstrap
to: 'SG0121SATHISH.snshub.org/172.25.150.65:7001' over: 't3' got an error or ti
med out]javax.naming. CommunicationException
at weblogic.jndi.internal. ExceptionTranslator. toNamingException(Exceptio
nTranslator.java:46)
at weblogic.jndi. WLInitialContextFactoryDelegate. toNamingException(WLIni
tialContextFactoryDelegate.java:568)
at weblogic.jndi. WLInitialContextFactoryDelegate. getInitialContext(WLIni
tialContextFactoryDelegate.java, Compiled Code)
at weblogic.jndi. WLInitialContextFactoryDelegate. getInitialContext(WLIni
tialContextFactoryDelegate.java:211)
at weblogic.jndi. WLInitialContextFactory. getInitialContext(WLInitialCont
extFactory.java:149)
at javax.naming.spi. NamingManager.getInitialContext(NamingManager. java:7
71)
at javax.naming. InitialContext.getDefaultInitCtx ( InitialContext.java:169
)
at javax.naming. InitialContext.<init>(InitialContext.java:146)
at com.sns.trade.eco.co.util. ReadXMLForCOApplication. getInitialContext(R
eadXMLForCOApplication.java:478)
at com.sns.trade.eco.co.util. ReadXMLForCOApplication. createCOSLandCodeSL
Bean(ReadXMLForCOApplication.java:437)
at com.sns.trade.eco.co.util. ReadXMLForCOApplication. endTransaction(Read
XMLForCOApplication.java:417)
at com.sns.trade.eco.co.util. ReadXMLForCOApplication. main(ReadXMLForCOAp
plication.java:499)"
Can u please explain why this error is occuring and it is at the line of creating the InitialContext. ie.,
ic = new InitialContext(env);
thanks in advance
sathish
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try
DirContext
instead of initial context
and thus
myContext = new InitialDirContext(env);
Also
dont you need
catch (NamingException e)
{
mstrLastErrorStr = e.toString();
System.out.printlnmstrLastErrorStr);
}
 
sathish kannan
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ya i got the problem solved
actually the problem i used different version of java while compiling and running the java
anyway thanks a lot
 
Beauty is in the eye of the tiny ad.
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic