Problem using external jars in my java component

Hi Guys,
I just wanted to ask how to properly reference an external jar to a java dc. I already have an external library dc which contains my external jars and also compilation and assembly public parts,  a j2ee library which has the assembly public part of the external jars that is deployed to the server, a java dc which has the compilation public part of the external jar.
My problem is whenever I trigger a method of the java dc in my webdynpro dc I'm having an exception. weird thing is when I put the whole method from the java dc to the webdnypro dc it functions well. So I'm thinking if the interaction between my java dc and j2ee lib dc has to do with this maybe I'm missing some configuration.
need your insight on this one.
Thanks,

Hi TznHuang,
Pleaserefer to this blog might helpful for you
/people/raphael.vogel/blog/2008/05/05/how-to-use-external-libraries-in-the-sap-component-model-part-ii
Also please build external DC and then sync sorurces and sync used DC from inactive DC TAB for DC where you have used
external DC.
Hope bit helps
Regards
Arun Jaiswal

Similar Messages

  • Using external Jar with a mobile application

    Hi folks!
       I need some help with my application, i make a simple mobile application and i need to use a external jar, in this case, this jar have a simple JAVA class that represents a manipulation with eSWT, so my problem is How to using external Jar in NetWeaver 7.1?
       I see other threads that have a same doubts, but i don´t have a solution for my problem.
       Thats it.

    Hi Sivakumar,
    I have similar problem. i want use iText or similar jar files to create pdf. I have currently developed a UI component for handheld. I have dont the following things:
    1)Created a external dc of type external library
    2) addedd the jar in the build path
    3) added the jar in the lib folder of the webdynpro project
    4) added the external jar dc as dependency in my webdynpro project
    I am getting no class def found eror still for some wierd reason. please let me know if some step is missing. I have pasted the trace.
    rror starting the framework
    java.lang.reflect.InvocationTargetException
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at com.sap.tc.mobile.cfs.startup.pda.Startup.main(Unknown Source)
    Caused by: java.lang.NoClassDefFoundError: com/cete/dynamicpdf/Font
         at com.sap.demo.testui.testapp.comp.SignatureStandard.runApps(SignatureStandard.java:88)
         at com.sap.demo.testui.testapp.comp.TestCompView.wdDoInit(TestCompView.java:85)
         at com.sap.tc.mobile.wdlite.progmodel.core.Controller.enter(Controller.java:21)
         at com.sap.tc.mobile.wdlite.progmodel.core.View.enter(View.java:45)
         at com.sap.tc.mobile.wdlite.progmodel.core.Application.setCurrentView(Application.java:133)
         at com.sap.tc.mobile.wdlite.progmodel.core.Application.navigate(Application.java:169)
         at com.sap.tc.mobile.wdlite.progmodel.core.Application.enter(Application.java:19)
         at com.sap.tc.mobile.wdlite.progmodel.core.WDLite.setCurrentApplication(WDLite.java:148)
         at com.sap.tc.mobile.wdlite.progmodel.core.WDLite.launchApplication(WDLite.java:80)
         at com.sap.tc.mobile.wdlite.container.ContainerApp.startApp(ContainerApp.java:171)
         at com.sap.tc.mobile.wdlite.container.AppMenuView.onActionLaunchApp(AppMenuView.java:325)
         at com.sap.tc.mobile.wdlite.container.AppMenuView.invokeEventHandler(AppMenuView.java:368)
         at com.sap.tc.mobile.wdlite.progmodel.core.AbstractViewElement.doHandleEvent(AbstractViewElement.java:199)
         at com.sap.tc.mobile.wdlite.renderer.api.UIElement.doHandleEvent(UIElement.java:369)
         at com.sap.tc.mobile.wdlite.renderer.api.UIImageButton.mouseReleased(UIImageButton.java:148)
         at com.sap.tc.mobile.wdlite.renderer.api.UIElement.dispatchMouseReleasedWidgetEvent(UIElement.java:412)
         at com.sap.tc.mobile.wdlite.renderer.api.UIElement$1.mouseReleased(UIElement.java:455)
         at com.sap.tc.mobile.wdlite.renderer.swt.MouseEventDispatcher.mouseUp(SWTControl.java:380)
         at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:137)
         at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
         at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)

  • How to use external jars in NW2004

    Hello Experts,
    can i use the same approach mentioned in the below Weblog for using the external jars in NW2004.
    /people/bertram.ganz/blog/2008/11/24/how-to-use-external-jar-files-in-web-dynpro-development-components
    and if not then what will be the best way to achieve it in  NW2004.
    Please provide your inputs on above.
    Regards,
    Siddharth

    Hi Sidharth,
    If you are using web dynpro DC perspective then you need to follow the following points to use the external jar files in it.
    1. Create a external library project.
    2. copy the external jars in the library folder os the projects.
    3.) Select all the jars from the u201CLibrariesu201D folder, Right click and then select Development Component and click on Add to Public Part
    4.Select the first Radio Button (Provides an API)and give some nameto it.
    5. Repeat the step no 3 but now select the second radio button other than as selected in step no 4.
    6. Now build your lirary DC.
    7. Now create a j2ee DC project.
    8. ) Expand the node DC Definition and Right Click on Used DC. Select Add Used DC.
    9. Select the External Library DC with build time dependency.
    10.Right click on the J2EE DC and then select Development Component followed by Build
    11. Right click on the J2EE DC and then select Development Component followed by Deploy
    now you can use both the libary DC and the j2ee DC in your web dynpro DC as used DC.
    But if you have created a web dynpro project only(but not DC) than you can directly add the external jars in java build path
    hope this will help
    regards
    Narendra
    Edited by: Narendra Singh on Oct 27, 2009 11:22 AM

  • Can I use axis.jar in my custom component

    Can I use axis.jar in my custom component.
    Is there any license need to user this jar ??
    Thanks

    In our UCM setup axis has been implemented in a custom component to consume webservices. As Axis falls under the Apache license you can freely import it in your custom java classes.

  • Jar File Problem Using External Packages

    I am having problems creating an Executable jar file that imports classes from my own package.
    I can create an exe jar no problem without using any external packages, but when I use an external package the jar will not execute.
    I am using WindowsXP, my package is in,
    C:/MyClasses/Database
    the class files are stored loose, not in a jar file
    I have tried altering the class-path in the manifest file, but to no joy - I may have not changed the classpath correctly!
    Please help
    Magic

    This is a mine field of "correct programming style."
    External jars, if very general, could be placed in the directory jre/lib/ext.
    In some cases you can unzip the external jars and add them to your own jar.
    The manifest.mf migth be looked into, and of course you need to communicate your patching!
    As you remarked, it might be a problem of class path usage.
    For that the jar tool documentation might explain it better than I.

  • Problem with using external jar file

    Hi
    I was using mail.jar library for swing application to send and receive emails. It just works perfect when I run with netbeans. But when I run the executable jar file at dist folder it runs but mail related functions doesn't work.What should I do now to make it work with mail features outside netbeans.
    thanks
    vinay
    Edited by: 899657 on Dec 24, 2011 5:07 AM

    899657 wrote:
    No. Because I am running the jar file which is created by netbeansNetbeans creates a 'dist' directory in which it puts your jar and a "dist/lib' directory in which it puts the dependent jars that are added to the project using 'project right mouse click'->Properties->Libraries. I would expect to see this 'dist/lib' directory contain mail.jar and activation.jar and any other jars that your jar needs. Within your program jar's manifest I would expect to see the Class-Path attribute have relative reference these jars ( lib/mail.jar lib/activation.jar ) and for the Main-Class attribute define your main class.
    Given this setup then you should be able to just type -
    java -jar yourjar.jarto run your program.

  • Linking external jar when starting java -jar problem

    Good day!
    A have a little program:
    import org.apache.log4j.Logger;
    public class CMDClient {
         static Logger log;
         public static void main(String args[]) throws Exception {
              log.info("test");
              System.exit(1);
    }I created a test.jar file, containing only this test class. When I start it by java -jar test.jar it cannot find linked (through import) Log4j library. Is there a way to link external jar to "jared" application?
    Good day!
    A have a little program:
    import org.apache.log4j.Logger;
    public class CMDClient {
         static Logger log;
         public static void main(String args[]) throws Exception {
              log.info("test");
              System.exit(1);
    I created a test.jar file, containing only this test class. When I start it by java -jar test.jar it cannot find linked (through import) Log4j library. Is there a way to link external jar to "jared" application?
    Good day!
    A have a little program:
    import org.apache.log4j.Logger;
    public class CMDClient {
         static Logger log;
         public static void main(String args[]) throws Exception {
              log.info("test");
              System.exit(1);
    I created a test.jar file, containing only this test class. When I start it by java -jar test.jar it cannot find linked (through import) Log4j library. Is there a way to link external jar to "jared" application?
    Error was: java.lang.NoClassDefFoundError

    There's a Class-Path attribute in the manifest.

  • Build problem with external JAR

    Hello,
    I am developing a custom web dynpro component. I need to use some of the JARs delivered by SAP such as com.sap.security.api (can be found in \SAP\IDE\IDE70\eclipse\plugins). I have included the JAR files to my project in Properties->Java Build path->Libraries). Everything is working fine: I can build/deploy the application and it is running fine in the application server.
    Anyhow, the problem comes when I try to activate my activity in the development configuration perspective.
    In the build log I can see for example the following:
    [javac] ERROR: /usr/sap/VDD/JC10/j2ee/cluster/server0/temp/CBS/3/.B/4789/t/067D33924E6154CA5284F16652954F88/gen_wdp/packages/com/mydevelopment/mystuff/MyComponent.java:29: package com.sap.security.api does not exist
         [javac] ERROR: import com.sap.security.api.IUser;
    I have been reading several threads about similar issues, but I am not quite satisfied with the answers. There seems to be several opinions about how to solve this.
    Now the questions are:
    - How can I get rid of this error?
    - What is the best practice in overall to use the SAP delivered JARs in custom web dynpro component/project.
    Edited by: Pa Pa on Nov 21, 2009 2:07 PM

    Hi Pa,
    To use any jar in your DC  on NWDI track, you need to follow the following steps:
    1. Go to Your project>Used DCs and try to add a new one by locating the DC among those which are already present on the track.
    2. If you are not able to locate any DC with the required jars then,
    a. Create an external library DC where you need to add all the jars in the library folder of the project using an activity.
    b. Create public parts for compile time and run time for this dc.
    c. Deploy the DC.
    d. Goto src folder of your dc and say Add files to DTR (your jars would be on the track)
    e. Deploy the external library DC so that the Jars are deployed on the portal server.
    f. Add the public parts of this External Library DC under used DCs of your development component.
    g. Add this external library under library references of your project.
    h. Build and deploy.
    i.  Now try activating your activity.
    Use the following link to know how to execute these steps.
    [Add and Use Jars through used DCs|http://help.sap.com/saphelp_nw70ehp1/helpdata/en/46/3ce3e4df201d63e10000000a11466f/frameset.htm]
    [Screen Shots|http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=(J2EE3417100)ID1078501850DB00490474849923920126End?blog=/pub/wlg/9517]
    Please let me know, if you ahave any doubt.
    Regards,
    Tushar Sinha

  • How to use external jar files ??

    Hi all,
    In my user-defined function for mapping (IR) , I want to make use a Class which is available in an external .jar file.
    Our XI is working on Windows2003 OS. I set the classpath in OS environment variables.
    But it is not working.
    Where I should set the classpath ?
    Can anyone help.
    Thanks in Advance
    Chemmanz
    Message was edited by: Chemmanz

    Hi Chemmanz,
    For user defined functions, it is not necessary to use the external jar files.
    Just follow the below steps:
           1.      To create a new user-defined function, choose <b>Create New Function</b> in the data-flow editor at the bottom of the screen, on the left-hand side.
           2.      Specify the attributes of the new function in the subsequent window:
    Name:
    Technical name of the function. The name is displayed in the function chooser and on the data-flow object.
    Description:
    Description of how the function is used.
    Arguments:
    In this table, you specify the number of input values the function can process, and name them. All functions are of type String.
           3.      In the subsequent window, you can create Java source code:
                                a.      You can import Java packages to your methods from the Imports input field, by specifying them separated by a comma or semi-colon:
    You do not need to import the packages java.lang., java.util., java.io., and java.lang.reflect. since all message mappings require these packages and therefore import them.
    In addition to the standard packages, you can also specify Java packages that you have imported as archives and that are located in the same, or in an underlying software component version as the message mapping.
                                b.      Create your Java source text in the editor window or copy source text from another editor.
           4.      Confirm with Save and Close.
           5.      User-defined functions are limited to the message mapping in which you created the function. To save the new function, save the message mapping.
           6.      To test the function, use the test environment.
    The new function is now visible in the User-Defined function category. When you select this category, a corresponding button is displayed in the function chooser pushbutton bar. To edit, delete, or add the function to the data-flow editor, choose the arrow next to the button and select from the list box displayed.
    Regards,
    Prasad U

  • Using External JAR file within Web Dynpro DC

    Hi,
    I have created a Web Dynpro DC and I need to use an external JAR file.
    I want to use this external JAR file within the same Web Dynpro DC and NOT creating another DC to house the external JAR file as I can see from the blog.
    I have included the external JAR file in the "lib" folder of the Web Dynpro DC.
    When I tried to perform a DC build, it keeps complaining error....
    How should I solve this problem...
    Thanks.
    mike

    Hi Mike,
    Go through the below which might help you.
    Re: Lookup of RFC Destinations
    Re: Import a Java Bean from a different DC
    Web Dynpro References
    Re: j2ee library with webdynpro
    Re: Web Services :HTTP Destination not getting resloved.
    http://help.sap.com/saphelp_nw70/helpdata/en/46/3ce3e4df201d63e10000000a11466f/frameset.htm
    Thanks n Regards,
    Jhansi Miryala

  • Using external libraries over signed Java applet: InvocationTargetException when running locally with 7u51

    We have a signed Java applet that uses external libraries, specifically the OpenOffice application libraries.
    We have a problem running Java applet with 7u51 of "InvocationTargetException" when use these libraries OpenOffice, that is not signed; regardless of the browser used (Mozilla Firefox, Explorer, Chrome).
    Please, as you could solve this problem?   This problem can not arose with 7u40 and earlier..
    Best regards.

    In  java - JRE 1.7.0_51-b13 and signed applet - Stack Overflow found solution. I've missed to add in external jars manifest this: 
    Trusted-Library: true

  • How to use external JARs in Eclipse

    Hello.
    I created a jar file like that:
    jar -cvf0 WarShell.jar WarShell.class
    I want to use WarShell.class in Eclipse but it not in my classpath,so I choose [Project] -> [Properties] -> Java Build Path -> Libraries -> Add External JARs and add WarShell.jar to the list.
    But when I run the program I got a Exception:NoClassDefFoundError.
    Why?How to fix it?
    Another question... Your classpath is not available in Eclipse,right?
    Thanks for your time! ^_^

    Hello.
    I created a jar file like that:
    jar -cvf0 WarShell.jar WarShell.class
    I want to use WarShell.class in Eclipse but it not in
    my classpath,so I choose [Project] -> [Properties]
    -> Java Build Path -> Libraries -> Add External JARs
    and add WarShell.jar to the list.
    But when I run the program I got a
    Exception:NoClassDefFoundError.
    Why?How to fix it?Did you run your program from Eclipse ?
    If yes, it should work (or seek for an Eclipse-specific forum.)
    But if not, keep in mind that your project settings are limited to Eclipse. You'll have to define a correct classpath for running your application.
    Another question... Your classpath is not available
    in Eclipse,right?Mine? I don't think it is available for anyone ;-P

  • Problem using External Library DC

    Hello,
    First of all, I'm a java programmer kind of new to NWDI. I'm working on a Java DC that's meant to send e-mails which of course uses the JavaMail API, so I understand I have to add to my SC another DC of type External Library that contains the jar files I need. Here is where it all falls apart. I have followed step by step several possible solutions to this and still gettin' the "import cannot be resolved" error message in my Java Perspective. The procedure I'm using is the one described in this thread:
    Re: External Library DC question
    Can anyone help me out with this? I'm using NWDS 7.0.14
    Thanks in advance...

    HI,
    That post was to big. so without reading it im posting.
    1 create a library DC.
    2.Add the jar files in it.
    3. create a public part of type API and SDA.(use SDA if you want to deploy it with the project(just like an add external jar file) or use API part (if you want to use it as add jar file option))
    4. use that public part in you DC.
    5. use add jar option in your build path.
    if you have done these an having an error please tell me at what step you have a problem

  • Problem using ojdbc14.jar in JDev 11g

    Hi
    I have an application created in 10g.
    I was trying to create the same in 11g and encountered this problem with the ojdbc14.jar.
    The jar has two classes OracleDataSource and OracleConnectionCacheImpl inside the same package.
    OracleConnectionCacheImpl is inherited from OracleDataSource.
    OracleDataSource has a protected variable called m_dataSourceName.
    The child class, OracleConnectionCacheImpl used this variable.
    I have this jar included in my classpath.
    When i run the application, it throws a runtime error.
    Following is the stack trace.
    java.lang.NoSuchFieldError: m_dataSourceName
         at oracle.jdbc.pool.OracleConnectionCacheImpl.(OracleConnectionCacheImpl.java:189)
         at oracle.apps.snw.hubserver.common.XhubConnectionPool.(XhubConnectionPool.java:46) -------------------------------------> from here its my code
         at oracle.apps.snw.hubserver.common.XhubConnectionPoolManager.addConnectionPool(XhubConnectionPoolManager.java:168)
         at oracle.apps.snw.hubserver.common.XhubConnectionPoolManager.getConnection(XhubConnectionPoolManager.java:201)
         at oracle.apps.snw.hubserver.util.SystemParameters.reloadAllParameters(SystemParameters.java:294)
         at oracle.apps.snw.hubserver.util.SystemParameters.(SystemParameters.java:34)
         at oracle.apps.snw.hubserver.util.SystemParameters.getInstance(SystemParameters.java:48)
         at oracle.apps.snw.hubserver.common.XhubConnectionPoolManager.addConnectionPool(XhubConnectionPoolManager.java:155)
         at oracle.apps.snw.hubserver.common.XhubConnectionPoolManager.getConnection(XhubConnectionPoolManager.java:201)
         at oracle.apps.snw.common.util.LanguageQueryBasedNameValueCache.queryAllLanguages(LanguageQueryBasedNameValueCache.java:125)
         at oracle.apps.snw.common.util.LanguageQueryBasedNameValueCache.setCacheParameters(LanguageQueryBasedNameValueCache.java:77)
         at oracle.apps.snw.common.util.LanguageQueryBasedNameValueCache.(LanguageQueryBasedNameValueCache.java:53)
         at oracle.apps.snw.uicommon.TextProvider.populateTextCache(TextProvider.java:100)
         at oracle.apps.snw.uicommon.TextProvider.getTextMessage(TextProvider.java:123)
         at oracle.apps.snw.uicommon.TextProvider.handleGetObject(TextProvider.java:113)
         at java.util.ResourceBundle.getObject(ResourceBundle.java:378)
         at oracle.cabo.ui.data.BundleDataObject.selectValue(Unknown Source)
         at oracle.cabo.ui.data.DataBoundValue.getValue(Unknown Source)
         at oracle.cabo.ui.BaseUINode.getAttributeValueImpl(Unknown Source)
    Can anyone tell me why this error occurs?
    I have checked the Oracle JDBC library of JDev 11g and found that it has ojdbc6.jar
    Is there any compatibility problem with this jar migrating from 10g to 11g?
    Found this related link but could not relate it much.
    Please explain
    JDBC problem: java.lang.NoSuchFieldError: CONNECTION_PROPERTY_THIN_NET_CONN
    Thanks

    I guess you can't use ojdbc14.jar that easy. Some dependencies form ojdbc14.jar are not available under 11g. That 's the reason you have ojdbc6.jar under 11g.
    Timo

  • Problem using misc jar-Files in Composite Application

    Hi there,
    I want to use different jar-Files in my Composite Application on SAP Netweaver 7.3.
    I have created an external Lib DC where I have inserted the libs. After that I created an enterprise EAR and added the dependency to the PP of the external lib DC.
    After that I added the a dependency to my CAF-EAR. But I cannot access the mehtods and functions from my jar files.
    What's wrong there?
    Another question: Is it possible to add the jar-files directly to my CAF-EAR without creating the external library DC and adding a dependency?
    Any help would be greatly appreciated
    Thanks

    Hi, I've downloaded Jacob and got it running on my installation by doing the following:
    1. Download http://danadler.com/jacob/jacobBin_17.zip.
    2. Extract to Jdeveloper10g/jdev/lib/ext/Jacob
    3. Copy jacob.dll to c:/windows/system32
    4. Add JDeveloper10g/jdev/lib/ext/Jacob/jacob.jar to JDev user libraries, calling it 'Jacob'
    5. Add the 'Jacob' library to the project.
    6. Create a word document at c:/java/jacob/file_in.doc
    7. Create a new class with the following code:
    package view;
    import com.jacob.*;
    import com.jacob.activeX.ActiveXComponent;
    import com.jacob.com.Dispatch;
    import com.jacob.com.Variant;
    public class TestJacob
    public TestJacob()
    * @param args
    public static void main(String[] args)
    TestJacob testJacob = new TestJacob();
    testJacob.runTest();
    public void runTest()
    boolean tVisible = true;
    String sDir = "c:\\java\\jacob\\";
    String sInputDoc = sDir + "file_in.doc";
    ActiveXComponent oWord = new ActiveXComponent("Word.Application");
    oWord.setProperty("Visible",new Variant(tVisible));
    Object oDocuments = oWord.getProperty("Documents").toDispatch();
    Object oDocument = Dispatch.call(oDocuments, "Open", sInputDoc).toDispatch();
    }

Maybe you are looking for