include gwt-graphics into a Eclipse WebApp-Project - eclipse

I try to include the gwt-graphics library into a WebApp-Project made with Eclipse.
This is the description: https://code.google.com/archive/p/gwt-graphics/wikis/Manual.wiki
"Download gwt-graphics.jar and add it to the class path of your GWT project. In addition, you have to add the following line to the GWT module file: After these two steps, you are ready to use GWT Graphics in your GWT project!"
I have done this and after I start the app in super-dev-mode, I got an error from the compiler:
"[ERROR] Unable to find 'org/vaadin/gwtgraphics/GWTGraphics.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source?"
I am not sure how I can solve this.

Did you add it to the class path? If not, you can right click to the jar file and do Add to Classpath

Related

How to Correctly use com.mattbertolini.hermes.Hermes to manage Constants at Server side (GWT)?

Ok, I want to manage Constants at Server level, so com.mattbertolini.hermes.Hermes is a solution.
Please see all my steps:
1- I downloaded hermes-1.2.0.jar & import into correct Library of eclipse (no problem)
2- Create MyConstantsWithLookup.java at client package
import com.google.gwt.i18n.client.ConstantsWithLookup;
public interface MyConstantsWithLookup extends ConstantsWithLookup {
String myMsg();
}
3- create MyConstantsWithLookup.properties file in the same client package. The file has this line:
myMsg=Deleted
4- In ServerData.java in Server package
MyConstantsWithLookup my = Hermes.get(MyConstantsWithLookup.class, "");
String extra=my.myMsg();
When tested in eclipse it works fine but I got Warnign message in eclipse:
[WARN] Server class 'com.ibm.icu.util.ULocale' could not be found in the web app, but was found on the system classpath
[WARN] Adding classpath entry 'file:/C:/Users/eclipse-jee-juno-SR1-win32-x86_64/eclipse/plugins/com.google.gwt.eclipse.sdkbundle_2.5.0.v201212122042-rel-r42/gwt-2.5.0/gwt-dev.jar' to the web app classpath for this session
For additional info see: file:/C:/Users/eclipse-jee-juno-SR1-win32-x86_64/eclipse/plugins/com.google.gwt.eclipse.sdkbundle_2.5.0.v201212122042-rel-r42/gwt-2.5.0/doc/helpInfo/webAppClassPath.html
I am not sure what this warning's about? is it serious?
The code was running ok but why eclipse generated this warning?
This class (com.ibm.icu.util.ULocale) is a replacement for java.util.Locale, so it seems Hermes has a dependency on it.
Download the ICU4J jar from http://site.icu-project.org/download and add it to your project's build path.
Source: Matt Bertolini at https://github.com/mattbertolini/Hermes/issues/3
You need to add the ICU4j jar located at http://site.icu-project.org/
to your classpath. The reason you have the ICU classes inside the
gwt-dev.jar is because GWT includes them for its Java to JavaScript
compiler. This is regrettable since it often times falsely reports the
files on your classpath.

can't compile play showcase html

I installed playN however I get this error:
[INFO] --- gwt-maven-plugin:2.4.0:compile (default) # playn-showcase-html ---
[ERROR] Error: Could not find or load main class com.google.gwt.dev.Compiler
I checked the m2 repository, and the gwt jars for 2.4 2.5 gwt seem to be there.
If I try to use GWT 2.5 in the project then I get this
The GWT SDK 'C:\Users\user.m2\repository\com\google\gwt' on the project's build path is not valid (Version is not supported, must be 2.0.0 or later)
playn-showcase-html
Unknown Google Web Toolkit Problem
Does this make sense at all?
How to fix it?
Thanks
It seems that some gwt jars in the maven repository were corrupted. I deleted them, i run the playN sample again, the jars were downloaded correctly, and the whole think worked
C:\Users\user.m2 <-- this is very strange. it looks like somehow your maven repository path is munged up.
Check your environmental variables for MAVEN_REPOSITORY and see if its set to C:\Users\user. Also, find your maven installation directory, and look under the conf directory for a settings.xml, and see if you have <localRepository>${env.MAVEN_REPOSITORY}/.m2/repository</localRepository>.

