Forum Stats

  • 3,722,782 Users
  • 2,244,412 Discussions
  • 7,850,085 Comments

Discussions

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

How to add Java bean in Oracle forms 12C

user13281377
user13281377 Member Posts: 4
edited February 2019 in Forms

Hello friends,
I'm trying to include a javabean in a form of Oracle forms.
First of all I am using an example of javabean obtained from the following address Read/Write a file on the client machine - Oracle Forms PJCs/Java Beans . Copy the form and the javabean to my server, but when wanting to modify the file formsweb.cfg I can not find any archive_jini tag, so I proceeded to add the name of the jar file in the archive tag.

pastedImage_0.png

After doing all this I open my form from the browser and clicking on the button that calls a method, it does not do anything and does not show any error in the java console.

Please, if someone explains to me that I am doing badly or what is missing, I appreciate your comments.

Tagged:

Best Answer

Answers

  • Holger.Lehmann
    Holger.Lehmann Member Posts: 430 Silver Badge
    edited January 2019

    One required step is to sign the Jar File with a trusted certificate (e.g. verisign or other) I think the current timestamp of the signed jarfile is out of date.

    Then it should work.

    But fpr your purpose you could use the Webutil libraries from Oracle.

    Regards

    Holger

  • user13281377
    user13281377 Member Posts: 4
    edited January 2019

    Holger, I re-signed the jar file with a certificate of my own, I suppose that this should also work, I loaded it again on the server but just as executing the application it does not work and it does not give me any error either.

    pastedImage_0.png

    I'm waiting for your help, thanks.

  • François Degrelle
    François Degrelle Member Posts: 12,335 Bronze Crown
    edited February 2019

    Hello,

    When you play with JavaBeans, ALLWAYS display the Java console at runtime to see what happen (or not).


    Francois

  • Michael Ferrante-Oracle
    Michael Ferrante-Oracle Member Posts: 6,490 Employee
    edited February 2019

    As Holger mentioned, rather than using a custom Java Bean you can use the Oracle provided WebUtil.  Although this will be somewhat overkill for just one function (upload/download), WebUtil is provided with a pre-signed jar file and is mostly configured out of the box.  Further, Oracle supports WebUtil.  Oracle will not support your custom Java Bean if you have issues with it.

    Also, it is important that you use Java 8.  Java 7 is extremely old and is no longer supported.  Finally, self-generated certificates should no longer be used.  You can make them work, but this is not recommended and will eventually be removed from support in Java.  You need a certificate provided from a trusted/known CA (e.g. Verisign, Thawte, etc)

  • F.Matz
    F.Matz Member Posts: 35 Red Ribbon
    edited February 2019

    You need to verify your jar file in the right way:

    DOS> jarsigner -verify <file.jar>

    Hope that helps,

    Friedhold.

  • Valters Erglis
    Valters Erglis Member Posts: 1 Green Ribbon

    Hello! Did this get resolved? I have a similar, maybe the same problem with 12c Forms Builder. I try run a form from this tutorial - https://sites.google.com/site/craigsoraclestuff/oracle-forms---how-to-s/forms-how-to-use-a-calendar-in-a-form , but when triggering JavaBean, nothing happens.

    I added the .jar files in C:\Oracle\Middleware\forms\java , as well added them to FORMS_BUILDER_CLASSPATH. Then edited the formsweb.cfg same as user13281377 in this location - C:\Oracle\Middleware\forms\templates\config

    But then I figured that this was a wrong cfg, cause I run forms on WebLogicDomain, so I edited this one - C:\Oracle\Middleware\user_projects\domains\base_domain\config\fmwconfig\servers\WLS_FORMS\applications\formsapp_12.2.1\config

    But nothing changes, the JavaBean does not respond on runtime. Maybe I need to locate the .jar files in different location, what do you think guys?

  • Michael Ferrante-Oracle
    Michael Ferrante-Oracle Member Posts: 6,490 Employee
    Accepted Answer

    @User_XQOEU

    The first problem, and probably the most significant is that you are editing managed configuration files in a text editor. You MUST edit managed configuration files using Fusion Middleware Control. Your manually added changes will be ignored and/or rolled back.

    The documentation is your friend:

    https://docs.oracle.com/en/middleware/developer-tools/forms/12.2.1.4/working-forms/configuring-and-managing-forms-services.html

    Additional things of note:

    1. Your bean JAR file must be signed. If you don't know how to sign a JAR, Google is your friend too: https://www.google.com/search?q=java+sign+jar+with+trusted+certificate

    2. Take advantage of the detail that the Java Console exposes. You might need to enable a higher trace level (e.g. 2 or 3). https://www.google.com/search?q=java+console+trace+level In the console look carefully for things like "File not found..." or "Unable to load....". Read those errors carefully. They will almost always give you a clear clue as to why things are failing if the issue is related to not finding/downloading something.

    3. The JAR files you downloaded from that example are verrrrrry old. Likely they need to be recreated/recompiled using a newer Java version. So you need the source code.

    F.MatzValters Erglis
  • Valters Erglis
    Valters Erglis Member Posts: 1 Green Ribbon

    Thank you, Michael!

    I decompiled the Jars I needed, then recompiled with a Java version that worked for my project, signed the Jars and now it works.

    F.Matz
Sign In or Register to comment.