Hi All,We could use a bit of insight and help if anyone has a moment.We currently have a project that is quite huge (thousands of classes) including the GWT client, a spring service layer and hibernate persistence layer.We are trying to split up the project into more manageable pieces including:
- client project (contains our GWT widgets, RequestFactories, etc, Spring servlets)
- service project (contains the spring service layer, web services (REST, SOAP))
- persistence project (contains the domain beans - hibernate mapped objects, persistence code, etc)
- shared project (classes that can be used on both the client (gwt compiled) and server side.
Everything compiles and works (unit tests, etc) until we hit GWT's compile. At this point, we get complaints about GWT not being able to see items in the service layer (which makes sense, it is trying to compile references to the beans, services, etc).We've tried a number of approaches, including using @ServiceName instead of @Service and using the <source .../> specifications on the modules. Right now we a few errors we are unable to resolve:1 - we get this one for every Adapte:)[ERROR] Errors in 'file:/C:/workspace/client/src/main/java/com/mycompany/adapter/alert/AlertBeanGwtAdapter.java'[ERROR] Line 14: No source code is available for type com.mycompany.service.alerts.IAlertService; did you forget to inherit a required module?
2 - if we omit the "-strict" parameter when compiling GWT, we get this:[ERROR] An internal compiler exception occurredcom.google.gwt.dev.jjs.InternalCompilerException: Failed to get JNode...[ERROR] <no source info>: public interface com.mycompany.service.alerts.IAlertService...org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding[ERROR] at AlertBeanGwtAdapter.java(14): private IAlertService getService() {return (IAlertService) EcmLocator.getApplicationContext().getBean(IAlertService.TYPE);}org.eclipse.jdt.internal.compiler.ast.MethodDeclarationCan anyone shed any light on what we may be doing wrong? When it is all in one project, everything works fine, but splitting it into multiple projects (that are references via maven) it fails.Example source (some code is omitted):Client Layer:...client.alerts.request.IAlertRequest.java@ServiceName(value = "com.mycompany.service.alerts.IAlertService.class", locator = "SpringServiceLocator.class")
public interface IAlertRequest extends RequestContext{Request<Long> countAlerts(String eventClass, Date dateLimit);Request<List<IAlertTypeProxy>> listAlertTypes();Request<List<IAlertBeanProxy>> listUnviewedAlerts();}...web.SpringServiceLocator.javapublic class SpringServiceLocator implements ServiceLocator{public Object getInstance(Class<?> clazz){ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(RequestFactoryServlet.getThreadLocalServletContext());return context.getBean(clazz);}}OurProject.gwt.xml<?xml version="1.0" encoding="UTF-8"?><module rename-to='Oris4'><inherits name='com.google.gwt.editor.Editor' /><inherits name='com.google.gwt.json.JSON' /><inherits name='com.google.gwt.logging.Logging' /><inherits name='com.google.gwt.resources.Resources' /><inherits name='com.google.web.bindery.requestfactory.RequestFactory' /><inherits name='com.google.gwt.user.User' /><inherits name="com.google.gwt.i18n.I18N" /><inherits name='com.mycompany.theme.clean.Clean' /><inherits name='com.mycompany.Persistence' /><entry-point class='com.mycompany.client.OurEntryPoint' /><set-configuration-property name="UiBinder.useSafeHtmlTemplates" value="true" />
@RemoteServiceRelativePath("springGwtServices/marketService")public interface MarketService extends RemoteService {
MarketDTOContainer getMarketData(Date begin, Date end)
public interface MarketRiskServiceAsync {
void getMarketData(Date begin, Date end, AsyncCallback<MarketDTOContainer> async);
..
@Service("marketService")public class MarketServiceImpl implements MarketService { ...
<servlet><servlet-name>springGwt</servlet-name><servlet-class>org.spring4gwt.server.SpringGwtRemoteServiceServlet</servlet-class></servlet><servlet-mapping><servlet-name>springGwt</servlet-name><url-pattern>springGwtServices/*</url-pattern></servlet-mapping>
Hi Thomas,First, I want to say that your examples and blogs have helped us a lot over the last year! Thanks!Secondly, thanks for the super quick reply!I added the sources generation to the POMs for the Shared, Persistence and Services projects, and fixed the ".class" issues. However, we are still getting issues with GWT not being able to find classes/sources... they (at the moment) seem to be around classes specified via @ExtraTypes which we have specified in our IAppRequestFactory interface.eg:@ExtraTypes({IAlertProxy.class, IAlertOptionsProxy.class, IAlertTypeProxy.class})public interface IOris4RequestFactory extends RequestFactory{IAlertRequest alertRequest();...}The specific error is:Resolving com.mycompany.client.IAppRequestFactoryFound type 'com.mycompany.client.IApp4RequestFactory'[ERROR] Annotation error: cannot resolve com.mycompany.client.alerts.proxy.IAlertProxyjava.lang.ClassNotFoundException: com.mycompany.client.alerts.proxy.IAlertProxy...[ERROR] Annotation error: expected class java.lang.Class, got null
I have a question to the people who are using multi-module maven projects instead of one (I am currently developing a Spring/GWT/RequestFactory project as one big maven projects).I do much of the debugging in eclipse by starting a WTP jetty instance and then starting the GWT development mode. By this I can debug both backend and frontend and whenever I change something in the client code it will work without me restarting development mode and when i change something on the backend WTP should re-publish it and it should also work fine (although some stuff doesn't).
I am using eclipse m2eclipse for dependency management. ( I don't use mvn jetty:run or so but WTP) .Does the same workflow also work when I split up the one maven module into multiple? (shared, client, server)I guess it should as the m2 will probably make sure that everything is in the right place.But maybe somebody has already experience with debugging a multi maven module in eclipse and can give some feedback.
Thanks for the feedback Thomas,I was actually following the gwt_with_maven docs at the google developers page (tough only creating one maven war project).So I think it should be quite easy to split it up.
BTW. do these 3 (or 4 respectively) modules go into separate VCS repositories or do all go into one?I guess they could be checked into separate VCS repositories as the dependency is handled by maven anyways.
How do you do deployment? Do you have a dedicated jetty instance on the production server and package the war and deploy it?
Can you expand a bit more on how to get GWT DevMode to work by launching from within Eclipse? We are used to creating a GWT Application run configuration in eclipse but right now I am not sure how to get to work so that the HTML/webapp resources are available to the run configuration.
[WARN] No startup URLs supplied and no plausible ones found -- use -startupUrl
And when I go to the root of the jetty server the index.html file is not there.
So I am assuming I would do this on the client project right? I can't sem to get it to work though.No matter what settings I put for the war I get this message:[WARN] No startup URLs supplied and no plausible ones found -- use -startupUrl
And when I go to the root of the jetty server the index.html file is not there.