No source code is available problem for my server side code while testing

642 views
Skip to first unread message

Venkat

unread,
Jul 17, 2012, 9:23:33 AM7/17/12
to google-we...@googlegroups.com
Hi, I am trying to test my code and I am encountering this issue. Please let me know what is the problem.

com.java.client.ExportDataToExcelTest - is in my "src" folder and ExportDataToExcelTest.java - is in "test" folder. Is that the problem. I saw in the GWT tutorial that if the test forlder's client package structure should be same as that in the src folder, the test will run. I have all the src and test folders in my classpath with all the required jars and the project also.


Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.
[ERROR] Errors in 'file:/C:/Users/x/workspace/ExportDataToExcel/test/com/java/client/ExportDataToExcelTest.java'
   [ERROR] Line 13: No source code is available for type com.ag.sapwidgets.server.ExportDataToExcel; did you forget to inherit a required module?
[ERROR] Unable to find type 'com.java.client.ExportDataToExcelTest'
   [ERROR] Hint: Previous compiler errors may have made this type unavailable
   [ERROR] Hint: Check the inheritance chain from your module; it may not be inheriting a required module or a module may not be adding its source path entries properly
[ERROR] Errors in 'file:/C:/Users/x/workspace/ExportDataToExcel/test/com/java/client/ExportDataToExcelTest.java'
   [ERROR] Line 13: No source code is available for type com.ag.sapwidgets.server.ExportDataToExcel; did you forget to inherit a required module?
[ERROR] Unable to find type 'com.java.client.ExportDataToExcelTest'
   [ERROR] Hint: Previous compiler errors may have made this type unavailable
   [ERROR] Hint: Check the inheritance chain from your module; it may not be inheriting a required module or a module may not be adding its source path entries properly


Thanks.

Paul Robinson

unread,
Jul 17, 2012, 9:59:05 AM7/17/12
to google-we...@googlegroups.com

> [ERROR] Line 13: No source code is available for type com.ag.sapwidgets.server.ExportDataToExcel; did you forget to inherit a required module?
>
This is the problem. You are trying to convert to javascript the server class ExportDataToExcel. Either its package should be added to the set of packages to be converted to javascript, or else you should stop referring to it from code that is converted to javascript.

Paul

Venkat

unread,
Jul 17, 2012, 10:07:05 AM7/17/12
to google-we...@googlegroups.com
Hi Paul, thanks for your reply. I understand that server side code cannot be changed to Javascript. The question here was how can I test my server side logic in GWT.

Paul Robinson

unread,
Jul 17, 2012, 10:20:57 AM7/17/12
to google-we...@googlegroups.com
On 17/07/12 15:07, Venkat wrote:
> how can I test my server side logic in GWT.
GWT is client-side technology. To test server code, set up tests that are independent of GWT. That is, just create regular junit tests that check your server classes work properly.

Paul


Venkat

unread,
Jul 17, 2012, 10:44:30 AM7/17/12
to google-we...@googlegroups.com
Hi Paul, I have changed the test from GWT Test to JUnit Test. Now I am getting this exception. I am using SmartGWT, and in server side coding I have SmartGWT classes used for Business Logic.


java.lang.UnsatisfiedLinkError: com.smartgwt.client.util.JSOHelper.createObject()Lcom/google/gwt/core/client/JavaScriptObject;
at com.smartgwt.client.util.JSOHelper.createObject(Native Method)
at com.smartgwt.client.core.DataClass.<init>(DataClass.java:35)
at com.smartgwt.client.rpc.RPCResponse.<init>(RPCResponse.java:71)
at com.smartgwt.client.data.DSResponse.<init>(DSResponse.java:71)
at com.java.client.ExportDataToExcelTest.testRetrieveData(ExportDataToExcelTest.java:24)
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:597)
at junit.framework.TestCase.runTest(TestCase.java:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:243)
at junit.framework.TestSuite.run(TestSuite.java:238)
at junit.framework.TestSuite.runTest(TestSuite.java:243)
at junit.framework.TestSuite.run(TestSuite.java:238)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

Thanks,

