Hi Jose,
I have something like this. As you can see, I only close the resources
on error, I think because I had a similar problem like you. You should
also check the Server if it crashed, from time to time it's happening
and you have to restart it. I hope it helps.
Jbase jB = null;
Jconnection jC = null;
Logger log = LoggerFactory.getLog(Main.class.getName());
try {
String host = Props.inst().getHost();
log.info("JBase host: " + host);
if (host.length() == 0) {
jB = new Jbase();
} else {
jB = new Jbase(host);
}
jC = jB.connect();
Jedi f1 = jC.open("F.GBI.EXP");
// Create a select list
ArrayList metaList = new ArrayList();
JdynArray rec = f1.read("T.T");
int apps = rec.scalar(2);
f1.close();
log.info("Application finished");
System.exit(0);
} catch (Exception e) {
log.error("Exception in Main: " + e.getMessage());
try {
if (jC != null) {
jC.disconnect();
}
if (jB != null) {
jB.terminate();
}
} catch (Exception e1) {
}
System.exit(2);
}
On May 22, 9:31 pm, Jose L <[email protected]> wrote:
> Hi,
>
> I'm using the javaOBjEX server in Jbase, and I'm having problems
> with the server. If i start the javaOBjEX server, and connect to it by
> Java, the first time I use it, it seems to work well. But after the
> application has finished, if I try to use it again, it fails to
> connect. The program is very simple, it just connects to the jbase
> server, read the SPF and show a camp. After that it closes the
> connection and terminate the Jbase object:
>
> [...]
> private void prueba2() {
> Jbase jB = null;
> Jconnection jC = null;
> JdynArray jd1 = null;
> Jedi f1 = null;
> JselectList js1 = null;
> String key1 = null;
> String s = null;
> try { // Instantiate Jbase object and connect
> System.out.println("Antes");
> jB = new Jbase("miaux02:3570");
> System.out.println("creado");
>
> jC = jB.connect();
> // Open a file
> System.out.println("conectado");
> f1 = jC.open("F.SPF");
> System.out.println("open");
> // Create a select list
> js1 = f1.select();
> System.out.println("select");
>
> // Read the file – use the JselectEndException to
> detect end of
> file
> try {
>
> while (true) {
> key1 = js1.readnext();
> jd1 = f1.read(key1);
> s = jd1.field("CURRENT.RELEASE");
> System.out.println("Record " + key1 +
> " = " + s);
> }
> } catch (JselectEndException see) {
> System.out.println("End of File!");
> // Catch any other exceptions
> } catch (Exception ee) {
> System.out.println(ee.getMessage());
> // System.exit(1);
> }
> // All done, so close file
> try {
> f1.close();
> } catch (Exception c) {
> c.printStackTrace();
> }
> } catch (Exception e) {
> e.printStackTrace();
> System.out.println("jBASE Error! – " +
> e.getMessage());
> System.exit(2);
> }
> // Disconnect and terminate Jbase object
> try {
> jC.disconnect();
> jB.terminate();
> } catch (Exception e) {
> e.printStackTrace();
> }
> jB = null;
> System.out.println("terminating\n");
> }
> [...]
>
> The first time I run the program, with server up, it works well. The
> next time, the programs just tries to instantiate the Jbase object
> without any result, it just waits there until you close the
> application. There is no error message, but it doesn't do anything. If
> I comment the line jB.terminate() and call the method prueba2 twice,
> it works well both times, but the next time I try to run the program
> it fails with the same result(No result, no error message). Any idea?
>
> Thanks in advance.
>
> Jose L
>
> I'm using jdk1.5.06 for the client program, and the jdiag results for
> my Jbase are the following:
>
> jsh miasmi01 ~ -->jdiag
> jdiag - jBASE diagnostic '$Revision: 1.13 $'
>
> System Information
> ==================
>
> System : HP-UX miaux02 B.11.11.U 9000/800
> UNIX User : miasmi01 (uid 117, euid 117)
> Tty name : /dev/pts/td
> Time : Fri May 22 15:15:25 2009
>
> Environment
> ===========
>
> JBCPORTNO : Not Set
> JBCRELEASEDIR : '/opt/jbase4'
> JBCGLOBALDIR : '/opt/jbase4'
> JBCDATADIR : '/ve3/miasmi01/bnk/bnk.run/../bnk.data'
> HOME : '/ve3/miasmi01/bnk/bnk.run'
> JEDIFILEPATH : '/ve3/miasmi01/bnk/bnk.run'
> JEDIFILENAME_MD : '/ve3/miasmi01/bnk/bnk.run/VOC'
> JEDIFILENAME_SYSTEM : '/opt/jbase4/src/SYSTEM'
> SYSTEM File is (DICT) : '/opt/jbase4/src/SYSTEM]D'
> RELEASE Information : Major 4.1 , Minor 5.17 , Patch 5690
> (Change 52756)
> Spooler dir (JBCSPOOLERDIR) : '/ve3/miasmi01/bnk/bnk.run/jspooler'
> JBCEMULATE : 'prime'
> WARNING: Cannot access Executable path '/ve3/miasmi01/bnk/bnk.run/
> globuspatchbin', error 2
> Object path (JBCOBJECTLIST) : '/ve3/miasmi01/bnk/bnk.run/
> globuspatchlib:/ve3/miasmi01/bnk/bnk.run/lib:/ve3/miasmi01/bnk/bnk.run/
> glo'
> jBASE Compiler Run-time : '/opt/jbase4/config/system.properties'
> Program dir (JBCDEV_BIN) : '/ve3/miasmi01/bnk/bnk.run/bin'
> Subroutine dir (JBCDEV_LIB) : '/ve3/miasmi01/bnk/bnk.run/lib'
> Max open files : 2048
> jsh miasmi01 ~ -->
--~--~---------~--~----~------------~-------~--~----~
Please read the posting guidelines at:
http://groups.google.com/group/jBASE/web/Posting%20Guidelines
IMPORTANT: Type T24: at the start of the subject line for questions specific to
Globus/T24
To post, send email to [email protected]
To unsubscribe, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/jBASE?hl=en
-~----------~----~----~----~------~----~------~--~---