"Package HttpClient does not exist" when compiling

I am attempting to compile EWSJavaAPI1.5 in Eclipse and in IntelliJ. I have had no luck. I keep getting a org.apache.commons.httpclient does not exist error. Its driving me nuts. I added the four required files:
commons-codec-1.4.jar
commons-httpcliient-3.1.jar
commons-logging-1.1.1.jar
jcifs-1.3.15.jar
The four jar files are being referenced, yet it does not find the httpclient when compiling. It may have to do with the class path but I am not sure if I am adding it to the class path correctly. What to do?
Check that the library classpath is set correctly and this library is added to the dependencies of your module. Another possible case could be corrupted jar file, try to download it again.

Only a type can be imported. org.apache.poi.hssf.usermodel.HSSFWorkbook resolves to a package

Trying to use Apache POI in a Eclipse JSP project. The POI jar is in the project's Java Resources Library list.
<%# page import="org.apache.poi.hssf.usermodel.HSSFSheet"%>
at run the following error occurs:
An error occurred at line: 7 in the
generated java file Only a type can be
imported.
org.apache.poi.hssf.usermodel.HSSFWorkbook
resolves to a package
Any ideas? Thanks
Don Lawton
The message indicates that the class could not be found on the classpath of your deployed application. Did you make sure that the POI jar is in your WEB-INF/lib folder?
Same happened to me, even when the needed jars were indeed in the WEB-INF folder.
I was using the provided server in SpringSource ToolSuite (STS). It took me several attempts to clean, republish, etc... before it finally worked.

NoClassDefFoundError in Eclipse when adding project in build path

I am receiving an NoClassDefFoundError in Eclipse when I try to run my project.
My Project looks like this:
JavaProject: BulkAdmin
- src
- com.mycompany.bulkadmin.SDK.util
- Login.java
Dynamic Web Project: JSPTesting
- src
- com.mycompany.bulkadmin.jspController
- Controller.java
- WebContent
- index.html
- execute.jsp
This is the control flow:
index.html loads
index.html has a form that redirects to execute.jsp
execute.jsp takes the info returned in the form and makes a static call to Login.java
execute.jsp prints the results of the call
Controller.java uses Login.java. I was receiving compilation errors. To resolve them I did this:
Right click on JSPTesting -> properties
Choose java build path on the left bar
Choose projects tab
Click add
Choose BulkAdmin (Project)
I am not sure why but now when I am getting a NoClassDefFoundError. I have done some googling. I think that this means that I have messed up my classpath somehow but I am not sure how to resolve this.
java.lang.NoClassDefFoundError: com/myCompany/bulkadmin/SDK/util/Login
at com.myCompany.bulkadmin.jspController.Controller.process(Controller.java:44)
at org.apache.jsp.execute_jsp._jspService(execute_jsp.java:63)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:321)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:257)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:873)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Thread.java:595)
Other information:
I am using tomcat (in Eclipse) as my server
The exception shows up in the browser and the eclipse console
execute.jsp is a JSP
It seems like there are many similar questions to this on SO. I have read about 15 of them and tried various things however I think that my question has a different solution. I can provide more information.
Rightclick your dynamic web project, go to Properties > Deployment Assembly and add the dependent projects there. This way they will end up as JAR in /WEB-INF/lib, exactly there where you want it to be.
In Eclipse versions older than 3.5 you need to go to Properties > Java EE Module Dependencies.
See also:
ClassNotFoundException when using User Libraries in Eclipse build path
Difference between Deployment Assembly and J2EE Module Dependencies in Eclipse
The NoClassDefFoundError indicates that a class that was available during compilation is no longer available at runtime. Your problem is that the com/myCompany/bulkadmin/cSDK/util/Login class is available in the compilation classpath (in Eclipse via the Project reference you added to the build path) but not in the runtime classpath (Tomcat, which has no idea how to find this class).
You need to add the BulkAdmin project to the web-app class path when deployed on Tomcat as well.
One way to do this would be to export the BulkAdmin project as a JAR and put it into the WEB-INF/lib directory of your JSPTesting project.