Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Call PL/SQL procedure from JDeveloper

722502Oct 7 2009 — edited Oct 8 2009
Is that possible to call PL/SQL procedure from JDeveloper?
What's the setup and coding requirements?

Thanks for any input.

Comments

Honghsi Lo-Oracle
It looks like Tuxedo JCA Adapter is running in a JVM that its jre/lib/logging.properties still has threshold set at INFO level.
young_matthewd-759774
Wish that was the case. ;-) Override the logging.properties with the -D directive java.util.logging.config.file. No something else is messing up the logging. In my JUL logging setup I got:
handlers=java.util.logging.ConsoleHandler
.level=FINEST

# just in case
com.oracle.tuxedo=FINEST
com.bea.core=FINEST
weblogic=FINEST

java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter
FINEST is definately set for everything Oracle. Plus in the resource adapter I set everything to debug. Weird thing is that the JCA adapter writes out to a "tuxedo" text file in the execution directory. Mimics some of the console data. I am getting some tracing but not complete (from what I have seen on other forum posts).
young_matthewd-759774
Little bit farther in my configuration but not the entire way. Using the TuxedoClientSideResourceAdapter resource adapter. Setup in Spring as follows:
	@Bean
	ResourceAdapterFactoryBean tuxedoResourceAdapter() {
		TuxedoClientSideResourceAdapter ra = new TuxedoClientSideResourceAdapter();
		ra.setLocalAccessPointSpec("//INV000000121176:7001/domainId=matthew");
		ra.setRemoteAccessPointSpec("//vsgtu817.sfa.se:48172/domainId=TR817TU");

		.... (set debug, timeout, local/remote stuff....)

		ResourceAdapterFactoryBean fc = new ResourceAdapterFactoryBean();
		fc.setResourceAdapter(ra);

		SimpleTaskWorkManager stwm = new SimpleTaskWorkManager(); // basic WM from Spring
		fc.setWorkManager(stwm);
		fc.setBootstrapContext(new SimpleBootstrapContext(stwm));  // basic Context from Spring

		return fc;
	}

	@Bean
	public ManagedConnectionFactory tuxedoManagedConnectionFactory() {
		return new TuxedoManagedConnectionFactory();
	}

	@Bean
	public LocalConnectionFactoryBean tuxedoConnectionFactoryBean() {
		LocalConnectionFactoryBean lcfb = new LocalConnectionFactoryBean();
		lcfb.setManagedConnectionFactory(tuxedoManagedConnectionFactory());

		return lcfb;
	}

	@Bean
	public ConnectionFactory tuxedoConnectionFactory() {
		return (ConnectionFactory) tuxedoConnectionFactoryBean().getObject();
	}

	@Bean
	public CciTemplate tuxedoCciTemplate() {
		CciTemplate ct = new CciTemplate();
		ct.setConnectionFactory(tuxedoConnectionFactory());

		return ct;
	}
There is a bunch of Spring stuff mixed in but the main idea is to wrap the Connection Factory in a template bean (CciTemplate) that eats a Tuxedo interaction specification and handles the start/stop of the connection plus execution. Nowhere in the configuration are resources or the local/remote resource sessions identified. The Oracle documentation says that with the client side the container is responsible for defining resources. Great. How? ;-) Tried doing it by hand:
	@Autowired
	CciTemplate template;

	@Test
	public void pieces() throws ResourceException, TPReplyException, TPException {
		TuxedoConnectionFactory tcf = (TuxedoConnectionFactory)template.getConnectionFactory();
		
		Connection con = ConnectionFactoryUtils.getConnection(template.getConnectionFactory(), template.getConnectionSpec());
		
		DMImportBean impBean = new DMImportBean();
		impBean.setRemoteName("whatever");
		impBean.setResourceName("whatever");
		impBean.setSessionName(new String[] {"TR817TU"});
		
		ConfigurationManager.getInstance().activateImport(impBean, tcf.getFactoryName());

		TDomainContext ctx = ((TuxedoJCAConnection)con).getTDomainContext();
		ctx.tpcall("whatever", recordIn.getTypedBuffer(), flags);
	}
The code fails on a NullPointer to getProviderRoute in the TuxedoConnectionImpl. Just wondering if I am on the right track?
young_matthewd-759774
After rereading the Oracle documentation concerning the 3 ways of defining the configuration (xml, factory and client-side) I tested the regular Resource Adapter (RA) with XML and the factory/client-side through their RA properties. All 3 methods update the configuration manager when the RA is registered via the supervisor when Spring issues a call to the start method when the ResourceAdapterFactoryBean is created (afterSetProperties call). So I should have a configuration regular of which RA implementation I choose. However, the setup stills fails in the TuxedoInteraction.doTPCall with a NullPointer exception. Assuming the problem is still down in the TuxedoConnection implementation.

Set the following in my Tuxedo Client Side RA:
		ra.setAutoTran(true);
		
		ra.setSpCredentialPolicy("LOCAL");
		
		ra.setLocalAccessPointSpec("//INV000000121176:7001/domainId=INV000000121176");
		ra.setRemoteAccessPointSpec("//vsgktdp010:30100/domainId=tdp010k2");
		
		ra.setImpResourceName("TOUPPER");
Ran a test:
	@Test
	public void dummy() {
		ArrayList<RouteGroup> services_set = ServiceManager.getServiceGroupByName("TOUPPER");
		for (RouteGroup service : services_set) {
			System.out.println(service.getServiceName());
		}
	}
which finds the TOUPPER service. So the configuration step looks like it works. Guessing that my route is not available.
young_matthewd-759774
Small step further. Went back to a problem with the TJAService startup whereby I was getting a naming exception. Something with create subcontexts so I added a Spring SimpleNamingContextBuilder to define a default context. That elevated the TJAService 072 fatal. Which resulted in a different failure not a Null pointer exception:
org.springframework.dao.DataAccessResourceFailureException: CCI operation failed; nested exception is javax.resource.ResourceException: TPCALL failed TPException:TPENOENT(6):0:0:TPED_MINVAL(0):QMNONE(0):0:No local or remote domain available for TOUPPER
Caused by: javax.resource.ResourceException: TPCALL failed TPException:TPENOENT(6):0:0:TPED_MINVAL(0):QMNONE(0):0:No local or remote domain available for TOUPPER
	at com.oracle.tuxedo.adapter.cci.TuxedoInteraction.doTPCall(TuxedoInteraction.java:1019)
	at com.oracle.tuxedo.adapter.cci.TuxedoInteraction.execute(TuxedoInteraction.java:407)
	at org.springframework.jca.cci.core.CciTemplate$2.doInInteraction(CciTemplate.java:276)
	at org.springframework.jca.cci.core.CciTemplate$1.doInConnection(CciTemplate.java:217)
	at org.springframework.jca.cci.core.CciTemplate.execute(CciTemplate.java:194)
	... 32 more
1 - 5
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Nov 5 2009
Added on Oct 7 2009
6 comments
2,594 views