JAVA-COM bridge and WEB forms, Have you done it? Can you help? Heeeelp
Date: 20 Jun 2003 12:03:34 -0700
Message-ID: <8e6b14d8.0306201103.3c61c0eb_at_posting.google.com>
I have Followed the step by step instructions in the Metalink article titled "Automating OLE Server from Web Forms using a JAVA-COM bridge(Doc ID 175178.1-attached.) very carefully a number of times and Can't get it to work. I continually get a "FRM-92100 Your connection to the server was interrupted" error when I click on the button that [Quoted] sets the beans custom properties. Th details of this error say: "Java Exception. Java.lang.NullPointerException" Followed by a stack of other Java information…
Has Anyone else attempted to implement this solution? If so, has anyone seen this error? I get the error when trying to do all the client stuff on a client, and the same error when I try to implement the whole thing on the appserver(putting the client specific files in the appropriate directories on the server) I also tried re-writing the bean so that all the OpenWord method does is put out a message – No message and no luck.
My system is: Oracle 9iAS on Windows 2000 SP 2, Oracle forms 6i, Oracle 8.1.6 Database.. Jinitiator 1.1.8.16
If this is not possible, Does anyone know a different way to store word/Excel docs in the database from web forms? I'm really stuck! Any help would be appreciated
The Directions were as follows:
WRITING THE JAVA BEAN
- Download the JACOB bridge from http://danadler.com/jacob.
- Place jacob.jar and f60all.jar in the CLASSPATH
- Place jacob.dll in the System Path
- Install jdk 1.1.8
- Write the java bean code (Example Code Below) using notepad and save it to a file - msword.java
- Compile msword.java to msword.class using javac.exe
CODING THE FORM
Create a form with one bean area item, two text items and a push button.
Write the following code in the WHEN BUTTON PRESSED trigger:
set_custom_property('BEAN_AREA5',1,'OPENWORD',''); set_custom_property('BEAN_AREA5',1,'INSTEXT',:text_item9); set_custom_property('BEAN_AREA5',1,'SAVEWORD',:text_item11); set_custom_property('BEAN_AREA5',1,'CLOSEWORD','');
Set the implementation class property of the bean area item to msword DEPLOYING THE FORM WITH THE JAVA BEAN FOR FORMS 6i
- Package msword.class into a jar file using the jar.exe. Open a MS DOS box, set the PATH to <oracle_home>\JDK\bin directory and execute the following command:
jar -cvf msword.jar msword.class
2) Unzip jacob.jar using winzip and repackage the classes into a jar file
using jar.exe. For example, let us assume that jacob.jar has been extracted to the folder c:\jacob. Change directory to c:\jacob and make sure that the PATH still points to <oracle_home>\JDK\bin directory.
Execute the following command.
jar -cvf jacob.jar *.*
3) Sign msword.jar,jacob.jar and import the certificate to the
client machine. Please refer to Note:166636.1 for instructions on this.
4) Place jacob.dll in the System PATH of the client PC running Jinitiator
or place it in the jinitiator/bin directory.
5) Place the signed jacob.jar in the Jinitiator/lib directory of the client PC.
6) Place msword.jar in the CODEBASE directory of the Application Server and specify
msword.jar in the ARCHIVE/ARCHIVE-JINI tag of the formsweb.cfg or static html file.
7) Run the form in a web environment. Enter values for the text to insert into
word and filename of the word document. Press the button. This will invoke
word, insert the text , save the word document and exit word.
Here is the Bean
import oracle.forms.ui.*; import oracle.forms.properties.*; import oracle.forms.handler.*;
import com.jacob.com.*;
import com.jacob.activeX.*;
public class msword extends VBean {
private static final ID OPENWORD= ID.registerProperty("OPENWORD");
private static final ID INSTEXT= ID.registerProperty("INSTEXT");
private static final ID SAVEWORD= ID.registerProperty("SAVEWORD");
private static final ID CLOSEWORD= ID.registerProperty("CLOSEWORD");
private ActiveXComponent MsWordApp;
private Object MsWordAppobj;
private Object Documents;
private Object Document;
private Object Selection;
public msword()
{
System.out.println("Bean has been initialised");
}
public void OpenWordDoc()
{
MsWordApp = new ActiveXComponent("Word.Application");
MsWordAppobj = MsWordApp.getObject();
Dispatch.put(MsWordAppobj, "Visible", new Variant(true));
Documents = MsWordApp.getProperty("Documents").toDispatch();
Document = Dispatch.call(Documents,"Add").toDispatch();
}
public void InsertText(String InsText)
{
Selection = Dispatch.get(MsWordAppobj,"Selection").toDispatch(); Dispatch.put(Selection,"Text",InsText);
}
public void SaveFile(String filename)
{
Dispatch.call(Document,"SaveAs",filename);
}
public void CloseWord()
{
Variant Cls = new Variant(false);
Dispatch.call(Document, "Close", Cls);
MsWordApp.invoke("Quit", new Variant[] {});
}
public boolean setProperty(ID id,Object value)
{
if(id==OPENWORD)
{ OpenWordDoc(); return true; } else if(id==INSTEXT) { InsertText(value.toString()); return true; } else if(id==SAVEWORD) { SaveFile(value.toString()); return true; } else if (id==CLOSEWORD) { CloseWord(); return true; } else return super.setProperty(id,value);}
public static void main(String[] args)
{
msword ms = new msword();
ms.OpenWordDoc(); ms.InsertText("Hello we are in word"); ms.SaveFile("c:\\kavi.doc"); ms.CloseWord(); }
} Received on Fri Jun 20 2003 - 21:03:34 CEST