cancel
Showing results for 
Search instead for 
Did you mean: 

Where to place global java libraries for message mappings?

Former Member
0 Kudos

Hello,

during my message mappings i have to lookup some values from r3. Therefore i have created a RFC Funktion on R3 and developed a java archive (using the generated proxy classes created by the SAP Enterpise Connector wizard) to access the RFC. As the classes should be shared across several applications i think they should be placed at a global place (where the classloader of the WebAS can pick them up for all applications).

Now my question is:

Where/how do i place the jar(s)?

I have already tried the following (using Netweaver Developer Studio):

1.) Created a Library Project (including my jar) -> ok.

2.) Deployed on the server using IDE -> ok.

3.) Created a user defined funktion within my message mapping an try to use one of my classes of the deployed library -> ERROR !!!!! -> Cannot resolve symbol MyClass ...

4.) Created a Ear and Web Project to test the availability of my classes in Ear projects -> when i use one of my classes within a jsp it works fine!

Whats going wrong within the message mapping? It seems the classes are available on the server?

Thanks

Peter

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Peter,

We use in our project some JAVA custom objects and properties files which reside on the local file system of XI.

All custom jar's and properties files have been placed on the user.dir and/or user.home variables. i.e. (where user is the XI runtime user)

user.dir = /usr/sap/XD1/DVEBMGS00/j2ee/cluster/server

user.home = /home/xd1adm

These system variables are accessible to all Java classes from the runtime.

Hope this information will help you.

Cheers,

Rob.

Former Member
0 Kudos

Hi,

We are trying to read a XML properties file in multi-App server environment.

Can you please tell us as to how to read the following at runtime:

user.dir = /usr/sap/XD1/DVEBMGS00/j2ee/cluster/server

user.home = /home/xd1adm

I want to use this in my Java User defined function.

Thanks

Ashish

Former Member
0 Kudos

> Hi,

> We are trying to read a XML properties file in

> multi-App server environment.

>

> Can you please tell us as to how to read the

> following at runtime:

>

> user.dir = /usr/sap/XD1/DVEBMGS00/j2ee/cluster/server

>

> user.home = /home/xd1adm

>

> I want to use this in my Java User defined function.

>

> Thanks

> Ashish

Try this:

// get the system property that contains the server path
String sysDir = System.getProperty("com.sap.systemdir");

String userDir = System.getProperty("com.sap.userdir");

Or if you want to check all the available system variables on your system, try this code in one function:

// Get all system properties
    Properties props = System.getProperties();
    
    // Enumerate all system properties
    Enumeration enum = props.propertyNames();
    for (; enum.hasMoreElements(); ) {
        // Get property name
        String propName = (String)enum.nextElement();
    
        // Get property value
        String propValue = (String)props.get(propName);
    }

Enjoy Java.

Cheers,

Roberto.

Former Member
0 Kudos

Hi Peter,

the mapping uses its own classloader. You have to create an Imported Archive in the Integration Builder in the software component version you create your mappings. Load up the jar into this Imported Archive.

If you want to use the library in several software component versions you can create one software component version for the Imported Archive and let all other software component versions be based on this one.

Hope this helps

Stephan

Andrzej_Filusz
Contributor
0 Kudos

Hi!!!

Could you explain what does it mean: "create one software component version for the Imported Archive and let all other software component versions be based on this one"?

Regards,

Andrzej Filusz

Former Member
0 Kudos

Hi Andre, try creating SCV's in SLD that will be based on the other SCV, we define it as a dependency in SLD.

-Saravana