Skip to Content
0
Former Member
Apr 05, 2004 at 09:18 PM

getConnection Exception--EP6 SP2 with patch3

24 Views

Hi,

I am trying to connect to SAP as per the Connector FrameWork sample code documentatation. The code is as shown below,

import com.sapportals.htmlb.page.DynPage;

import com.sapportals.htmlb.page.PageException;

import com.sapportals.portal.htmlb.page.JSPDynPage;

import com.sapportals.portal.htmlb.page.PageProcessorComponent;

import com.sapportals.portal.prt.component.IPortalComponentRequest;

import com.sapportals.portal.prt.runtime.PortalRuntime;

import com.sapportals.portal.prt.logger.ILogger;

import com.sapportals.portal.prt.logger.Level;

import com.sapportals.portal.ivs.cg.IConnectorGatewayService;

import com.sapportals.portal.ivs.cg.IConnectorService;

import com.sapportals.portal.ivs.cg.ConnectionProperties;

import com.sapportals.connector.connection.IConnection;

public class MySAPParProject extends PageProcessorComponent {

public DynPage getPage() {

return new MyDynPage();

}

public class MyDynPage extends JSPDynPage {

public MyDynPage() {

this.setTitle("MySAPParProject-->SAP Connection");

}

public void doInitialization() {

}

public void doProcessAfterInput() throws PageException {

}

public void doProcessBeforeOutput() throws PageException {

IPortalComponentRequest request = (IPortalComponentRequest) this.getRequest();

// all coding concerning the connection is included in this method.

doSAPConnection(request);

//doSAPDirectConnect(request);

}

private void doSAPConnection(IPortalComponentRequest request) {

ILogger logger = PortalRuntime.getLogger();

logger.setLevel(Level.SEVERE);

logger.severe("MySAPParProject--->doSAPConnection");

String sapSystem = "CE8N";

// sample code for a connection to a SAP system

IConnection connection = null;

ConnectionProperties conprop = null;

try { // get the Connector Gateway Service

Object connectorservice = PortalRuntime.getRuntimeResources().getService( IConnectorService.KEY);

logger.severe("MySAPParProject ->doJCoConnection getService");

IConnectorGatewayService cgService =(IConnectorGatewayService) connectorservice;

logger.severe("MySAPParProject ->doJCoConnection connectorservice");

if (cgService == null) {

logger.severe("Error in get Connector Gateway Service <br>");

}

try {

ConnectionProperties cp =

new ConnectionProperties(request.getLocale(),request.getUser());

logger.severe("User ID= " + cp.getUser());

logger.severe("Locale ID= " + cp.getLocale());

logger.severe("Log Path= " + cp.getLogPath());

//logger.severe("MySAPParProject-->Before Key = " + cgService.getKey().toString());

connection = cgService.getConnection(sapSystem,cp);

//logger.severe("MySAPParProject-->After Key = " + cgService.getKey());

} catch (Exception e) {

logger.severe("MySAPParProject-->Connection to SAP system failed " + e.getMessage() + "<br>");

}

if (connection == null) {

logger.severe("MySAPParProject-->Connection is null to " + sapSystem + " System <br>");

}

else {

logger.severe("MySAPParProject-->Connection succesful");

}

} catch (Exception e) {

logger.severe("MySAPParProject-->Exception occured" + e.getMessage() + "<br>");

}

}

}

}

The portalapp.xml file entries as shown below

<?xml version="1.0" encoding="ISO-8859-1"?>

<application>

<application-config>

<property name="SharingReference" value="com.sap.portal.ivs.connectorservice,htmlb"/>

</application-config>

<components>

<component name="default">

<component-config>

<property name="ClassName" value="MySAPParProject"/>

<property name="SecurityZone" value="com.sap.portal.pdk/low_safety"/>

</component-config>

<component-profile>

<property name="SystemIdentifier" value="PDK_R3_BACKEND">

<property name="personalization" value="dialog"/>

</property>

<property name="tagLib" value="/SERVICE/htmlb/taglib/htmlb.tld"/>

</component-profile>

</component>

</components>

<services/>

</application>

Here the code fails at the line,

connection = cgService.getConnection(sapSystem,cp);

It throws an exception as

getConnectionFactoryName()- parameter com.sap.portal.reserved.system.ConnectionFactoryClass not found.

This error we didn't get when had patch2 installed. We applied patch 3 since we were getting connection = null after executing cgService.getConnection(sapSystem,cp);. Can you please me help in resolving this issue. Thanks in advance.

Thanks

Ajoy