cancel
Showing results for 
Search instead for 
Did you mean: 

Could the org.omg.cwm package be used directly?

Former Member
0 Kudos

Hi,

I want to use the org.omg.cwm.resource.Relational package directly in my project. I write a simple Java class to test it. The class file like this:

//CwmTest.java

import org.omg.cwm.resource.relational.RelationalPackageImpl;

import org.omg.cwm.resource.relational.Table;

public class CwmTest {

public CwmTest(){

RelationalPackageImpl relPkg = new RelationalPackageImpl();

Table tab = relPkg.getTable().createTable();

}

public static void main(String args[]) {

CwmTest cwmTest = new CwmTest();

}

}

I have imported all the necessary jars in the classpath and this file could be compiled. But when I run it, there are some errors:

Exception in thread "main" java.lang.NullPointerException

at org.omg.cwm.resource.relational.RelationalPackageImpl.refClass(RelationalPackageImpl.java:663)

at org.omg.cwm.resource.relational.RelationalPackageImpl.getTable(RelationalPackageImpl.java:173)

at CwmTest.<init>(CwmTest.java:12)

at CwmTest.main(CwmTest.java:16)

Could the org.omg.cwm package be used directly or may I use it in a wrong manner?

Thank you very much!

Message was edited by: Jianhui Si

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Jianhui Si,

relPkg.getTable() will return a Table reference. I think, using this a new table cannot be created, since Table class doesnt have createTable() method.

Regards,

Uma

Former Member
0 Kudos

Hi Uma,

I don't think the relPkg.getTable() will return a Table reference. According to the docment, I'm sure relPkg.getTable() will return a TableClass, and TableClass have the createTable() method.

The problem is when I call the relPkg.getTable(), it throws the NullPointerException. I don't know why, maybe I use it in a wrong way or the org.omg.cwm package included in the BI SDK is not a complete java implementation of cwm standard.

Thanks&Best Regards!

Jianhui

Former Member
0 Kudos

Hi,

In order to award points,you just have to choose one of the options "Helpful answer,Very Helpful answer,Answered question".This will automatically award points.

There is one possibilty, are you using any extra jar which is not normally referenced from the server directly.If that is the case,you will have to deploy the Project along with the jar file.In order to do that.Put the jar within the lib folder of your project ,remove this jar from the list of external jars,and add reference to this jar as internal reference(Select the "Add Jars" options in the build path,library tab) and then deploy.

I am curious because I do not see the Interface RelationalPackageImpl among the standard interfaces for the specified package.

Regards,

Harish

(Please award poinbts for helpful answers)

Former Member
0 Kudos

Hi Harish,

Thanks for your instruction, I have changed this topic to a question, so I can award points for your answers now:-)

As you can see from the CwmTest.java I posted in the topic, I don't use any extra jar. Actually, I just want to use the java implementation package of CWM included in the BI SDK. But I don't know how to use it directly.

The RelationalPackageImpl isn't a standard interface of the CWM. I think it's a implementation class of the RelationalPackage interface which is produced by JMI(Java Metadata Interface). It's a factory class for the other classes like Table and Column. You can find it in the sap.combimmr~cwm_1.0_source_JMI.jar which is inclued in the BI SDK. Its package path is org.omg.cwm.resource.relational.RelationalPackageImpl.

Thanks&Best Regards!

Jianhui

Former Member
0 Kudos

Hi,

This is the exact line where the error has occured(as can be seen from the exception log)

Table tab = relPkg.getTable().createTable();

relPkg.getTable() returns null.

org.omg.cwm.resource.relational package can be seen but RelationalPackageImpl is not being exposed directly.Please

refer to the javadocs shown below.

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/8b933099-0201-0010-8fbe-cf0...

So it is fairly obvious that the class you are trying to use cannot be directly used.

Hope this is clear.

Regards,

Harish

(Please award points for helpful answers)

Former Member
0 Kudos

Hi Harish,

Thanks to your repley. Because I'm a new register and have no points, I don't know whether I can award answers. I'm very sorry for that. If I can, I would like to open another new post to reward you for you answers:-)

I also have found the javadocs you gave me, but it doesn't tell me how to use them, it just show the standard interfaces.

Do you know how to create a Table? I just find how to use a Table from the examples of the BI SDK's developer guide "devguide.pdf":

//example from devguide.pdf

List tables = rel.getTable();

if (tables == null || tables.size() == 0) {

throw new ServletException("no tables found");

}

Table table = (Table) tables.get(0);

But the devguide doesn't tell me how to create a Table by myself. So could you tell me hwo to create a Table if we could do that.

Thanks for your kindhearted reply again!

Thanks&Best Regards!

Jianhui