Paul Robinson

unread,
Jul 17, 2012, 11:05:23 AM7/17/12
to google-we...@googlegroups.com
I don't use SmartGWT, but it looks like you're using client-side code there. If you're using regular junit tests, then you must stick to server-side classes.

It also looks like you're testing RPC code...do you really need to test from client to server in one test?

Paul
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/OxQ4_m9VCkMJ.
To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.


Venkat

unread,
Jul 17, 2012, 11:24:30 AM7/17/12
to google-we...@googlegroups.com
I have removed the client side code from the test case, the exception is gone. But I got one exception that is below. I am guessing this is because I did not specified the test folder in my Module. If yes, can you please tell me how can I do that. Usually we specify the src folder as <source> in module, how can we do that for test folder.


testRetrieveData(com.java.server.ExportDataToExcelTest)com.google.gwt.junit.JUnitFatalLaunchException: The test class 'com.java.server.ExportDataToExcelTest' was not found in module 'com.java.ExportDataToExcelTest'; no compilation unit for that type was seen
at com.google.gwt.junit.JUnitShell.checkTestClassInCurrentModule(JUnitShell.java:743)
at com.google.gwt.junit.JUnitShell.runTestImpl(JUnitShell.java:1346)
at com.google.gwt.junit.JUnitShell.runTestImpl(JUnitShell.java:1309)
at com.google.gwt.junit.JUnitShell.runTest(JUnitShell.java:653)
at com.google.gwt.junit.client.GWTTestCase.runTest(GWTTestCase.java:441)
at com.google.gwt.junit.client.GWTTestCase.run(GWTTestCase.java:296)
at com.java.server.GWTAllTests.main(GWTAllTests.java:19)

Venkat

unread,
Jul 17, 2012, 11:59:21 AM7/17/12
to google-we...@googlegroups.com
Let me explain what I did, I think you got confused of what I have said. I changed the package of my test class in test folder to the same server side package in src folder.

com.java.client to com.java.server. Then the exception previously showed was gone and below exception showed up. I changed because I thought, I am testing server side code so the package structure should be same as the server side package of src folder.

Paul Robinson

unread,
Jul 17, 2012, 12:14:52 PM7/17/12
to google-we...@googlegroups.com

On 17/07/12 16:24, Venkat wrote:
> I have removed the client side code from the test case, the exception is gone. But I got one exception that is below. I am guessing this is because I did not specified the test folder in my Module. If yes, can you please tell me how can I do that. Usually we specify the src folder as <source> in module, how can we do that for test folder.
You can add any number of packages in your gwt.xml file using:
<source path="foo"/>
<source path="bar"/>

Paul
Message has been deleted

Venkat

unread,
Jul 17, 2012, 12:31:33 PM7/17/12
to google-we...@googlegroups.com
I did that, but some of the jars from SmartGWT are not getting inherited. and I don't know what are those classes modules are, so that I can inherit that. I tried giving the classes directly with the package structure, but it is changing it to module and saying it does not exist.

Paul Robinson

unread,
Jul 17, 2012, 12:32:13 PM7/17/12
to google-we...@googlegroups.com
Not as far as I know, but then why would you want to? You should only import the modules you need, otherwise I imagine the compile will take longer.

Some google modules import other google modules, so you don't need to add an <inherit> for literally every one.

Paul

On 17/07/12 17:26, Venkat wrote:
I have done that, now it is giving me the inherit issue, can you tell me I can inherit all the classes that I want to inherit like this.
Can I use "*" to inherit all.
<inherits name="com.google.gwt.* " />


On Tuesday, July 17, 2012 12:14:52 PM UTC-4, Paul Robinson wrote:
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.

Venkat

unread,
Jul 17, 2012, 12:57:28 PM7/17/12
to google-we...@googlegroups.com
I mean I was just trying and the classes that it told me to inherit, I don't know the module for those classes. I am waiting for reply from SmartGWT forum, man these guys does not reply at all, these guys suck. GWT forum is bang on target, I really like it. Thanks for your support.
Reply all
Reply to author
Forward
0 new messages