Using Application Module outside ADF Application context
924141 Dec 14, 2012 5:21 PMI am trying to run application module using a standalone java class. Trying to use Application Module outside ADF Application context.
I have created a jar file on my standalone java class, and added my ADF application jar files to the classpath while running my standalone java file as a Jar file.
I could connect to the application module and I am able to get the response from my application module.
Below is the code I used to invoke my application module method from my standalone java class.
I have created a jar file on my standalone java class, and added my ADF application jar files to the classpath while running my standalone java file as a Jar file.
I could connect to the application module and I am able to get the response from my application module.
Below is the code I used to invoke my application module method from my standalone java class.
public static void main(String[] args) {
System.out.println("Testing .....");
String jdbcURL = "jdbc:oracle:thin:@localhost:1521:XE";
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, JboContext.JBO_CONTEXT_FACTORY);
env.put(JboContext.DEPLOY_PLATFORM, JboContext.PLATFORM_LOCAL);
try {
Context ic = new InitialContext(env);
String defName = "com.org.model.BatchJobAppModule";
ApplicationModuleHome home = (ApplicationModuleHome)ic.lookup(defName);
ApplicationModule mbApplicationModule= (ApplicationModule)home.create();
mbApplicationModule.getTransaction().connect(jdbcURL, "HR", "HR");
((BatchJobAppModuleImpl)mbApplicationModule).connectToDatabase();
} catch (NamingException ne) {
// TODO: Add catch code
ne.printStackTrace();
}
}
{code}
I am getting following messages.
{code: warning}
oracle.adf.share.ADFContext getCurrent
WARNING: Automatically initializing a DefaultContext for getCurrent.
Caller should ensure that a DefaultContext is proper for this use.
Memory leaks and/or unexpected behaviour may occur if the automatic initialization is performed improperly.
This message may be avoided by performing initADFContext before using getCurrent().
To see the stack trace for thread that is initializing this, set the logging level of oracle.adf.share.ADFContext to FINEST
Dec 14, 2012 10:16:37 PM oracle.security.jps.internal.config.xml.XmlConfigurationFactory initDefaultConfiguration
SEVERE: java.io.FileNotFoundException: D:\satya\testPackage\.\config\jps-config.xml (The system cannot find the path specified)
{code}
I have another question regarding connecting to database.
How to get connection from a datasource, to avoid supplying database credentials which will vary from one environment to another.
Please let me know if any one has pointers.
Thanks in advance.
Regards,
Satya
Edited by: 921138 on Dec 14, 2012 9:20 AM