Error in juit test case for struts2 action class using StrutsSpringTestCase

Hi
I am getting some error when i am running my Struts2 Action class junit test case using StrutsSpringTestCase class (which is in struts2 junit plugin 2.1.8 version)
Here is the code....
package ipl.admin.action.test;
import java.sql.Timestamp;
import java.util.Date;
import org.apache.struts2.StrutsSpringTestCase;
import ipl.admin.action.RoleMasterNewAction;
import ipl.admin.beans.RoleMasterNewBeanRemote;
import com.opensymphony.xwork2.ObjectFactory;
public class RoleMasterNewActionTest extends StrutsSpringTestCase {
     //XmlBeanFactory bf = new XmlBeanFactory(new ClassPathResource("applicationContext.xml", getClass()));
     RoleMasterNewAction action = new RoleMasterNewAction();
     RoleMasterNewBeanRemote roleMasterBeanNewRemote;
     public RoleMasterNewBeanRemote getRoleMasterBeanNewRemote() {
          return roleMasterBeanNewRemote;
     public void setRoleMasterBeanNewRemote(
               RoleMasterNewBeanRemote roleMasterBeanNewRemote) {
          this.roleMasterBeanNewRemote = roleMasterBeanNewRemote;
     public void setUp() throws Exception {
          super.setUp();
          ObjectFactory.setObjectFactory(new ObjectFactory());
     public void testDoSomeThing() throws Exception {
          //System.out.println(bf.getBean("loginIntercepter"));
          assertTrue(action.doSomeThing());
}I am getting error for this code. Below is the error details.
2010-05-03 17:28:14,671 INFO [com.opensymphony.xwork2.config.providers.XmlConfigurationProvider] - Parsing configuration file [struts-default.xml]
2010-05-03 17:28:14,859 INFO [com.opensymphony.xwork2.config.providers.XmlConfigurationProvider] - Parsing configuration file [struts-plugin.xml]
2010-05-03 17:28:14,999 INFO [com.opensymphony.xwork2.config.providers.XmlConfigurationProvider] - Parsing configuration file [struts.xml]
2010-05-03 17:28:15,015 WARN [org.apache.struts2.config.Settings] - Settings: Could not parse struts.locale setting, substituting default VM locale
2010-05-03 17:28:15,015 INFO [org.apache.struts2.config.BeanSelectionProvider] - Loading global messages from ipl.comm.resources.comman-Lookup
2010-05-03 17:28:15,015 INFO [org.apache.struts2.config.BeanSelectionProvider] - Loading global messages from ipl.comm.resources.comman-label
2010-05-03 17:28:15,015 INFO [org.apache.struts2.config.BeanSelectionProvider] - Loading global messages from ipl.comm.resources.comman-headings
2010-05-03 17:28:15,015 INFO [org.apache.struts2.config.BeanSelectionProvider] - Loading global messages from ipl.comm.resources.comman-messages
2010-05-03 17:28:15,046 INFO [org.apache.struts2.config.BeanSelectionProvider] - Loading global messages from ipl.comm.resources.comman-setup
2010-05-03 17:28:15,046 INFO [org.apache.struts2.config.BeanSelectionProvider] - Loading global messages from ipl.comm.resources.common-errors
2010-05-03 17:28:15,046 INFO [org.apache.struts2.config.BeanSelectionProvider] - Loading global messages from ipl.admin.resources.admin-label
2010-05-03 17:28:15,046 INFO [org.apache.struts2.config.BeanSelectionProvider] - Loading global messages from ipl.admin.resources.admin-lookup
2010-05-03 17:28:15,046 INFO [org.apache.struts2.config.BeanSelectionProvider] - Loading global messages from ipl.admin.resources.admin-headings
2010-05-03 17:28:15,046 INFO [org.apache.struts2.config.BeanSelectionProvider] - Loading global messages from ipl.admin.resources.admin-jndinames
2010-05-03 17:28:15,046 INFO [org.apache.struts2.config.BeanSelectionProvider] - Loading global messages from ipl.birthCertificate.resources.birth-jndinames
2010-05-03 17:28:15,046 INFO [org.apache.struts2.config.BeanSelectionProvider] - Loading global messages from ipl.birthCertificate.resources.birth-labels
2010-05-03 17:28:15,046 INFO [org.apache.struts2.config.BeanSelectionProvider] - Loading global messages from ipl.birthCertificate.resources.birth-headings
2010-05-03 17:28:15,046 INFO [org.apache.struts2.config.BeanSelectionProvider] - Loading global messages from ipl.admin.resources.admin-alert
2010-05-03 17:28:15,046 INFO [org.apache.struts2.config.BeanSelectionProvider] - Loading global messages from ipl.comm.resources.form
2010-05-03 17:28:15,140 INFO [org.apache.struts2.spring.StrutsSpringObjectFactory] - Initializing Struts-Spring integration...
2010-05-03 17:28:15,171 FATAL [org.apache.struts2.spring.StrutsSpringObjectFactory] - ********** FATAL ERROR STARTING UP STRUTS-SPRING INTEGRATION **********
Looks like the Spring listener was not configured for your web app!
Nothing will work until WebApplicationContextUtils returns a valid ApplicationContext.
You might need to add the following to web.xml:
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener> But already i have the listener configurations in my web.xml .
Thanks in advance...

I guess it wasn't reading the right web.xml file.
You may prove it by deleting your web.xml file (don't forget to make a backup), and then run the test again to see whether the error is the same.

Similar Messages

  • Error in running juit test case for struts2 action class

    Hi,
    I am getting error when i am running my junit test case for struts2 action class. Here is the code.
    public class RoleMasterNewActionTest extends StrutsTestCase {
         public void setUp() throws Exception {
            super.setUp();
            ObjectFactory.setObjectFactory( new ObjectFactory() );
         public void testDoSomeThing()throws Exception {
              RoleMasterNewAction action = new RoleMasterNewAction();
              assertTrue(action.doSomeThing());
    }I am getting error at testDoSomeThing(). the error is
    2010-04-30 15:07:12,263 INFO [com.opensymphony.xwork2.config.providers.XmlConfigurationProvider] - Parsing configuration file [struts-default.xml]
    2010-04-30 15:07:12,325 INFO [com.opensymphony.xwork2.config.providers.XmlConfigurationProvider] - Parsing configuration file [struts-plugin.xml]
    2010-04-30 15:07:12,388 INFO [com.opensymphony.xwork2.config.providers.XmlConfigurationProvider] - Parsing configuration file [struts.xml]
    2010-04-30 15:07:12,388 WARN [org.apache.struts2.config.Settings] - Settings: Could not parse struts.locale setting, substituting default VM locale
    2010-04-30 15:07:12,388 INFO [org.apache.struts2.config.BeanSelectionProvider] - Loading global messages from ipl.comm.resources.comman-Lookup
    2010-04-30 15:07:12,388 INFO [org.apache.struts2.config.BeanSelectionProvider] - Loading global messages from ipl.comm.resources.comman-label
    2010-04-30 15:07:12,388 INFO [org.apache.struts2.config.BeanSelectionProvider] - Loading global messages from ipl.comm.resources.comman-headings
    2010-04-30 15:07:12,388 INFO [org.apache.struts2.config.BeanSelectionProvider] - Loading global messages from ipl.comm.resources.comman-messages
    2010-04-30 15:07:12,388 INFO [org.apache.struts2.config.BeanSelectionProvider] - Loading global messages from ipl.comm.resources.comman-setup
    2010-04-30 15:07:12,388 INFO [org.apache.struts2.config.BeanSelectionProvider] - Loading global messages from ipl.comm.resources.common-errors
    2010-04-30 15:07:12,388 INFO [org.apache.struts2.config.BeanSelectionProvider] - Loading global messages from ipl.admin.resources.admin-label
    2010-04-30 15:07:12,388 INFO [org.apache.struts2.config.BeanSelectionProvider] - Loading global messages from ipl.admin.resources.admin-lookup
    2010-04-30 15:07:12,388 INFO [org.apache.struts2.config.BeanSelectionProvider] - Loading global messages from ipl.admin.resources.admin-headings
    2010-04-30 15:07:12,388 INFO [org.apache.struts2.config.BeanSelectionProvider] - Loading global messages from ipl.admin.resources.admin-jndinames
    2010-04-30 15:07:12,388 INFO [org.apache.struts2.config.BeanSelectionProvider] - Loading global messages from ipl.birthCertificate.resources.birth-jndinames
    2010-04-30 15:07:12,388 INFO [org.apache.struts2.config.BeanSelectionProvider] - Loading global messages from ipl.birthCertificate.resources.birth-labels
    2010-04-30 15:07:12,388 INFO [org.apache.struts2.config.BeanSelectionProvider] - Loading global messages from ipl.birthCertificate.resources.birth-headings
    2010-04-30 15:07:12,388 INFO [org.apache.struts2.config.BeanSelectionProvider] - Loading global messages from ipl.admin.resources.admin-alert
    2010-04-30 15:07:12,388 INFO [org.apache.struts2.config.BeanSelectionProvider] - Loading global messages from ipl.comm.resources.form
    2010-04-30 15:07:12,419 INFO [org.apache.struts2.spring.StrutsSpringObjectFactory] - Initializing Struts-Spring integration...
    2010-04-30 15:07:12,419 FATAL [org.apache.struts2.spring.StrutsSpringObjectFactory] - ********** FATAL ERROR STARTING UP STRUTS-SPRING INTEGRATION **********
    Looks like the Spring listener was not configured for your web app!
    Nothing will work until WebApplicationContextUtils returns a valid ApplicationContext.
    You might need to add the following to web.xml:
        <listener>
            <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
        </listener>but already i have the listener configuration in my web.xml.
    Thanks in advance..

    I guess it wasn't reading the right web.xml file.
    You may prove it by deleting your web.xml file (don't forget to make a backup), and then run the test again to see whether the error is the same.

  • Getting error while writing JUnit test case for RestFul Services

    Hi All,
    I have written Restful services in Netbean 6.8.
    It's running well...no issues.
    {color:#0000ff}While writing JUnit test cases for them, I am getting following error:
    {color}{color:#993300}Testcase: testGetAuthenticated(com.ct.services.LoginServicesTest): Caused an ERROR
    Implementing class{color}
    java.lang.IncompatibleClassChangeError: Implementing class
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
    at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:303)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:316)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
    at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:303)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:316)
    at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:160)
    at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:65)
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:52)
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:34)
    at com.ct.services.LoginServices.getAuthenticated(LoginServices.java:205)
    at com.ct.services.LoginServicesTest.testGetAuthenticated(LoginServicesTest.java:84)
    Test com.ct.services.LoginServicesTest FAILED
    F:\NetbeanProjectsWorkspace\DemoProject\nbproject\build-impl.xml:972: Some tests failed; see details above.
    BUILD FAILED (total time: 11 seconds)
    {color:#0000ff}Strange thing is that when I am commenting below lines and its related calls:
    {color}
    {color:#ff0000}EntityManagerFactory mEmf = Persistence.createEntityManagerFactory("AnyName");
    EntityManager mEm = mEmf.createEntityManager();
    {color}
    {color:#0000ff}from my code, JUnit test cases are working fine.
    {color}Anybody having any idea about this ?
    Thanks
    Avi
    Edited by: Avi007 on Aug 28, 2010 5:17 AM

    Hi All,
    [http://stackoverflow.com/questions/2778295/test-driven-development-problem]
    Please refer the above link for the solution
    Thanks
    Avi
    Edited by: Avi007 on Aug 30, 2010 12:33 AM

  • How to write test case for ViewController project using JUnit ?

    Hi All,
    JDev ver : 11.1.1.5
    JUnit : 1.9 jar added.
    I am writing test cases for my ViewController project. View project contains beans and other business logic files.
    So, for that I want to write test cases.
    In lot of codes I have FacesContext instance, there I am getting null pointer error.
    ex:
    public static String getFromHeader(String key) {
    FacesContext ctx = getFacesContext();
    ExternalContext ectx = ctx.getExternalContext();
    return ectx.getRequestHeaderMap().get(key);
    How to write cases for this scenario ?
    I came to know to use mockito, But I dont know how to mock the FacesContext.
    Anyone please help.
    Thanks,
    Gopinath

    Gopinath,
    Although I've not used it and cannot therefore say anything about whether it's useful or not - have you looked at JSFUnit?
    John

  • Writing test case for One-way messaging returns fault

    Hi All,
         We are using latest 11.1.1.7 version of SOA Suite. There is a SOA composite which gets data feed from external party using the one-way message exchange pattern to store the feed into the database.
    i.e. from (Web Service component ----> Mediator ----> DBAdapter). The composite uses one way returns fault pattern. This basically returns only the faults when they occur and seems to work as expected. I can see any runtime errors (like database not available returned to the Mediator and the caller of the web service). However, I am unable to write a test case for the fault returned in case of database adapter unable to connect to database as the 'Emulates' tab is disabled.
    Happy to provide more details if required.
    Thanks

    Hi,
    By looking at the error what you have got it indicates that you are not catching the specific fault which is thrown by bpel1 in bpel2.
    Regards,
    Santosh Hemashekar

  • [svn] 889: Add test case for BLZ-82 where HttpService should return multiple headers with the same name .

    Revision: 889
    Author: [email protected]
    Date: 2008-03-21 13:08:05 -0700 (Fri, 21 Mar 2008)
    Log Message:
    Add test case for BLZ-82 where HttpService should return multiple headers with the same name.
    Ticket Links:
    http://bugs.adobe.com/jira/browse/BLZ-82
    Added Paths:
    blazeds/trunk/qa/apps/qa-regress/remote/MultipleHeadersTest.jsp
    blazeds/trunk/qa/apps/qa-regress/testsuites/mxunit/tests/proxyService/httpservice/MultiHe aderTest.mxml

    Hi again,
    this may be old news to some people, but I just realized we can have the desired benefits I originally listed (encapsulation, reuse, maintainability, security) TODAY by using pipelined functions and using the table() function in Apex report region queries.
    So the report query basically becomes, for example (if get_employees is a pipelined function)
    select * from table(my_package.get_employees(:p1_deptno))
    The only downside compared to a (weakly typed) sys_refcursor is that you have to define the type you are returning in your package spec (or as an SQL type). So it's a bit more coding, but it's still worth it for the other benefits it provides.
    I like Apex even better now! :-)
    - Morten

  • High Availability Test Cases for ECC6.0, PI 7.0, BI 7.0???

    Dear All
    I am in a pretty difficult situation here. I have to write test cases for the components in the High Availability environment. We are running AIX 5L with HACMP/XD clusters ACTIVE/PASSIVE setting. The following components are in the landscape, ECC6.0, PI 7.0 BI 7.0 cFolders 4.0 Portal 7.0 SLD 2004s and Solman 4.0. I have to write test cases for the above components especially ECC, PI BI and cFolders in the HA environment as to
       1.<b>WHAT WILL BE THE EFFECT ON OTHER COMPONENTS IF ECC</b> <b>FAILOVER  and so on for PI and BI</b>,
       2. How do I check the consistency of the system after a failover, since the time for a failover will be anywhere between 3 - 4 mins.
    Can anyone pls give me a 5 or 6  checks like
    Checking RFC connections
    ABAP dumps
    Consistency check (txn: SICK)   and so on
    In the test cases I have to make sure that after a failover the system is up and ready to perform the activities that it was able to before the Failover......
    Will appreciate any suggestions and will definitely reward points for any helpful answers....Thanks in advance.

    Hi Shailesh,
    If you want you can activate SCM_SNC_GEN_1 depending upon business needs or configuration.
    As per my understanding there is no need to activate any business function but if you need additional feature of SNC to be used then refer below help link for more details:
    http://help.sap.com/saphelp_SNC700_ehp01/helpdata/en/a2/6d67d9b60149cb887acf72ae0b90ac/frameset.htm
    In ECC you are going for EPh5 which means no need to activate any additional business function(Normally SNC needs EPh4 only for some the latest feature to be use like in workorder collaboration ManufacturingWorkOrderInformation and ManufacturingWorkOrderProductionProgressNotification XML are used if ECC is with EPh4)
    Regards,
    Nikhil

  • [svn:bz-trunk] 10595: Add ReadOnly test case for bug blz-427

    Revision: 10595
    Author:   [email protected]
    Date:     2009-09-25 11:44:20 -0700 (Fri, 25 Sep 2009)
    Log Message:
    Add ReadOnly test case for bug blz-427
    Ticket Links:
        http://bugs.adobe.com/jira/browse/blz-427
    Modified Paths:
        blazeds/trunk/qa/apps/qa-regress/WEB-INF/flex/services-config.mods.xml
        blazeds/trunk/qa/apps/qa-regress/WEB-INF/src/blazeds/qa/remotingService/Book.java
        blazeds/trunk/qa/apps/qa-regress/WEB-INF/src/blazeds/qa/remotingService/Echo.java
    Added Paths:
        blazeds/trunk/qa/apps/qa-regress/testsuites/mxunit/tests/remotingService/dataTypes/ReadOn lyTest.mxml

  • [svn] 2219: Add a negative constructor test case for RemoteObject destination.

    Revision: 2219
    Author: [email protected]
    Date: 2008-06-24 14:20:55 -0700 (Tue, 24 Jun 2008)
    Log Message:
    Add a negative constructor test case for RemoteObject destination.
    Modified Paths:
    blazeds/trunk/qa/apps/qa-regress/WEB-INF/flex/remoting-config.mods.xml
    Added Paths:
    blazeds/trunk/qa/apps/qa-regress/WEB-INF/src/remoting/ConstructorNegativeTest.java
    blazeds/trunk/qa/apps/qa-regress/testsuites/mxunit/tests/remotingService/ConstructorNegat iveTest.mxml

    Revision: 2219
    Author: [email protected]
    Date: 2008-06-24 14:20:55 -0700 (Tue, 24 Jun 2008)
    Log Message:
    Add a negative constructor test case for RemoteObject destination.
    Modified Paths:
    blazeds/trunk/qa/apps/qa-regress/WEB-INF/flex/remoting-config.mods.xml
    Added Paths:
    blazeds/trunk/qa/apps/qa-regress/WEB-INF/src/remoting/ConstructorNegativeTest.java
    blazeds/trunk/qa/apps/qa-regress/testsuites/mxunit/tests/remotingService/ConstructorNegat iveTest.mxml

  • Creating a chart in TFS showing test cases that pass and failed using lightweight chart in Team Web Access

    How to you build a chart in TFS that show test cases results.
    I'm using lightweight charts in Team Web Access.
    In Team Web Access I go into my project, then I create test cases under the TEST tab and then run my test manually.  Now I want to create a testing progress result chart.  I go into the TEST tab, then click on test plan and notice that
    there is no Chart tab.
    Is this tab configurable or am I missing something?

    To my knowledge, charts are only available for work item queries in TFS web access. If you want to generate test result charts, you can do that using the TFS reporting data in the data warehouse (if your administrator configured it when setting up TFS).
    "You will find a fortune, though it will not be the one you seek." -
    Blind Seer, O Brother Where Art Thou
    Please Mark posts as answers or helpful so that others may find the fortune they seek.

  • How to run test cases in a jar file using junit?

    Hi,
    I want to run test cases in a jar file using junit and the jar file is not in the class path. I wrote the following code, but it does not work.
    import java.net.URL;
    import java.net.URLClassLoader;
    import junit.framework.TestResult;
    import junit.textui.TestRunner;
    public class MyTestRunner {
         public static void main(String[] args) throws Exception{
              URL url = new URL("file:///d:/case.jar");
              URLClassLoader loader = new URLClassLoader(new URL[]{url});
              loader.loadClass("TestCase1");
              TestRunner runner = new TestRunner();
              TestResult result = runner.start(new String[]{"TestCase1"});
              System.out.println(result.toString());
    }Any ideas?
    Thanks a lot.

    Wouldn't it just be easier to put it on the classpath? You're trying to, anyway, with a URLClassLoader, albeit in an entirely unnecessarily complicated way

  • Error whil re-playing the coded ui test cases for internet explorer download window

    Hi,
    I have to create a test automation project which opens the IE and downloads file.
    I have recorded all the steps to download the file to local folder.
    My requirement is I need to download the file to a specific folder and compare those files.
    When I tried to replay the recorded step I am getting error while changing the folder location.
    I can change the file name dynamically but cant change the folder path as the click event of address bar fails.
    I have recorded below steps
    Click on Save drop down
    Click on Save As
    Pop up opens as shown
    I can change the file name at run tims by passing the file name as parameter and it is accepting
    but when I try to change the address it thorws error stating could not find the control with given search properties. I have to pass the folder path as parameter to the test case.
    Please help me in resolving this error.
    Thanks,
    Meenakshi Nagpal
    not able to add images to this post

    Hi Meenakshi Nagpal,
    >>When I tried to replay the recorded step I am getting error while changing the folder location.
    According to your description, could you please tell me how you record these UI actions for coded UI test? Is it handing code or using coded UI test Builder?
    Could you please tell me if you are recording these actions and then you change the folder location or you change the folder location by handing code after you finished these actions recording and then get the error?
    About your issue, I tried to download file to a specific folder using coded UI test builder, I found that it can playback successfully.
    If you are hand coding your coded UI test, I suggest that you can try to record these steps using Coded UI Test Builder. Then
    generate the code and then try to playback check if you can download the file into the
    specific folder.
    In addition, about this error: could not find the control with given search properties. I doubt that the target control did not be found by the searchproperties.
    So I suggest you can try to add more searchproperties for the target control check this issue again.
    I suggest you can also use DrawHighlight Method to check if the correct control is found
    before you perform actions on the target control.
    I find a blog about how to troubleshooting Record and Playback issues in Coded UI Test, you can refer it.
    http://blogs.msdn.com/b/tapas_sahoos_blog/archive/2011/11/07/troubleshooting-record-and-playback-issues-in-coded-ui-test.aspx
    Best Regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • CATT Test case for  ME41 tcode(Multiple items for inventory and service )

    Hello Gurus,
    Now we are having quotation legacy file for Tcode ME41 for inventory and service items. We are using tcode <b>SCAT</b>
    for CATT. Every thing going fine at recording in test case. i dont know where should i specify my legacy file path. I found there is one download option while before running test case. its not taking the file path.  is there any other file path for running test case?
    advice me.
    regards
    dinesh.a
    <b></b>

    Hi
    I think you should use an abap program and not LSMW, because the problem is you have to create a recording for trx ME41 in the LSMW and after you can't change the abap code created.
    In this way you could insert only a certain number of items by a project of LSMW, and it depends on your recording.
    So if you can't know how many item should be loaded, it's very hard to use LSMW.
    Max

  • Test case upload in solar02 transaction using function module

    I have requirement to upload test case and test case name in transaction solar02,
    i want functional module name which will ask for project name, business scenarious, business processes
    test case type,  test case , test case name

    Hello Vinod, see the following code (I assume you have a item data on columns A and B as from row 4, and header data on row 2)
        Set rfcctl = CreateObject("sap.functions")
        Set conn = rfcctl.Connection
        conn.Client = "<client>"
        conn.hostname = "<server>"
        conn.user = user "<username>"
        conn.Language = "<lang>"
        conn.password = "<password>"
        conn.SystemNumber = "<system number>"
        If conn.Logon(0, True) Then
           Set rfc = rfcctl.Add("PROCESS_MESS_UPLOAD")
           Set data = rfc.Tables("MSHD").Rows.Add
           item("WERK") = Range("A2").Value
           item("MSCLA") = Range("B2").Value
           item("SEDAT") = Range("C2").Value
           'add all necessary table columns
            i = 4
            While Range("A" & i).Value <> ""
                Set item = rfc.Tables("MSEL").Rows.Add
                item("ATNAM") = Range("A" & i).Value
                item("ATWRT") = Range("B" & i).Value
                'add all necessary table columns
                i = i + 1
            Wend
            If rfc.Call Then
              'CHECK FOR SUCCESS OR ERRORS
            Else
                MsgBox "Call error", vbOKOnly
                Exit Sub
            end if
        Else
            MsgBox "Logon error", vbOKOnly
            Exit Sub
        End If
        Set rfcctl = Nothing
        Set conn = Nothing
    Note: I haven't used this FM before, so I'm guessing which table fields may be useful to you
    Cheers
    Michael

  • OrdHttpUploadFormData.parseFormData() failed within Struts2 action class

    I got the example servlet PhotoAlbumServlet.java works just fine. So the setup should be good. However, when I need to get upload photo work with Struts2, I got error:
    [5/24/11 17:08:30:189 PDT] 00000020 webapp E com.ibm.ws.webcontainer.webapp.WebApp logError SRVE0293E: [Servlet Error]-[IMW-00005: end-of-stream; client terminated request (or invalid Content-Length)]: com.ibm.ws.webcontainer.webapp.WebAppErrorReport: IMW-00005: end-of-stream&#59; client terminated request &#40;or invalid Content-Length&#41;
    at parseFormData();
    The the request form is fine, since I use same request form and changed the action to point to the demo servlet and it works. So I copy the worked servlet code into my action class and debuged into the code. It failed at parseFormData();
    Here is my action class code:
    public String execute() throws Exception {
    OrdHttpUploadFormData formData = new OrdHttpUploadFormData( request );
    if ( !formData.isUploadRequest() )
         System.out.println("Not upload request!!");
    return INPUT;
    formData.parseFormData();  // <= this step failed.
    So, I guess that struts2 may alternated request object which make the parse failed.
    Has Anyone used ORD work with Struts successfully before? Or if possible that I can get source code of this OrdHttpUploadFormData so that I can debug into it and see what's going on?
    Is there any other alternation or work around for this?
    Thanks in advance for any tips.
    Regards,
    Joe

    By add try - catch block to the parseFormData:
    try {
         formData.parseFormData();
    } catch (Exception e) {
         e.printStackTrace();
    I got:
    [5/25/11 8:28:20:489 PDT] 00000024 SystemErr R oracle.ord.im.OrdHttpUploadException: IMW-00005: end-of-stream; client terminated request (or invalid Content-Length)
    [5/25/11 8:28:20:505 PDT] 00000024 SystemErr R      at oracle.ord.im.OrdMultipartInputStream.read(OrdMultipartInputStream.java:92)
    [5/25/11 8:28:20:505 PDT] 00000024 SystemErr R      at oracle.ord.im.OrdMultipartReader.readLine(OrdMultipartReader.java:152)
    [5/25/11 8:28:20:505 PDT] 00000024 SystemErr R      at oracle.ord.im.OrdMultipartReader.readCheckDelimiter(OrdMultipartReader.java:132)
    ...

Maybe you are looking for