• 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Application Client Naming Exception

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
I wrote an Application Client, which calls a session bean in WebSphere Studio Application Developer. It runs successfully in Studio and I can even call a session bean of a WebSphere server.
Now i tried to export the Application Client and run it without Studio. I'm getting Naming Exception when trying to get the InitialContext. Here is the code:
public static void main(String[] args) {
javax.naming.Context jndiContext = null;
Object obj = null;
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.ejs.ns.jndi.CNInitialContextFactory");
env.put(Context.PROVIDER_URL, "iiop://localhost:900");
try {
jndiContext = new javax.naming.InitialContext(env);
} catch (javax.naming.NamingException ne) {
System.out.println("Can't get InitialContext");
}
Any suggestions?
 
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you running it using the Client container (launchClient.bat)?
Kyle
 
Christian Haag
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, i'm not using launchClient.bat
I exported my Application Client as a jar File and then tried to start it, after adding the following jar files to the classpath:
j2ee.jar, rt.jar, myEJB.jar
Must I do it? When yes, then how do I use it?
 
Kyle Brown
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
LaunchClient will make your life way easier. Read the InfoCenter section 6.6.0.7. For more information on launching clients, you can also look at my WebSphere 4.0 AEs workbook for Richard Monson-Haefel's EJB book (http://www.titan-books.net/download.html)
Kyle
 
Christian Haag
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks. The launchclient.sh Script successfully starts the Application Client in my ear file on the linux machine (with WebSphere 4.0 installed). On NT i have WS Studio Application Developer. When I try to start launchclient.bat it gives me an java.lang.NoClassDefFoundError: com/ibm/crypto/provider/IBMJCE
Are there any paths to set? (On linux there was everything set).
Here is my launchclient.bat:
@echo off
REM Usage: launchClient [<ear-file> | -help | -?]
setlocal
call "%~dp0setupCmdLine.bat"
@REM CONSOLE_ENCODING controls the output encoding used for stdout/stderr
@REM console - encoding is correct for a console window
@REM file - encoding is the default file encoding for the system
@REM <other> - the specified encoding is used. e.g. Cp1252, Cp850, SJIS
SET CONSOLE_ENCODING=-Dws.output.encoding=console
set NAMING_FACTORY=com.ibm.websphere.naming.WsnInitialContextFactory
"%JAVA_HOME%\bin\java" %CONSOLE_ENCODING% %CLIENTSAS% -Dserver.root="%WAS_HOME%" -Dws.ext.dirs=%WAS_EXT_DIRS% -Dcom.ibm.CORBA.BootstrapHost=%COMPUTERNAME% -Djava.naming.factory.initial=%NAMING_FACTORY% -classpath %WAS_CLASSPATH% com.ibm.ws.bootstrap.WSLauncher com.ibm.websphere.client.applicationclient.launchClient %*
endlocal

And here is my setupCmdLine.bat:
SET COMPUTERNAME=at8
SET WAS_HOME=c:\programme\application developer\plugins\com.ibm.etools.websphere.runtime
SET JAVA_HOME=c:\programme\application developer\jre
SET ITP_LOC=c:\programme\application developer\plugins\com.ibm.etools.websphere.runtime\deploytool\itp
SET DBDRIVER_JARS=c:\programme\SQLLIB\java\db2java.zip
SET DBDRIVER_PATH=c:\programme\SQLLIB\java
SET CLIENTSAS=-Dcom.ibm.CORBA.ConfigURL=file:/c:/programme/application developer/plugins/com.ibm.etools.websphere.runtime/properties/sas.client.props
SET WSCPCLIENTSAS=-Dcom.ibm.CORBA.ConfigURL=file:/c:/programme/application developer/plugins/com.ibm.etools.websphere.runtime/properties/sas.client.props
SET SERVERSAS=-Dcom.ibm.CORBA.ConfigURL=file:/c:/programme/application developer/plugins/com.ibm.etools.websphere.runtime/properties/sas.server.props
SET WAS_EXT_DIRS="%JAVA_HOME%\lib";"%WAS_HOME%\classes";"%WAS_HOME%\lib";"%WAS_HOME%\lib\ext";"%WAS_HOME%\web\help";%DBDRIVER_JARS%
SET WAS_CLASSPATH="%WAS_HOME%\properties";"%WAS_HOME%\lib\bootstrap.jar"
SET QUALIFYNAMES=
 
Where all the women are strong, all the men are good looking and all the tiny ads are above average:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic