Creating an application module in a Java class

Hi everyone,
I'm trying to create an application module from a normal Java class where I don't have access to any HttpSession objects.
I tried to use the method in the documentation
appMod = Configuration.createRootApplicationModule(
                    "full.class.Name",
                    "ConfigurationName");
It's not working though, complaining that it can not find the configuration file which it's trying to locate at full/class/common/bc4j.xcfg.
This file exists at the same path in the BC4J project which this project has a dependency on in the Project Settings dialog.
Is this the right way to create an application module? Can someone please provide a reference to an example.
Thanks

Thanks Frank, but this example is about a stand-alone application, my problem occurs with an application hosted on the application server.
I did more experiments and came up with some ideas but unfortunately, I hit a dead end.
I thought that in order to work around the fact that I cannot set the class loader of the timer, I could change the class loader of the running thread before I create the timer as follows:
Thread.currentThread().setContextClassLoader(
          this.getClass().getClassLoader());
I thought this would give me a SecurityException for sure, but strangely enough it worked perfectly.
Now, all I needed was to move this code from the JSP to my listener. Unfortunately, it didn't work in the listener, also a test that I did in the JSP to make sure that the classloader before and after the above statment is different, showed that in the listener, the classloader of the thread is the same as the one used to load the listener class:
System.out.println(Thread.currentThread().getContextClassLoader()
          .equals(this.getClass().getClassLoader()));
I thought, maybe this is a listener thing, but if I do it in the init() method of a servlet that I could specify to load on startup, it could work, but still, it didn't.
I cannot understand, why is it that the only correct class loader is the one used to load the compiled JSP class?!
Does anyone have any other ideas?
Thanks

Similar Messages

  • Any difference in creating a web service from a java class or session bean?

    Hi,
    The JDeveloper tutorial at http://www.oracle.com/technology/obe/obe1013jdev/10131/devdepandmanagingws/devdepandmanagingws.htm demonstrates creating a web service from a plain java class. I'm wondering:
    - Is it possible to create a web service from a stateless session bean instead of a java class? If so, what's the proper way to do this in JDeveloper? When I tried doing so in JDeveloper 10.1.3.0.4 (SU5) using the J2EE Web Service wizard, the wizard did not list the session bean in the Component To Publish dropdown (it does list any java classes available in the project). I can proceed by manually typing in the name of the session bean. After the wizard completes though, the @Stateless annotation that had been in my session bean class code is removed and replaced by a @WebService annotation. The end result is that it looks like it made no difference whether I had tried to create the web service from a session bean or plain java class as the annotations in the resulting web service code are the same (although if I had started from a session bean, the class for the web service still implements the Local/Remote EJB interface that the session bean originally implemented).
    - Assuming it's possible to create a web service from a stateless session bean, is there any advantage/disadvantage creating a web service from a java class vs a stateless session bean? I'm creating the web service from scratch so I also need to either build the java class or stateless session bean the web service would be based on from scratch too.
    Thanks for any ideas about this.

    Hi,
    EJB Session beans (EJB 3.0) are deployed as WebServices by annotating the class with @WebService and the methds with @WebMethod (both tags require you to add the JSR-181 library to your project (available in the JDeveloper list of libraries)). Unlike the J2E WebService, the EJB session bean service is turned into a WebService upon deployment. This means you obtain teh WSDL file after deployment
    - Assuming it's possible to create a web service from a stateless session bean, is there any advantage/disadvantage creating a web service from a java class vs a stateless session bean?
    The difference is that EJB Session bean based web services are integrated with the J2EE container, which means that they can leverage container services like transaction handling, data sources, security, JMS etc.
    Frank

  • How to get application module instance from java bundle?

    Hi!
    I would like to build an application that would get all translations from a database table.
    So I created application module for translations that contains a view object which is selecting translations for specific language from a database table. I exposed a method in application module as client interface which returns HashMap<String, String> for all translations for specific language. When I test my view and client interface method call they work fine.
    Then I created java bundle classes to get translations for specific language. Then I tried to override public Object[][] getContents() method.
    I tried to get my translations application module like this:
    SharedTranslationsAppModuleImpl am = new SharedTranslationsAppModuleImpl();
    Map<String, String> translationsMap = am.getTranslations(this.getLocaleCode); // Client interface method call
    In getTranslations(String LocaleCode) I try to get that view (which would select translations from database) but it returns NULL and I get NPE error message.
    So what is the right way to get application module from java bundle file? Now everytime application wants to get translations, application stops and displays NPE message.
    Regards, Marko
    I use JDeveloper 11.1.2.1.0

    Marko,
    you can't just instantiate an application module. An application module has to be set up, db connections and memory pools have to be initialized and ....
    Can you describe why and when you try to read the resource bundle from the db and where the resource bundle is used?
    This blog may be what you are looking for http://technology.amis.nl/2012/08/10/implement-resource-bundles-for-adf-applications-in-a-database-table/
    Timo

  • Creating Root Application Module

    Hi,
    I'm trying to instantiate a root application module from another root application module,
    that imports the first as a library jar file.
    In the "Oracle ADF Model and Business Components API Reference" I have found the following sample code:
    java.util.Hashtable env = new java.util.Hashtable();
    // Add environment entries into env...
    javax.naming.Context ic = new InitialContext(env);
    String defName = ...;
    oracle.jbo.ApplicationModuleHome home = ic.lookup(defName);
    oracle.jbo.ApplicationModule am = home.create();
    but I don't understand how to initialize the 'env' variable.
    Can I have other samples and suggestions?
    Arturo

    Try something like this:Hashtable prop = new Hashtable();
    prop.put(Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.rmi.RMIInitialContextFactory");
    prop.put(Context.PROVIDER_URL, “opmn:ormi://<server>:<container>/<application>”);
    prop.put(Context.SECURITY_PRINCIPAL, “user”);
    prop.put(Context.SECURITY_CREDENTIALS, “password”);
    javax.naming.Context ic = new InitialContext(prop);You have to fill in <server> <container> and <application>.
    Timo

  • Creating win 32 exe files from java class files

    Hi I am using windows 2000.
    I have developed a java swing gui application that has about 10 class files. I downloaded the microsoft sdk for java 4.0 for converting all my class files into a single .exe file. I used jexegen in this SDK to do this process. But when I double click the exe file, it just pops up and closes instantenously without showing my startup frame.
    Can anyone help ?

    There is no Microsoft solution for this until you get J#, change your program
    (J# is a little bit different that java but not much, it's closer to Java than C#)
    and then compile to Win32 .exe.
    For the refrence list of all Java to Native code compilers, check this page:
    http://www.geocities.com/marcoschmidt.geo/jcomp.html#native :
    Different from "normal" compilers (like javac or jikes), native compilers do not create bytecode files
    (.class) that are interpreted by a Java Virtual Machine but native executables (like .exe files on
    Windows). "How do I create an EXE from Java?" is a very frequently asked question in newsgroups
    like comp.lang.java.programmer, native compilers are the answer. Some native compilers are listed
    below, check them out.

  • Creating a HTML file in a java class

    Hi everybody,
    I want to create,configure and open a html file all that in a java class so can you help me please

    floulou_01 wrote:
    Hi everybody,
    I want to create,configure and open a html file all that in a java class so can you help me please
    Prune pointless queries
    Resist the temptation to close your request for help with semantically-null questions like "Can anyone help me?" or "Is there an answer?" First: if you've written your problem description halfway competently, such tacked-on questions are at best superfluous. Second: because they are superfluous, Forum regulars find them annoying - and are likely to return logically impeccable but dismissive answers like "Yes, you can be helped" and "No, there is no help for you."
    --Paraphrased from [How To Ask Questions The Smart Way|http://www.catb.org/~esr/faqs/smart-questions.html] by Eric Steven Raymond
    So, the answer is yes. Your first step would be to post your actual question.
    ~

  • Creating data dictionary type using custom java class

    Hi Experts,
    I have a situation involving the TableSorter mechanism as described here:
    In order to do my sorting correctly, I've created my own Java class implementing the Comparable interface. Based on this class, I need to define my own data dictionary type to be used in a context/table.
    However, I cannot se how this could be achieved as standard Data Dictionary elements can only be based on simple built-in types. Any ideas?
    Kind regards,
    Rasmus Røjkjær Ørtoft

    Hi,
    have you tried to use the following steps while creating your attribute
    1) Right click on the context
    2) New->Attribute
    3) Manually-> Provide a name for the attribute
    4) Browse->Select java native type and select your class
    regards
    Ayyapparaj

  • BUG: Can't create BC4J Application Module Configurations

    Hello,
    I'm using JDev 9.0.3.1 with Win2K and WinXP. There seems to be a bug in the BC4J Application Module Configuration Manager:
    It seems to be impossible to create a new BC4J Application Module Configuration with the Configuration Manager of a BC4J Application Module. I can copy an existing AM configuration, but I can not rename it. Clicking on the OK Button in the Configuration Manager simply does nothing.
    A work around seems to be to open bc4j.xcfg in any text editor, copy an AppModuleConfig element, save xcfg, in JDev remove the project form the workspace, readd it to the workspace (some caching issue of jdev?). Then the new AM config is there and can be modified.
    In JDev 9.0.3 the Config Manager seems to work fine.
    Regards
    Stefan

    The bug is mentioned in metalink bug 2849146.

  • How to create a Concurrent Program around a java class

    Can anyone give me the steps I need to register a concurrent program based on a java class?
    I have a java class that basically opens a jdbc connection, reads values from a table, decompresses one column, and sends all info to XML Gateway. I just need to know how to deploy this thing.
    Thanks.
    -Jason

    Check Metalink Note:305710.1

  • Creating an Application module not connected to any database

    Hi,
    In my application, we have only a custom VO, created as per http://download-west.oracle.com/docs/cd/B31017_01/web.1013/b25947/bcadvvo008.htm. In this VO, we are reading a CSV file.
    My question is, as my application does not require any database as its source, I dont want to have any database associated with my ADF application. However, when I create the AM, it doesnt let me go ahead till I give it a database connection. Is there a way to circumvent this, or remove the database connection related code after creating the AM in this way.
    Thanks,
    Amit

    Wow, beautiful...just what the doctor ordered !
    Thanks John !
    One note, for people who try this - in the link, Lucas is using http://127.0.0.1:8988 etc to specify the url to the csv...but i guess for that to work, you need to have some kind of web server running.. But if you just have a local file and right now, no web server to use 127.0.0.1, you can use file:///c:/test.csv, where the csv is sitting in c drive.
    I got this idea from http://www.oracle.com/technology/products/jdev/howtos/urldatacontrol/urldatacontrol.html...this one is cool too, here they have used this url data control to read rss !

  • Junit test cases -error in creating Application Module

    I am on JDeveloper 9i with OA Extension installed build 1550. I am trying to run Business Components Test Fixtures and getting the following error in setUp method of the fixture class at the following line
    _am = Configuration.createRootApplicationModule("mycompany.oracle.apps.xxsan.invoiceholds.server.InvoiceHoldsAM", "Development");
    The exception below..
    java.lang.NoSuchMethodError: oracle.xml.parser.v2.SAXParser.setContentHandler(Lorg/xml/sax/ContentHandler;)V
    at oracle.jdeveloper.cm.DefaultConnectionStore.read(DefaultConnectionStore.java:182)
    Anybody who have used Junit successfully to test their business components. Would appreciate any feedback.
    Thank you.
    Arun

    Well I guess i figured it out myself. I use the findApplicationModule before calling the createApplicationModule. Apparently, bc4j does not like creating multiple application modules...it should just reuse the existing one instead of throwing this obscure invalid name exception.

  • Creating Web Service from Java Class-How to eliminate nillable="true"

    Does anyone know how to eliminate the attribute, nillable="true", from the element tags which describe the parameters in the WSDL created when creating a web service from a Java Class? It does this only for the string types. Is there something I need to set when creating the web service or before creating the web service? Or the only way is to modify this WSDL then recreate the web service from the WSDL.
    example part of wsdl:
    this is in the <types> tag:
    <complexType name="getData">
    <sequence>
    <element name="schema" type="string" nillable="true"/>
    <element name="table_or_view_name" type="string" nillable="true"/>
    </sequence>
    </complexType>
    <complexType name="getDataResponse">
    <sequence>
    <element name="result" type="string" nillable="true"/>
    </sequence>
    </complexType>

    I did do this and I got the following error when deploying to the Stand-alone OC4j:
    Operation failed with error:
    Error compiling
    :D:\h\cots\Oracle\JDeveloper10g10.1.3\j2ee\home\applications\DBOperationsWSApp-DBData-WS\WebServices: Error instantiating compiler: webservice artifact generation failed :oracle.j2ee.ws.common.tools.api.ValidationException : Exception declaration mismatch between Implementation: dbdatapackage.DBDataOperations and Interface: dbdatapackage.DBDataWS. Impl class Method: getData declares exceptions not declared by the interface (java.lang.Exception)
    I am quite sure what it is saying. It generated the code for the Interface: dbdatapackage.DVDataWS. Impl class. Why would it not do it right? What expection is it complaining about? java.lang.Exception?

  • Finding Application Module name in read-only view object classes

    Hi all,
    I have a fairly basic question about finding application module name when we are coding in ViewObject java classes.
    I want to know how can I obtain <<application module>> NAME that our current view object is contained in it at run-time. I think there should be a way to find current application module NAME, when we are in ViewObject classes including View Object, View Row or view object definition classes (I've overridden all mentioned classes).
    I should notify that since our view object is read-only I may not count on view object's entity classes, coz as you know a read-only view object don't have any entity in it!
    So, if you have any idea about finding current application module name in view object java classes please let me know.
    Appreciate for your replies,
    Nasser

    Thanks guy, it was helpful:)
    Now i can access application module name through viewObject classes.
    But another question is raised...sorry if i m boring:( I promise its the final question ;)
    Is there a way to get application module name in an extended version of JboException class?
    Thanks again for your reply:)
    Nasser

  • Unable to run application module in a generic(Model) project in BPM applica

    I use jDeveloper 11.1.1.6 and i want to add a generic or a model project to a BPM application, in order to develop the customized user interface.
    but when i created an application module with the associated java Class, and then right clicking on it to run, i saw the following error:
    (oracle.jbo.ConfigException) JBO-33001: Configuration file /tester.xcfg is not found in the classpath.
    additionally when i use an Fusion Web application instead of BPM application, with Model and View Controller projects, there is no problem and i am able to run the application module.
    thank you very much for your contribution.

    thank you very much indeed
    one more question.
    will i face any problem by comment that tag?
    can i remove mds-config section in any SOA and BPM application permanently? or its just for test and i should undone my comment later?

  • Generated getter in Application Module impl overrides superclass getter

    Hi,
    I today came across this issue:
    * Created an application module where the data model contains a view object named "Parent" (resulting form a parent-child relationship)
    => Application runs perfectly.
    * Created an application module implementation class (just created it, no further code added)
    => Application throws java.lang.NullPointerException at oracle.adf.model.binding.DCIteratorBinding.executeQueryIfNeeded(DCIteratorBinding.java:2164)
    After some debugging, it turned out that the issue is that JDeveloper created the following getter in the application module impl class:
    public ViewObjectImpl getParent() {
    return (ViewObjectImpl)findViewObject("Parent");
    which overrides public NamedObjectImpl getParent() from NamedObjectImpl, which is a superclass of ApplicationModuleImpl, due to the method's covariant return type.
    JDeveloper does not give me any warning or error, not while creating the impl class nor highlighted in the source code.
    Actually this would mean that I must manually assure that I never ever name a view object the same as any getter method in any of the ApplicationModuleImpl super classes which have a return type which is covariant to ViewObjectImpl. getParent() is one example, another is getProperty(). Even if it might be unlikely, this adds a potential source for some subtle issues.
    Is this known behavior of JDeveloper? Did I miss anything?
    Thanks,
    Andreas

    Hi Frank,
    I agree that naming conventions can avoid this type of issue. Nevertheless, as a matter of usability and reliability, I think it would be good if JDeveloper at least gives a warning during code generation when it generates methods which would override a method from a superclass.
    In any case, I have logged a bug, lets see how it evolves...
    Thanks,
    Andreas

Maybe you are looking for

  • Nvidia 8600M GT GPU (no clue what this thing is) issues - please explain

    what is this exactly? well, whatever it is, someone told me this is why my MBP is in shop right now! screen went totally black lastnight with the computer running fine and normal. if this Nvidia thing is truly the problem and damaged, is this a big d

  • Win Freehand can't create PDFs correctly

    Any help with the problem below would be much appreciated. We recently upgraded to Freehand MX (11.0.2) running on 3 Windows (XP) machines but we can't create a pdf file where the fonts are included correctly using the print to pdf option. Freehand w

  • BPM analytics visualization fails - Doesn't display Dashboard

    Hi all, we're running a 7.4 netweaver installation and are currently testing the bpm components. Everything works fine except the bpm analytics dashboard which simply didn't get displayed. When loading the page only the background and page title (on

  • Distribution of In-active employee in EIC (CRM)

    Hi Experts, I was trying to synchronize HR master data between SAP HR and EIC. It is working fine for the active employee. However, for in-active employee the BP was not created in EIC. Does anyone have the same problem and found a solution or workar

  • Unable to extend datafile which is autoextend on.

    Hi All, I am facing interesting problem in Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production SunOS XYZ 5.10 Generic_138888-07 sun4u sparc SUNW,Sun-Fire-880 Datafile is autoextend on and enough free space is available in mount point on