Technology Network Community
Oracle Database
Fusion Middleware
Development Tools
Server & Storage Systems
Enterprise Management
Berkeley DB Family
Cloud Computing
Big Data
Business Intelligence
Migration and Modernization
E-Business Suite
PeopleSoft Enterprise
JD Edwards World
JD Edwards EnterpriseOne
User Productivity Kit Pro (UPK) and Tutor
Governance, Risk & Compliance (GRC)
Master Data Management (MDM)
Oracle CRM On Demand
On Demand: SaaS and Managed Applications
AutoVue Enterprise Visualization
Agile PLM
Endeca Experience Management
Fusion Applications
Archived Forums



JDeveloper and ADF

Standalone java application and jndi

Hi all, I use jdevstudio10133 and till now I've written and deployed correctly many web apps (working in an Embedded OC4J). The problem is that now I'd like to write some standalone applications that will be deployed in an OC4J (in an Oracle Application Server 10g). The difficulty is how pass environment parameters to my app. With web apps I put my test parameters in the web.xml and got them with:     try {       Context initial = new InitialContext();       Context environment = (Context)initial.lookup("java:comp/env");             ldapUser = (String)environment.lookup("ldap.user");             environment.close();       initial.close();     } catch (NamingException ne) {       System.out.println(ne.getMessage());       throw new Exception (ne.getMessage());     } Deploying in production the administrator should change parameters and the right one (es: ldap password, ec....). This doesn't work for standalone apps. I think I must use a jndi file and a service provider and so on.... Please somebody can put me to the right way? Thanks a lot. Rostidon.  Message was edited by:          user603361  Message was edited by:          user603361

Hi,   you have to create a file and put it, for example, inside the folder that contains you sources. This file has to be in the classpath to be automatically reached by the standalone application. An example of the file can be:  java.naming.factory.initial=oracle.j2ee.naming.ApplicationClientInitialContextFactory java.naming.provider.url=ormi://<host-name>:<ormi-port>/<application-name>  Hope it helps. Regards, Giuseppe

Hi Giuseppe, I've put exactly what you adviced me and a I got this error: META-INF/application-client.xml not found (see J2EE spec, application-client chapter for requirements and format of the file) By putting instead java.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory, I got: Invalid URL: ormi:// And with java.naming.factory.initial=com.evermind.server.rmi.RMIInitialContextFactory, I got: Connection refused: connect Which java.naming.factory.initial should I use of those 3? Using ormi://, what should be MyApplicationName. (I put the name I gave when creating the app with jdeveloper) I'm using jdevelopper and the ormi service seems to run on port 23899 Thanks a lot Giuseppe for helping me. Rostidon M.

Rostidon,  from Oracle Documentation:   "The ApplicationClientInitialContextFactory is used when looking up remote objects from standalone application clients. It uses the refs and ref-mappings found in application-client.xml and orion-application-client.xml. It is the default initial context factory when the initial context is instantiated in a Java application. It can be used for looking up remote EJBs in the same application. It can also be used for looking up EJBs with local interface.  The RMIInitialContextFactory is used when looking up remote objects between different containers. It is also used when browsing the complete JNDI namespace and not using the application context.  The ApplicationInitalContextFactory is used when looking up remote objects in same application. It is the default initial context factory in use inside the OC4J container. It uses the ref and ref-mappings in the web.xml, orion-web.xml, ejb-jar.xml, and orion-ejb-jar.xml to locate resources."  I think that the ApplicationClientInitialContextFactory can be ok for you. You only have to provide the application-client.xml. You can use JDeveloper to fill it with your ejb home, remote or local interface and jndi name.  Hope it helps. Regards, Giuseppe

Thank you very much Giuseppe. it's working fine. I's working also even if in the jndi file I comment #java.naming.provider.url=ormi://localhost:23791/MyAppName I hope this wont create a problem. Regards and thanks a lot. Rostidon M.

Related Links

ADF 11g - How to deploy ADF swing application
How to display log raw image store in database
How to Lock Record via Namedquery
Validation Problem
Jdev 11g: Problem with character encoding and resource bundle files
Exception on weblogic server when i action some button associated with adf
Google Analytics and ADF
unable to find how to change the look of tooltip
JDev 10.1.2: Order by transient attribute
Embedded Jasper Reports
calling COM objects from ADF
commandMenuItems under menuBar which is mainmenu not working in IE 6.0
ADF Swing 11g - How to bind date picker
JSF Page templates in
table rangepage toolbar