Problem to generate Java package PL SQL in Jdeveloper

Hello

I have problem to create the java class package PL SQL in JDeveloper.

I use jdeveloper database navigator and right-click on a package and choose generate Java then in the Jpublisher window choose my controller view and accept other default values.

I call methods in the generated class in the Action of a button in my JSP page, but when I click the button it throws null pointer exception! I Fund one of the generated method return null and it lead to this exception.

protected DefaultContext __tx = null;

public DefaultContext getConnectionContext() throws SQLException {}

If (__tx == null) {}

__tx = (getConnection () == null)? DefaultContext.getDefaultContext (): new DefaultContext (getConnection ());

}

Return __tx;

};

public connection getConnection() throws SQLException

{

If (__onn! = null) return __onn;

ElseIf (__tx! = null) return __tx.getConnection ();

ElseIf (__dataSource! = null) __onn = __dataSource.getConnection ();

Return __onn;

}

I'm trying to generate the class in the model project and create DataControl to it and use the action method, but noting the change and I get null pointer again!

JDeveloper Versino = 11.1.1.7.0

I would like to ask you another question: why generate java packaging at all?

Where you want to call the package?

Back to your question: you should see the code as

Public Sub setDataSourceLocation (String dataSourceLocation) throws SQLException {}

javax.sql.DataSource dataSource;

try {}

Class cls = Class.forName ("javax.naming.InitialContext");

Object ctx = cls.newInstance ();

Meth java.lang.reflect.Method is CL. GetMethod ("search", new class [] {String.class});

dataSource = (javax.sql.DataSource) meth.invoke (ctx, new Object() {"java: comp/env /" + dataSourceLocation});

setDataSource (dataSource);

} catch (Exception e) {}

again throw java.sql.SQLException ("data source initialization error in" + dataSourceLocation + ":" + e.getMessage ());

}

}

in the generated code. This code search a data source (that you have defined for example on the Weblogic Server) by calling the method

setDataSourceLocaltion("jdbc/HRConnDS");

That look to the top of the n data source stores in the class variable.

Timo

Tags: Java

Similar Questions

Maybe you are looking for

  • Set up the URL on the desktop with the icon of the site

    How to create a desktop icon which is a 'shortcut' to a website URL.  When I try dragging it in the address bar of Safari I get the web block but not the unique icon for the site.

  • Portege R100 USB2 CD-RW/DVD-Rom - Bootable?

    Hello I bought a Toshiba R100 last year and I decided to wait before buying the reader of CD/DVD Toshiba I thought that bios should be updated to support booting from a USB stick or SD card. So far, I don't think that this has been done, so the CD/DV

  • SCB-68 drawing board

    Someone next to the circuit board inside the SCB-68?  Thank you.

  • Outsourcing of the controls on the front panel for a panel floating Subvi

    Hello! I already found a few similar topics, but I still don't know which is the best way to solve my problem. I will try to describe my problem in detail first: I have a main VI that acquires data from a device and displays these data in a large wav

  • PC laptop Pavilion 15: mousepad scrollfunction

    Hello The scrollfunction on my mousepad does not always work. It works, and then out of the blue, it stops working. It seems that the only way to get back running again is to restart my computer, but obviously I don't want to always do this. Why is t