Showing posts with label eclipse. Show all posts
Showing posts with label eclipse. Show all posts

Wednesday, August 1, 2018

Eclipse: Native proxy setting goes missing, breaking network connectivity

Leave a Comment

For no discernible reason, the native proxy provider (see pic) of my Eclipse (Photon 4.8) sometimes goes missing. This results in Eclipse no longer having internet access. I have not found a way to add this provider again except restarting Eclipse.

enter image description here

My main two questions are: Can I add this provider again once it goes missing? What could be the reason why it vanishes in the first place?

2 Answers

Answers 1

At the bottom of the Network Connections dialog, you should see a Restore Defaults button. For most cases, that should suffice.

enter image description here

Answers 2

This problem occurs when using some photon versions. I had the same problem, but I downgrade version and everything was fine. There is a reporting bug in Click bugzilla.

If this problem persists, report your case. Nothing can be done to fix the problem at runtime.

Read More

Sunday, June 10, 2018

Clean the workspace .metadata folder on product startup

Leave a Comment

I develop an Eclipse plugin which extends to Eclipse UI, and we deliver it as a whole Eclipse product. The plugin has as a target some automotive projects.

The version of the product can be configured from the project and executing a batch file will launch the proper version of the product.

So the final command will be something like this:

start /B %PRODUCT_PATH%/eclipse.exe -clean -configuration %PATH_TO_PROJECT_CONFIG% -data %PROJECT_PATH 

The problem comes when switching from one product version to another, the .metadata folder is corrupted or the information from it is not compatible between products, I am not sure what happens exactly but I get sporadic exceptions at startup.

When I clean the .metadata and launch the product without an existing .metadata folder in the project location, everything runs normally.

Is there an command line option for Eclipse to clean the workspace .metadata before startup?

1 Answers

Answers 1

All (I think!) the Eclipse command line arguments can be found in the Runtime options section of the reference documentation.

I find nothing in that document about removing the .metadatadirectory.

I have also searched for usage of the words "clean", "clear" and "remove", and reference to osgi.instance.area (which and think is the OSGI term for the .metadata directory) and found nothing that seems relevant.

Suggestion 1: clearPersistedState

You could try -clearPersistedState option. Maybe that could help? (I don' really know the purpose of the option, I just found it in the documentation.)

Suggestion 2: Start script

Otherwise maybe you could have a start script which simply runs del to remove the directory.

Suggestion 3: Find the root cause

The best thing to do is of course to find the root cause of the startup problems and solve that. But maybe that is too time consuming or impossible in your case.

Read More

Tuesday, May 1, 2018

Eclipse GDB can't find source files

Leave a Comment

My workspaces are located in my home directory.

I am currently trying to debug python code which loads a shared C++ library, using Eclipse Oxygen and PyDev. I can debug the Python files just fine.

I run the program (pytest unit test if that matters) with a breakpoint somewhere in the test before the shared library is called (but after it is loaded) and then run a C/C++ Attach to Application debug and attach to the paused python thread. I then set a breakpoint in my C++ code and resume python, and get this from the GDB console output:

No source file named /home/myname/.../models/sourcefile.cpp

Doing an ls /home/myname/.../models clearly shows that that file exists.

I'm not sure if this matters but my library was compiled with CMake where the source and build directory are siblings. E.g. workspace is ~/dev and source is in ~/dev/sourceFolder and build files are in ~/dev/buildFolder

Update:

I was able to attach to the running Python debug thread manually in the console using gdb python <thread_number>. This works and finds my source files just fine, allowing me to debug manually in the console. It would still be much faster and less cumbersome if I were able to get it to work in Eclipse.

Things I've tried in the C++ debug config settings:

  • In preferences, changing C/C++ -> Debug -> Source Lookup to have absolute file path first, profile first, and relative file path first
  • In CppDebug settings debugger tab, manually added build and source directory to shared libraries
  • In CppDebug settings source tab, manually added source directory in source lookup path

None of these seemed to do much.

0 Answers

Read More

Monday, March 12, 2018

Setting a WorkbenchWindowControlContribution as a SelectionProvider

Leave a Comment

I added a control in the toolbar which extends WorkbenchWindowControlContribution and implements ISelectionProvider. This control contains a Combo and when I change the selection I want to notify another view. Because it's not a ViewPart I can't call getSite().setSelectionProvider directly. I tried to set it like this:

        PlatformUI.getWorkbench().getDisplay().asyncExec(() -> {         PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart().getSite().setSelectionProvider(MyControl.this);     }); 

If I add this to the protected Control createControl(Composite parent) method the getActivePart would always be null. I also tried registering it when the Combo's value changes for the first time, but that way my other View wasn't notified about the change event.

Here is the ISelectionProvider methods:

@Override public void addSelectionChangedListener(ISelectionChangedListener listener) {     listeners.add(listener); }  @Override public ISelection getSelection() {     return new StructuredSelection(comboBox.getText()); }  @Override public void removeSelectionChangedListener(ISelectionChangedListener listener) {     listeners.remove(listener); }  @Override public void setSelection(ISelection selection) {     for (ISelectionChangedListener listener : listeners) {         listener.selectionChanged(new SelectionChangedEvent(this, selection));     }  } 

The View that should be getting notified implements ISelectionListener. I register it in the public void createPartControl(Composite parent) with getSite().getPage().addSelectionListener(this);

And here is the override of the SelectionChanged too:

@Override public void selectionChanged(IWorkbenchPart part, ISelection selection) {     if (part instanceof MyControl) {         String selectedProtocol = ((StructuredSelection) selection).getFirstElement().toString();                } } 

Can it be done?
Thanks!

0 Answers

Read More

Thursday, December 21, 2017

Eclipse deletes files/folders from deploy path during build

Leave a Comment

I have two maven projects in eclipse webapp and serviceImpl. webapp references serviceImpl.

When serviceImpl project is closed in eclipse and I build and run the webapp on Tomcat, the application works fine. But when I run webapp while serviceImpl is open, I get the error, that HTTP Status 500 - Configuration problem: Failed to import bean definitions from URL location [classpath:META-INF/serviceimpl-context.xml]. If I look into the META-INF folder on the machine I see that eclipse has deleted the xml file.

When I build and run the application on the command line or in IntelliJ, the problem does not appear either.

In eclipse the Deployment Assembly settings of webapp contains the open serviceImpl project and sourcereferences to some serviceImpl-2.0.0-SNAPSHOT.jar.

Also Java Build Path --> Libraries --> Maven Dependencies has the serviceImpl node:

enter image description here

We are also using Spring Application Context.

EDIT:

When I do on the commandline:

mvn clean install -P build-modules-test -Dmaven.test.skip=true

then the xml file is created and the application works fine. But in eclipse "right-click project --> Maven --> Update project" deletes these files, but does not create them again...so the error occurs

1 Answers

Answers 1

As I commented, an "update project" is not the same as an mvn install: the files are created during the package stage, stage which is not called during an Eclipse update.

See "Developing with Eclipse and Maven / Running Maven Builds"

You can define a Launch Execution setting with all the parameters you need:

https://books.sonatype.com/m2eclipse-book/reference/figs/web/running_run-config.png

Then you are sure to execute the same stages as the one done in command line through mvn install.

Read More

Thursday, December 7, 2017

Eclipse Jar-in-Jar fails to find a joda.time class

Leave a Comment

Eclipse has 3 runnable JAR export methods. One of them does not work in my case. I want to stop using the export method that makes a library sub-folder and switch to a single JAR.

In all cases my invocation is in a script, with a few script variables such as $MEMORYOPTIONS

java $MEMORYOPTIONS -enableassertions -classpath VARIOUS-SHOWN-BELOW topLevelDomain.domain.packageName.className $1 $2 $3

Firstly...

I have success with the following export method and the class path as shown.

export > runnable jar > extract required libraries

-classpath /home/user/workspace/project/project1.jar

I have a reason for not wanting to use this single JAR. (It is because unpackaged third party packages expose files with duplicate names so I get annoying warnings. Example: A file called License.txt is in several packages.)

Secondly...

As already mentioned I also have success with the following "library sub-folder" export method and class path as shown.

export > runnable jar > copy required libraries into a sub-folder

-classpath /home/user/workspace/project/project1.jar:/home/user/workspace/project/project1_lib/*

(Edit: As it turns out the JAR has a manifest that points to the project1_lib subfolder so the class path can be simplified to omit that. Just delete the part after the colon (:) separator from the class path.)

Thirdly...

I interpret "package required libraries" to mean a JAR-in-JAR export. Invoked with the class path shown, this export results in a failure to find the class.

export > runnable jar > package required libraries

-classpath /home/user/workspace/project/project1.jar

The error is:

Exception in thread "main" java.lang.NoClassDefFoundError: org/joda/time/ReadablePartial

How do I get this particular type of Eclipse export to work? I have already uninstalled Eclipse (Mars) and reinstalled. I have also removed the org.joda.time package and added it back. The problem persists.

3 Answers

Answers 1

Did you consider creating an uber jar ?

With maven you just need to add the following plugin definition and use the command mvn package

<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <version>2.4.2</version> <executions>     <execution>         <phase>package</phase>         <goals>             <goal>shade</goal>         </goals>         <configuration>              <filters>                 <filter>                     <artifact>joda-time:joda-time</artifact>                     <includes>                         <include>**</include>                     </includes>                 </filter>                 <filter>                     <artifact>*:*</artifact>                     <excludes>                         <exclude>META-INF/*.SF</exclude>                         <exclude>META-INF/*.DSA</exclude>                         <exclude>META-INF/*.RSA</exclude>                     </excludes>                 </filter>             </filters>         </configuration>     </execution> </executions> </plugin> 

Hope this helps.

Answers 2

You need to call the bundled JarRsrcLoader with your class as an argument:

java $MEMORYOPTIONS -enableassertions  -classpath /home/user/workspace/project/project1.jar  org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader topLevelDomain.domain.packageName.className 

However, this doesn't allow you to pass arguments ($1 $2 $3) to the called class.

Answers 3

You should launch your app using java's -jar option. Something like this:

java $MEMORYOPTIONS -enableassertions -jar /path/to/project1.jar $1 $2 $3 
Read More

Wednesday, September 27, 2017

How to allow / workaround nested composite Gradle builds

Leave a Comment

I'm running into the same issue as reported here:

I have a Java project A which depends on project B (module), and project B dependes on project C (another module). For project A I would like to setup "includeBuild ../projectB" and for project B I would like too setup "includeBuild ../projectC" so that I could develop everything in Eclipse + Buildship 2.0 without the need to run Gradle for every small change in each of the projecta A, B and C.

But if I setup this I get: "Included build '%s' cannot have included builds.".

Expected Behavior

Recursive "includeBuild" would recursively include dependent projects.

Current Behavior

I get "Included build '%s' cannot have included builds.".

Your Environment

Gradle 3.5, Buildship 2.0, Eclipse 3.6

How can I resolve / work around this issue? In my instance, I have utility project that includes email functionality (using JavaMail). The email functionality is needed in the data project and a UI project. The UI project also depends on the data project.

2 Answers

Answers 1

Have you considered

  1. Ensuring that none of the individual builds are composite builds
  2. Having an "uber" build which is a composite of everything

Note that the settings.gradle is itself a groovy script, so you could create a dynamic composite, eg all sub-folders with a build.gradle under a parent.

uber/settings.gradle

new File("c:/someFolder").listFiles().each { File f ->     if (f.directory && new File(f, 'build.gradle').exists()) {         includeBuild f     } } 

Eg

c:/someFolder/project1/build.gradle c:/someFolder/project1/src/main/java/**/*.java c:/someFolder/project2/build.gradle c:/someFolder/project2/src/main/java/**/*.java c:/uber/settings.gradle (as above) 

Answers 2

Adding another answer for a different approach...

Each settings.gradle could add a check to before includeBuild to see if it's already inside a composite. If it's already inside a composite, it doesn't includeBuild.

See here for extra info on the composite check

Eg

project2/settings.gradle

boolean inComposite = gradle.parent != null if (!inComposite) {     includeBuild '../project1' } 

project3/settings.gradle

boolean inComposite = gradle.parent != null if (!inComposite) {     includeBuild '../project1'     includeBuild '../project2' } 

project4/settings.gradle

boolean inComposite = gradle.parent != null if (!inComposite) {     includeBuild '../project1'     includeBuild '../project2'     includeBuild '../project3' } 

etc etc

Using this approach you could run gradle from wherever you like and it should behave as expected (ie substitute dependencies with local projects)

Read More

Wednesday, September 20, 2017

Setting up Java + svn + Eclipse+ Tomcat , development environment with docker

Leave a Comment

I just started to tryout docker to see if it helps setting up our development environment , which consists of

  1. Jdk 1.6
  2. Eclipse
  3. RabbitVCS
  4. Tomcat
  5. MySQL server

Our Development desktops are mostly Ubuntu 16.04 . I would have eclipse, RabbitVCS installed on host and the rest in container .

If every thing goes well , developers should be able to download a Docker image . Running that image should give them JDK , Tomcat and MySQL server . Developers can then start using RabbitVCS to check out projects .

Is this feasible with Docker ?

2 Answers

Answers 1

tl;dr

It is not feasible to run eclipse in host OS and use JDK/JRE runs in a container because eclipse has a dependency on JRE. Similarly you cannot have tomcat in one container and JRE/JDK in another container because tomcat needs JRE to run.

Explanation

I would have eclipse, RabbitVCS installed on host and the rest in container....... Running that image should give them JDK , Tomcat and MySQL server

Are you trying to use JDK running on a docker container (and Eclipse IDE running on host os) for active development? If that is the case, it not not feasible (arguable, you can do remote debugging; but remember, debugging is very different than active development) . And it is not the intend of docker. While developing, your developers may need to have JDK installed in their host machine itself. In your case, only sensible thing to run from container is mysql as you don't have any active development there.

Edit: To build a portable development environment

In docker-land, one possible solution is, have eclipse+jdk+tomcat in the same docker image and mount the X11 socket into the container so that you can expose eclipse GUI running in the container to your host OS

More read here: https://blog.jessfraz.com/post/docker-containers-on-the-desktop/

Or just ditch Docker and go to full-blown VM like virtualbox, you might be able to find pre-built images with eclipse in it (not sure), or you can build one after installing all the required packages on a base image and share it amongst your developers.

Answers 2

Yes it's feasible.

I would recommend to use different containers for each service (Mysql/Tomcat/JDK). You could use docker-compose to connect the containers together and automate a lot of tasks. There are plenty of images already on dockerhub that you can use.

Here's an simple example of how you can setup your own docker-compose.yml file:

services:     tomcat_service:     #contains tomcat & jdk         image: tomcat         volumes:             - /local/path:/path/in/docker         links:             - mysql_service         depends_on:             - mysql_service         ports:             - "80:80"           # - other ports for debugging      mysql_service:         image: mysql         volumes:             #you should keep mysql data on the host, not in container             - /local/path/data:/var/lib/mysql 

Each image used above will be downloaded automatically from dockerhub: tomcat, java, mysql

EDIT: jdk and tomcat would be better together in the same container

Read More

Thursday, September 7, 2017

Upgrading from Tomcat 6.0 to Tomcat 9.0 Undefined error using eclipse

Leave a Comment

I have a project that is been published in Tomcat6 and the code is written eclipse I need to update the program and make some changes so while at it i decided to upgrade tomcat server too !!! without any changes i deployed the war file in to the tomcat9 which gave me many errors !!! after fixing most of them i am stuck at one error which i cant solve !!! when i run the project from eclipse adn debug from chrome i got the fallowing error message

engine.js:1310 console.trace dwr.engine._debug @ engine.js:1310 dwr.engine.defaultErrorHandler @ engine.js:164 dwr.engine._remoteHandleException @ engine.js:931 (anonymous) @ VM54506:4 dwr.engine._eval @ engine.js:980 dwr.engine._stateChange @ engine.js:869 batch.req.onreadystatechange @ engine.js:646 XMLHttpRequest.send (async) dwr.engine._sendData @ engine.js:678 dwr.engine.endBatch @ engine.js:212 dwr.engine._execute @ engine.js:403  engine.js:1311 Error: undefined, Error 

the facet core is (if i change them to 1.8 and 3.1 still gives the same error and also it does not work with tomcat6 anymore) :

<?xml version="1.0" encoding="UTF-8"?> <faceted-project>   <fixed facet="wst.jsdt.web"/>   <fixed facet="java"/>   <fixed facet="jst.web"/>   <installed facet="java" version="1.5"/>   <installed facet="jst.web" version="2.4"/>   <installed facet="wst.jsdt.web" version="1.0"/> </faceted-project> 

the problem is that the code actually works and finishes the job but the interface hangs on loading !!! and it only says error nothing else !!! enter image description here

the information might not be enough for an answer but i cant share the thousends code here either any ideas about this problem ???

I am almost giving up on tomcat9 - just tried the same war file on wildfly 10 and everything works fine

1 Answers

Answers 1

Looks like you use DWR framework with version 2.x.

When you migrate from tomcat6 to tomcat9, tomcat7 and later uses HttpOnly true for cookies.

There are two solutions to resolve this error as mentioned below:

In tomcat9, make the HttpOnly flag false in conf/context.xml.

<Context useHttpOnly=”false”> 

OR

Upgrade the DWR version to 3.x

I will recommend the later due to the security reason

Read More

Tuesday, August 8, 2017

Eclipse static web project HTTP Preview/Server module conflicts with relative paths

Leave a Comment

So I start a static web project on eclipse. Let's say MySite. And then I start a jetty web server on eclipse and open localhost:8080 on my browser.

This is what I'll see:

Main HTTP Preview Page

So I go to localhost:8080/MySite/index.html and see my homepage.

Home Page

As you can see the the link is not leading where it should be. It should be going to localhost:8080/MySite/index.html, or even more preferable, MySite's index page should be hosted on localhost:8080/index.html and not on some module.

index.html

<!DOCTYPE html> <html lang="en">     <body>         <a href="/index.html">Home</a>     </body> </html> 

If I were to change this to MySite/index.html it defeats the purpose of it being an http preview server, because MySite will eventually be it's own site and not some kind of module.

How to fix this without using a workaround?

2 Answers

Answers 1

As you can see the the link is not leading where it should be. It should be going to localhost:8080/MySite/index.html, but instead it goes to localhost:8080/index.html

That is because you are using a url form that is relative to server's root /.

Simply use a ./(page-relative path) instead of /(server-root-relative path) in MySite/index.html.

<!DOCTYPE html> <html lang="en"> <body>     <a href="./index.html">Home</a> </body> </html> 

Hope it helps!

Answers 2

Hi there i have worked with tomcat Server with Eclipse , hope this will help .

Have you mentioned your landing page in WEB.xml file . if you have not added your landing page in you web.xml file like the below than add this and try.

<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">   <display-name>Your Website</display-name>   <welcome-file-list>     <welcome-file>index.html</welcome-file>   </welcome-file-list> </web-app> 
Read More

Sunday, July 9, 2017

Spring Tool Suites freezes in backend with Win10, with Win7 it worked fine

Leave a Comment

I have this adjustments for my STS in STS.ini:

-startup plugins/org.eclipse.equinox.launcher_1.3.201.v20161025-1711.jar --launcher.library plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.401.v20161122- 1740 -product org.springsource.sts.ide --launcher.defaultAction openFile -vmargs -Dosgi.requiredJavaVersion=1.8 -Xms512m -Dosgi.module.lock.timeout=10 -Xverify:none -Dorg.eclipse.swt.browser.IEVersion=10001 -Xmx2048m -XX:PermSize=256m -XX:MaxPermSize=1024m -javaagent:lombok.jar 

and it takes a few seconds sometimes especially while debugging. Actually I don't know what to do. Maybe someone has any hint improving this.

Version

Plugins

0 Answers

Read More

Saturday, May 27, 2017

GWT Project compile not working - No errors ,perfectly running on SUPERDEV mode

Leave a Comment

We have a GWT project using eclipse IDE and we run the project on superdev mode. Till yesterday everything was working fine,but from no where our project stopped compiling there are no errors occurring in the project. There are some warning showed in the console while compilation of the project.

Now, Problem is project is perfectly running on super dev mode every functionality added is working fine no errors no problems.

Its like if we have some error we can just sort them but with no error unable to find the problem. Tried to study & search but couldn't find anything helpful that landed me on SO.

USING:-

GWT-2.8.0

GWT Material

eclipse luna

 Compiling module com.edubot.Edubot    Computing all possible rebind results for 'com.edubot.client.enggheads.web.homepage.HomePageBase.HomePageBaseUiBinder'       Rebinding com.edubot.client.enggheads.web.homepage.HomePageBase.HomePageBaseUiBinder          Invoking generator com.google.gwt.uibinder.rebind.UiBinderGenerator             The following problems were detected                [WARN] Line 29 column 25: encountered ":". Was expecting one of: "}" "+" "-" "," ";" "/" <STRING> <IDENT> <NUMBER> <URL> <PERCENTAGE> <PT> <MM> <CM> <PC> <IN> <PX> <EMS> <EXS> <DEG> <RAD> <GRAD> <MS> <SECOND> <HZ> <KHZ> <DIMEN> <HASH> <IMPORTANT_SYM> <UNICODERANGE> <FUNCTION>     Computing all possible rebind results for 'com.edubot.client.enggheads.web.homepage.HomePageBase_HomePageBaseUiBinderImpl_GenBundle'       Rebinding com.edubot.client.enggheads.web.homepage.HomePageBase_HomePageBaseUiBinderImpl_GenBundle          Invoking generator com.google.gwt.resources.rebind.context.InlineClientBundleGenerator             Preparing method style                The following problems were detected                   [WARN] Line 29 column 25: encountered ":". Was expecting one of: "}" "+" "-" "," ";" "/" <STRING> <IDENT> <NUMBER> <URL> <PERCENTAGE> <PT> <MM> <CM> <PC> <IN> <PX> <EMS> <EXS> <DEG> <RAD> <GRAD> <MS> <SECOND> <HZ> <KHZ> <DIMEN> <HASH> <IMPORTANT_SYM> <UNICODERANGE> <FUNCTION>        Rebinding com.edubot.client.enggheads.web.homepage.HomePageBase_HomePageBaseUiBinderImpl_GenBundle          Invoking generator com.google.gwt.resources.rebind.context.InlineClientBundleGenerator             Preparing method style                The following problems were detected                   [WARN] Line 29 column 25: encountered ":". Was expecting one of: "}" "+" "-" "," ";" "/" <STRING> <IDENT> <NUMBER> <URL> <PERCENTAGE> <PT> <MM> <CM> <PC> <IN> <PX> <EMS> <EXS> <DEG> <RAD> <GRAD> <MS> <SECOND> <HZ> <KHZ> <DIMEN> <HASH> <IMPORTANT_SYM> <UNICODERANGE> <FUNCTION>        Rebinding com.edubot.client.enggheads.web.homepage.HomePageBase_HomePageBaseUiBinderImpl_GenBundle          Invoking generator com.google.gwt.resources.rebind.context.InlineClientBundleGenerator             Preparing method style                The following problems were detected                   [WARN] Line 29 column 25: encountered ":". Was expecting one of: "}" "+" "-" "," ";" "/" <STRING> <IDENT> <NUMBER> <URL> <PERCENTAGE> <PT> <MM> <CM> <PC> <IN> <PX> <EMS> <EXS> <DEG> <RAD> <GRAD> <MS> <SECOND> <HZ> <KHZ> <DIMEN> <HASH> <IMPORTANT_SYM> <UNICODERANGE> <FUNCTION>     Computing all possible rebind results for 'com.edubot.client.post.web.EmptyPost.EmptyClassesUiBinder'       Rebinding com.edubot.client.post.web.EmptyPost.EmptyClassesUiBinder          Invoking generator com.google.gwt.uibinder.rebind.UiBinderGenerator             The following problems were detected                [WARN] Line 10 column 32: encountered "!". Was expecting one of: "}" "+" "-" "," ";" "/" <STRING> <IDENT> <NUMBER> <URL> <PERCENTAGE> <PT> <MM> <CM> <PC> <IN> <PX> <EMS> <EXS> <DEG> <RAD> <GRAD> <MS> <SECOND> <HZ> <KHZ> <DIMEN> <HASH> <IMPORTANT_SYM> <UNICODERANGE> <FUNCTION>     Computing all possible rebind results for 'com.edubot.client.post.web.EmptyPost_EmptyClassesUiBinderImpl_GenBundle'       Rebinding com.edubot.client.post.web.EmptyPost_EmptyClassesUiBinderImpl_GenBundle          Invoking generator com.google.gwt.resources.rebind.context.InlineClientBundleGenerator             Preparing method style                The following problems were detected                   [WARN] Line 10 column 32: encountered "!". Was expecting one of: "}" "+" "-" "," ";" "/" <STRING> <IDENT> <NUMBER> <URL> <PERCENTAGE> <PT> <MM> <CM> <PC> <IN> <PX> <EMS> <EXS> <DEG> <RAD> <GRAD> <MS> <SECOND> <HZ> <KHZ> <DIMEN> <HASH> <IMPORTANT_SYM> <UNICODERANGE> <FUNCTION>        Rebinding com.edubot.client.post.web.EmptyPost_EmptyClassesUiBinderImpl_GenBundle          Invoking generator com.google.gwt.resources.rebind.context.InlineClientBundleGenerator             Preparing method style                The following problems were detected                   [WARN] Line 10 column 32: encountered "!". Was expecting one of: "}" "+" "-" "," ";" "/" <STRING> <IDENT> <NUMBER> <URL> <PERCENTAGE> <PT> <MM> <CM> <PC> <IN> <PX> <EMS> <EXS> <DEG> <RAD> <GRAD> <MS> <SECOND> <HZ> <KHZ> <DIMEN> <HASH> <IMPORTANT_SYM> <UNICODERANGE> <FUNCTION>        Rebinding com.edubot.client.post.web.EmptyPost_EmptyClassesUiBinderImpl_GenBundle          Invoking generator com.google.gwt.resources.rebind.context.InlineClientBundleGenerator             Preparing method style                The following problems were detected                   [WARN] Line 10 column 32: encountered "!". Was expecting one of: "}" "+" "-" "," ";" "/" <STRING> <IDENT> <NUMBER> <URL> <PERCENTAGE> <PT> <MM> <CM> <PC> <IN> <PX> <EMS> <EXS> <DEG> <RAD> <GRAD> <MS> <SECOND> <HZ> <KHZ> <DIMEN> <HASH> <IMPORTANT_SYM> <UNICODERANGE> <FUNCTION>     Compiling 2 permutations       Compiling permutation 0... 

This the point it just stops working and the problem start.

Until the project gets compiled we can't create its war file and unable to host the project globally on tomcat.

1 Answers

Answers 1

My problem has been resolved there was a function in my project which was been called infinite times due to some mistake. Finally after reading the classes and debugging the code we found the problem.

Read More

Friday, May 12, 2017

Cocos2d-x installed application can't be launched on android

Leave a Comment

I am developing game using cocos2d-x I am succesfully playing it on iOS, MacOS and win32 but at the moment I am having issue trying to launch it on android. Compilation and installation are completed I just can't launch it because of the problem I can't understand/see. Could someone help or hint me about the problem?

Info: testing on real device, Android version 4.4.4., cocos2d-x-3.13.1, c++, target 4.4.2, eclipse Neon.1a Release (4.6.1), mac os.

If additional information is required I can provide it.

AndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android"   package="com.companyName.gameName"   android:versionCode="1"   android:versionName="1.0"   android:installLocation="auto">  <uses-sdk android:minSdkVersion="19"/> <uses-feature android:glEsVersion="0x00020000" />  <application android:label="@string/app_name"              android:icon="@drawable/icon">      <!-- Tell Cocos2dxActivity the name of our .so -->     <meta-data android:name="android.app.lib_name"                android:value="MyGame" />      <activity android:name="org.cocos2dx.cpp.AppActivity"               android:label="@string/app_name"               android:screenOrientation="landscape"               android:theme="@android:style/Theme.NoTitleBar.Fullscreen"               android:configChanges="orientation|keyboardHidden|screenSize">          <intent-filter>             <action android:name="android.intent.action.MAIN" />             <category android:name="android.intent.category.LAUNCHER" />         </intent-filter>     </activity> </application>  <supports-screens android:anyDensity="true"                   android:smallScreens="true"                   android:normalScreens="true"                   android:largeScreens="true"                   android:xlargeScreens="true"/>  <uses-permission android:name="android.permission.INTERNET"/> <permission android:name="android.permission.INTERACT_ACROSS_USERS_FULL" android:protectionLevel="signature"/> 

LogCat (warn, error, assert):

04-21 09:49:49.917: E/Watchdog(596): !@Sync 1245 04-21 09:49:52.780: W/AlarmManager(596): Set alarm: type= 3 triggerAtTime= 143810266 , called by : com.google.android.gms, intent:Intent { cmp=com.google.android.gms/.lockbox.LockboxAlarmReceiver } 04-21 09:49:59.997: W/AlarmManager(596): Set alarm: type= 3 triggerAtTime= 143817481 , called by : android, intent:Intent { act=android.intent.action.TIME_TICK flg=0x50000000 } 04-21 09:50:00.157: W/ResourceType(2304): Failure getting entry for 0x010400da (t=3 e=218) in package 0 (error -75) 04-21 09:50:00.157: E/accuweather(2304): [AccuTab_Magagine]>>> UIMK:1463 [0:0] time : 08:50 04-21 09:50:00.177: W/ResourceType(2304): Failure getting entry for 0x010400da (t=3 e=218) in package 0 (error -75) 04-21 09:50:19.917: E/Watchdog(596): !@Sync 1246 04-21 09:50:36.803: W/ContextImpl(25935): Calling a method in the system process without a qualified user: android.app.ContextImpl.startActivity:1255 android.content.ContextWrapper.startActivity:330 android.content.ContextWrapper.startActivity:330 com.samsung.android.MtpApplication.MtpReceiver$3.handleMessage:786 android.os.Handler.dispatchMessage:102  04-21 09:50:36.813: W/ContextImpl(25935): Calling a method in the system process without a qualified user: android.app.ContextImpl.startActivity:1267 android.app.ContextImpl.startActivity:1256 android.content.ContextWrapper.startActivity:330 android.content.ContextWrapper.startActivity:330 com.samsung.android.MtpApplication.MtpReceiver$3.handleMessage:786  04-21 09:50:37.033: W/ActivityManager(596): mDVFSHelper.acquire() 04-21 09:50:37.043: E/MTPRx(25935): started activity for popup 04-21 09:50:37.154: W/ApplicationPackageManager(25935): getCSCPackageItemText() 04-21 09:50:37.204: E/SettingsReceiverActivity(25935): PREF_DONT_ASK_AGAIN : true 04-21 09:50:37.214: W/InputMethodManagerService(596): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@42ef9528 attribute=null, token = android.os.BinderProxy@42a655d8 04-21 09:50:38.084: W/ApplicationPackageManager(596): getCSCPackageItemText() 04-21 09:50:40.036: W/ActivityManager(596): mDVFSHelper.release() 04-21 09:50:49.916: E/Watchdog(596): !@Sync 1247 04-21 09:50:52.789: W/AlarmManager(596): Set alarm: type= 3 triggerAtTime= 144530276 , called by : android, intent:Intent { act=android.net.ConnectivityService.action.PKT_CNT_SAMPLE_INTERVAL_ELAPSED flg=0x4000000 } 04-21 09:50:52.849: W/AlarmManager(596): Set alarm: type= 3 triggerAtTime= 143870336 , called by : com.google.android.gms, intent:Intent { cmp=com.google.android.gms/.lockbox.LockboxAlarmReceiver } 04-21 09:50:59.996: W/AlarmManager(596): Set alarm: type= 3 triggerAtTime= 143877482 , called by : android, intent:Intent { act=android.intent.action.TIME_TICK flg=0x50000000 } 04-21 09:51:00.076: W/ResourceType(2304): Failure getting entry for 0x010400da (t=3 e=218) in package 0 (error -75) 04-21 09:51:00.076: E/accuweather(2304): [AccuTab_Magagine]>>> UIMK:1463 [0:0] time : 08:51 04-21 09:51:00.096: W/ResourceType(2304): Failure getting entry for 0x010400da (t=3 e=218) in package 0 (error -75) 04-21 09:51:03.719: E/memtrack(26128): Couldn't load memtrack module (No such file or directory) 04-21 09:51:03.719: E/android.os.Debug(26128): failed to load memtrack module: -2 04-21 09:51:03.900: W/ActivityManager(596): No content provider found for permission revoke: file:///data/local/tmp/MyGame.apk 04-21 09:51:19.915: E/Watchdog(596): !@Sync 1248 04-21 09:51:30.275: W/ApplicationPackageManager(25304): getCSCPackageItemText() 04-21 09:51:42.527: W/ActivityManager(596): No content provider found for permission revoke: file:///data/local/tmp/MyGame.apk 04-21 09:51:43.588: E/PackageManager(596): parse pkg : /data/app/vmdl276537072.tmp 04-21 09:51:43.618: E/PackageManager(596): dexopt start 04-21 09:51:44.980: E/PackageManager(596): dexopt end 04-21 09:51:49.915: E/Watchdog(596): !@Sync 1249 04-21 09:51:53.068: W/AlarmManager(596): Set alarm: type= 3 triggerAtTime= 143930557 , called by : com.google.android.gms, intent:Intent { cmp=com.google.android.gms/.lockbox.LockboxAlarmReceiver } 04-21 09:51:56.111: W/PackageManager(596): verifying app can be installed or not 04-21 09:51:56.331: W/PackageManager(596): Not granting permission android.permission.INSTALL_LOCATION_PROVIDER to package com.companyName.GameName (protectionLevel=18 flags=0x8be46) 04-21 09:51:56.511: W/ApplicationPackageManager(596): getCSCPackageItemText() 04-21 09:51:56.561: W/ApplicationPackageManager(596): getCSCPackageItemText() 04-21 09:51:56.771: W/ApplicationPackageManager(596): getCSCPackageItemText() 04-21 09:51:56.781: W/ApplicationPackageManager(930): getCSCPackageItemText() 04-21 09:51:56.781: W/ApplicationPackageManager(930): getCSCPackageItemText() 04-21 09:51:56.781: E/SamsungIME(1471): mOCRHelper is null 04-21 09:51:56.941: W/ApplicationPackageManager(951): getCSCPackageItemText() 04-21 09:51:58.343: W/ApplicationPackageManager(1195): getCSCPackageItemText() 04-21 09:51:58.453: E/EdmStorageProvider(596): Admin not in database, something went wrong 04-21 09:51:59.103: W/AlarmManager(596): Set alarm: type= 0 triggerAtTime= 1492761134119 , called by : com.android.vending, intent:Intent { cmp=com.android.vending/com.google.android.finsky.services.ContentSyncService } 04-21 09:51:59.344: W/IcingInternalCorpora(1352): getNumBytesRead when not calculated. 04-21 09:51:59.354: E/memtrack(26153): Couldn't load memtrack module (No such file or directory) 04-21 09:51:59.354: E/android.os.Debug(26153): failed to load memtrack module: -2 04-21 09:51:59.504: E/Finsky(25304): [1] com.google.android.finsky.wear.bl.a(847): onConnectionFailed: ConnectionResult{statusCode=API_UNAVAILABLE, resolution=null, message=null} 04-21 09:51:59.814: W/ActivityManager(596): mDVFSHelper.acquire() 04-21 09:51:59.994: W/AlarmManager(596): Set alarm: type= 3 triggerAtTime= 143937482 , called by : android, intent:Intent { act=android.intent.action.TIME_TICK flg=0x50000000 } 04-21 09:52:00.215: W/ActivityManager(596): Permission Denial: getCurrentUser() from pid=26179, uid=10129 requires android.permission.INTERACT_ACROSS_USERS 04-21 09:52:00.245: W/ApplicationPackageManager(26179): getCSCPackageItemText() 04-21 09:52:00.275: W/ActivityManager(596): Permission Denial: getCurrentUser() from pid=26179, uid=10129 requires android.permission.INTERACT_ACROSS_USERS 04-21 09:52:00.615: E/JniHelper(26179): Failed to find static java method. Class name: (null), method name: getCocos2dxPackageName, signature: ()Ljava/lang/String;  04-21 09:52:00.615: W/ResourceType(2304): Failure getting entry for 0x010400da (t=3 e=218) in package 0 (error -75) 04-21 09:52:00.625: A/libc(26179): Fatal signal 11 (SIGSEGV) at 0xfffffff4 (code=1), thread 26179 (peFromTheIsland) 04-21 09:52:00.635: E/accuweather(2304): [AccuTab_Magagine]>>> UIMK:1463 [0:0] time : 08:52 04-21 09:52:00.645: W/ResourceType(2304): Failure getting entry for 0x010400da (t=3 e=218) in package 0 (error -75) 04-21 09:52:00.865: W/SQLiteConnectionPool(1352): A SQLiteConnection object for database '+data+data+com_google_android_gms+databases+metrics_db' was leaked!  Please fix your application to end transactions in progress properly and to close the database when it is no longer needed. 04-21 09:52:00.875: W/SQLiteConnectionPool(1352): A SQLiteConnection object for database '+data+data+com_google_android_gms+databases+help_responses_db_18' was leaked!  Please fix your application to end transactions in progress properly and to close the database when it is no longer needed. 04-21 09:52:00.875: W/SQLiteConnectionPool(1352): A SQLiteConnection object for database '+data+data+com_google_android_gms+databases+auto_complete_suggestions_db' was leaked!  Please fix your application to end transactions in progress properly and to close the database when it is no longer needed. 04-21 09:52:00.875: W/ApplicationPackageManager(1352): getCSCPackageItemText() 04-21 09:52:01.165: W/ActivityManager(596):   Force finishing activity com.companyName.GameName/org.cocos2dx.cpp.AppActivity 04-21 09:52:01.206: W/ApplicationPackageManager(596): getCSCPackageItemText() 04-21 09:52:01.216: W/ApplicationPackageManager(596): getCSCPackageItemText() 04-21 09:52:01.516: E/android.os.Debug(596): !@Dumpstate > dumpstate -k -t -z -d -m 26179 -o /data/log/dumpstate_app_error 04-21 09:52:01.596: W/ContextImpl(596): Calling a method in the system process without a qualified user: android.app.ContextImpl.sendBroadcast:1372 com.android.server.analytics.data.collection.application.CrashAnrDetector.broadcastEvent:296 com.android.server.analytics.data.collection.application.CrashAnrDetector.processDropBoxEntry:254 com.android.server.analytics.data.collection.application.CrashAnrDetector.access$100:60 com.android.server.analytics.data.collection.application.CrashAnrDetector$1.onReceive:102  04-21 09:52:01.716: W/ActivityManager(596): Activity pause timeout for ActivityRecord{425a2d00 u0 com.companyName.GameName/org.cocos2dx.cpp.AppActivity t89 f} 04-21 09:52:01.906: W/ActivityManager(596): mDVFSHelper.release() 04-21 09:52:02.577: W/ApplicationPackageManager(596): getCSCPackageItemText() 

LogCat (Filtered for application (Full)):

04-21 09:52:00.185: D/ActivityThread(26179): handleBindApplication:com.companyName.gameName 04-21 09:52:00.245: W/ApplicationPackageManager(26179): getCSCPackageItemText() 04-21 09:52:00.265: D/DisplayManager(26179): DisplayManager() 04-21 09:52:00.305: D/dalvikvm(26179): Trying to load lib /data/app-lib/com.companyName.gameName-1/libMyGame.so 0x41ccab70 04-21 09:52:00.615: E/JniHelper(26179): Failed to find static java method. Class name: (null), method name: getCocos2dxPackageName, signature: ()Ljava/lang/String;  04-21 09:52:00.625: A/libc(26179): Fatal signal 11 (SIGSEGV) at 0xfffffff4 (code=1), thread 26179 (peFromTheIsland) 

2 Answers

Answers 1

<uses-permission android:name="android.permission.INSTALL_LOCATION_PROVIDER"/> 

remove this permission from Manifest file. you can only use normal and Dangerous permission.

A third-party developer cannot grant to his/her application the permission required to install a new location provider (android.permission.INSTALL_LOCATION_PROVIDER). Only OEMs are allowed to install a new location provider.

EDIT

<permission android:name="android.permission.INTERACT_ACROSS_USERS_FULL" android:protectionLevel="signature"/> 

EDIT

check package name I see com.companyName.gameName in AndroidManifest.xml, you are running your app using package com.companyName.GameName and AppActivity is in org.cocos2dx.cpp

Answers 2

This issue was caused by extern Userdefaults in Constants. To fix it I changed (Constants.cpp):

cocos2d::UserDefault *userDefaults = cocos2d::UserDefault::getInstance(); 

Constants.hpp:

extern cocos2d::UserDefault *userDefaults; 

To:

Constants.cpp

cocos2d::UserDefault *userDefaults; 

And (AppDelegate.cpp)

userDefaults = cocos2d::UserDefault::getInstance(); 

Have not done any changes to Constants.hpp. Permissions is not required and also were was no problem with package name.

Logcat messages was not helpfull...

Read More

Friday, April 28, 2017

Eclipse - break on user code when unhandled exception is raised on Android App

Leave a Comment

My problem is simple :

  • I use Ecplise (Luna or Neon) to develop on Android and I don't want to use Android Studio

  • I wish to debug breaks on ALL unhandled exceptions only on the last user code call of the stack that cause the exception (So, for example, I don't want to break in an unuseful ZygonteInit&MethodAndArgsCaller.run() when an exception in caused by passing a null reference to a native Android SDK method).

I know that I can set a break point for a particular exception in the breakpoint view (NullPointerException..Throwable...) but I want to break on ALL unhandled. I know that I can filter debug by setting "step filters" in Java debug option, but in my case this doesn't work for all exception.

EDIT

In the image below my stack in debug View when an exception is raised (a division by zero in my code)

enter image description here

And the stack of the main thread if I set a default Uncaught Exception Handler after exception is raised.

enter image description here

2 Answers

Answers 1

You can first verify if this setting in Eclipse is enabled.

Window -> Preferences -> Java -> Debug -> Suspend execution on uncaught exceptions

If this setting is enabled, any uncaught exception will suspend the JVM exactly at the point its thrown, including classes invoked using reflection. This is without adding any breakpoint, but provided its unhandled, i.e. your code is not even invoked by an external code from a try-catch.

For e.g.

int a = 0, b= 0; System.out.println(a/b); // ArithmeticException 

Even if this code is called from a reflection invoked code, eclipse will suspend at sysout with all variables still available on the stack.

However in Android's startup class ZygoteInit there is this line :

    catch (Throwable t) {                 Log.e(TAG, "Error preloading " + line + ".", t);                 if (t instanceof Error) {                     throw (Error) t;                 }                 if (t instanceof RuntimeException) {                     throw (RuntimeException) t;                 }                 throw new RuntimeException(t);             } 

The reason why such code would break Eclipse debugging is, the RuntimeException is now no more unhandled. Your UncaughtExceptionHandler may actually be catching the startup class instead of your user code. This is for regular Eclipse.

Solution 1 :

  1. Goto Run -> Add Java Exception Breakpoint -> Throwable
  2. Click on Throwable in the Breakpoint view
  3. Right click -> Breakpoint properties -> Add package -> OK
  4. Check on the option Subclasses of this exception

enter image description here

Note : This can marginally catch a java.lang.OutOfMemoryError but definitely cannot catch a java.lang.StackOverflowError.

Solution 2 : (Only if too many caught exceptions, NOT recommended otherwise)

  1. Copy the source code of com.android.internal.os.ZygoteInit to a new project say MyBootstrap
  2. Modify the catch (Throwable t) block to catch only Error

        } catch (Error t) {         Log.e(TAG, "Error preloading " + line + ".", t);         throw t;     } 
  3. Go-to debug configurations -> Classpath -> Click Bootstrap Entries -> Add projects -> MyBootstrap. Move this project to the top

enter image description here

Answers 2

Basically, if I understand you correctly, you want to set a breakpoint that will trigger at the point where an exception is thrown if that exception is not / would not be handled subsequently.

If that is what you mean, then what you are asking for is basically impossible.

  1. At the point the exception is thrown the debugger cannot tell if the exception is going to be caught.

  2. At the point where the exception is caught, the state (i.e. stack frames, variables, etc) from the throw point ... and up to the catch point ... will have been discarded.

  3. The Java debugger APIs don't support a "rewind and replay" mechanism that a debugger could use for this.


To my mind, the best you can do is to 1) identify the exception that you suspect is not being caught, 2) set a breakpoint on its constructor or on a suitable superclass constructor, 3) figure out some conditions to filter out the cases that are not interesting, and 4) step through the code to see if the exception is caught or not.

Note: an exception may be thrown or rethrown at a different point to where it was instantiated, so an exception constructor breakpoint won't always help. But it usually will.

Read More

Friday, April 7, 2017

Eclipse string literal line wrapping

Leave a Comment

When I run the Formatter it indents string literal lines all the way to the last line of the variable name, even if that exceeds the column guide, as shown in this screenshot:

Undesired line-wrapping behavior

Ideally, I want all of the lines to be wrapped similar to the way the first line is wrapped, with just a couple of tabs (or 1 tab if possible). I've changed all the Formatter settings for assignment and binary expression and it doesn't affect the Formatter's line wrapping behavior.

Is there a way to make Eclipse wrap lines like NetBeans or maybe with some plugin?

Here's what my Formatter settings are for Line Wrapping: enter image description here

1 Answers

Answers 1

If you're looking to install a plugin that has a better wrapping function for Eclipse, you can always try Eclipse Colorer because it has an "Enhanced and fixed word wrapping mode"

If you're looking to customize the way that Eclipse wraps lines, here's how and where you do it: Preferences->Java->Code Style->Formatter, then click the Edit button and select the Comments tab. After that, the same place, you can select the Line Wrapping tab and the Indentation tab. You can also set margins and tab sizes in Preferences>General>Editors>Text Editors by editing the Displayed Tab Width

EDIT : Because previous mentions didn't have the desire effect, I'll note that Eclipse should be Eclipse Project Neon (4.6) M4 or higher. Eclipse 4.6 came with some updated word wrapping out of the box. If you're still not satisfied you can try another plugin, and in my opinion, a better plugin, which might do the trick: Eclipse Word-Wrap

Read More

Monday, April 3, 2017

Spring JavaConfig and Tomcat 8

Leave a Comment

I have a Spring 4 web application (webapp-module.war) working and running locally in eclipse using Java 8, tomcat 8 and JavaConfig (no web.xml):

enter image description here

But when I deploy to tomcat 8 (same version I am using locally in eclipse) on a remote Ubuntu server I get:

enter image description here

I verified host and port which are correct. There is no error in the log (/var/lib/tomcat8/logs/catalina.out)

Jun 21, 2016 10:32:44 PM org.apache.catalina.startup.HostConfig undeploy INFO: Undeploying context [/webapp-module] Jun 21, 2016 10:32:44 PM org.apache.catalina.startup.HostConfig deployWAR INFO: Deploying web application archive /var/lib/tomcat8/webapps/webapp-module.war Jun 21, 2016 10:32:46 PM org.apache.jasper.servlet.TldScanner scanJars INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time. Jun 21, 2016 10:32:46 PM org.apache.catalina.startup.HostConfig deployWAR INFO: Deployment of web application archive /var/lib/tomcat8/webapps/webapp-module.war has finished in 1,870 ms root@vmi63860:/var/lib/tomcat8/logs#  

The access log contains:

root@vmi63860:/var/log/tomcat8# cat localhost_access_log.2016-06-22.txt  xx.xxx.xxx.xx - - [22/Jun/2016:22:36:00 +0200] "GET /webapp-module/ HTTP/1.1" 404 1040 xx.xxx.xxx.xx - - [22/Jun/2016:22:36:00 +0200] "GET /favicon.ico HTTP/1.1" 404 1034 xx.xxx.xxx.xx - - [22/Jun/2016:22:36:50 +0200] "GET /webapp-module/hello HTTP/1.1" 404 1050 

Where xx.xxx.xxx.xx is the IP of my local machine from where I try to access the web app in my browser.

I took a look at: Spring Java Config: Tomcat deploy without web.xml but it does not really provide a solution.

Details on my project below:

Sources

enter image description here

Config.java

@Configuration // Marks this class as configuration // Specifies which package to scan @ComponentScan("com.samples") // Enables Spring's annotations @EnableWebMvc public class Config {    @Bean   public UrlBasedViewResolver setupViewResolver() {     UrlBasedViewResolver resolver = new UrlBasedViewResolver();     resolver.setPrefix("/WEB-INF/jsp/");     resolver.setSuffix(".jsp");     resolver.setViewClass(JstlView.class);     return resolver;   }  } 

WebInitializer.java

public class WebInitializer implements WebApplicationInitializer {    @Override   public void onStartup(ServletContext servletContext) throws ServletException {      AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext();     ctx.register(Config.class);     ctx.setServletContext(servletContext);      Dynamic servlet = servletContext.addServlet("dispatcher", new DispatcherServlet(ctx));     servlet.addMapping("/");     servlet.setLoadOnStartup(1);    }  } 

HelloController.java

@Controller public class HelloController {    @RequestMapping("/")   public String home() {     return "index";   }    @RequestMapping("/hello")   public String showhello(ModelMap model) {     model.addAttribute("message", "Hello Spring MVC Framework!");     return "hello";   }  } 

3 Answers

Answers 1

Sorry previously I was too hasty

It seems that spring context is not at all loaded.

I guess the problem is in this piece of code:

public class WebInitializer implements WebApplicationInitializer {    @Override   public void onStartup(ServletContext servletContext) throws ServletException {      AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext();     ctx.register(Config.class);     ctx.setServletContext(servletContext);      Dynamic servlet = servletContext.addServlet("dispatcher", new DispatcherServlet(ctx));     servlet.addMapping("/");     servlet.setLoadOnStartup(1);    }  } 

You used ctx.register(Config.class);

In any case I always used this kind of initialization:

public class AppInitializer implements WebApplicationInitializer {      @Override     public void onStartup(ServletContext servletContext) throws ServletException {         // Create the 'root' Spring application context         AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext();         rootContext.scan("com.spring");         rootContext.setConfigLocations(new String[]{"com.spring.config.WebAppContextConfig", "com.spring.config.AppConfig"});         // Manages the lifecycle of the root application context         servletContext.addListener(new ContextLoaderListener(rootContext));          // Declare dispatcher servlet. Handles requests into the application         ServletRegistration.Dynamic dispatcher = servletContext.addServlet("dispatcher",                 new DispatcherServlet(rootContext));         dispatcher.setLoadOnStartup(1);         dispatcher.addMapping("/");      }  } 

As you can see I used rootContext.setConfigLocations in order to specify where to find the spring configuration classes

In any case Here you can find a working sample I successfully deployed it on tomcat 8.0.39 and 8.5.4

Hope it's useful

Angelo

Answers 2

Add finalName as ROOT in your pom.xml. This will create ROOT.war file in your target folder.

    <build>         <plugins> <!--All plugins are here -->         </plugins>         <finalName>ROOT</finalName>     </build> 

After that if you deploy ROOT.war file in your tomcat. Then your accessing url will be http://localhost:8080

Hope it will solve your issue.

For further checking, please go through http://localhost:8080/manager/html it will call for username and password. Check that is set or not.

If not set, please go through this tutorial: Can't access Tomcat 8 Manager App as suggested by E-Riz

For full example, go through this tutorial: http://websystique.com/springmvc/spring-4-mvc-helloworld-tutorial-annotation-javaconfig-full-example/

Answers 3

In case if all the controllers where initialised you will see the Mapped URL in tomcat server startup logs, can you check that?

INFO: Mapped "{[/rama],methods=[GET]}" onto public java.lang.String com.javacodegeeks.examples.controller.MainController.rama() INFO: Mapped URL path [/resources/static/js/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] INFO: Mapped URL path [/resources/static/css/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] INFO: Mapped URL path [/resources/static/views/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] INFO: Mapped URL path [/resources/static/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] INFO: Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] INFO: Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.DefaultServletHttpRequestHandler] 
Read More

Sunday, March 5, 2017

How to use Eclipse ICE Geometry Editor?

Leave a Comment

I am attempting to use the geometry editor from the ICE however, I am getting the following error, I have only installed the ICE and have no plugins or extensions so it is quite possible I am missing something however, I do not know what and where I can get it.

org.eclipse.core.runtime.CoreException: Plug-in org.eclipse.ice.client.widgets was unable to load class org.eclipse.ice.client.widgets.geometry.GeometryEditor. at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.throwException(RegistryStrategyOSGI.java:194) at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:176) at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:905) at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:243) at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:55) at org.eclipse.ui.internal.WorkbenchPlugin.createExtension(WorkbenchPlugin.java:282) at org.eclipse.ui.internal.registry.EditorDescriptor.createEditor(EditorDescriptor.java:235) at org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:329) at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.createPart(CompatibilityPart.java:278) at org.eclipse.ui.internal.e4.compatibility.CompatibilityEditor.createPart(CompatibilityEditor.java:63) at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.create(CompatibilityPart.java:316) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:55) at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:966) at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:931) at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:151) at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:375) at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:294) at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:162) at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.createFromBundle(ReflectionContributionFactory.java:105) at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.doCreate(ReflectionContributionFactory.java:74) at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.create(ReflectionContributionFactory.java:56) at org.eclipse.e4.ui.workbench.renderers.swt.ContributedPartRenderer.createWidget(ContributedPartRenderer.java:129) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createWidget(PartRenderingEngine.java:975) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:651) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:757) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access$0(PartRenderingEngine.java:728) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$2.run(PartRenderingEngine.java:722) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:706) at org.eclipse.e4.ui.internal.workbench.PartServiceImpl$1.handleEvent(PartServiceImpl.java:104) at org.eclipse.e4.ui.services.internal.events.UIEventHandler$1.run(UIEventHandler.java:40) at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:233) at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:145) at org.eclipse.swt.widgets.Display.syncExec(Display.java:4821) at org.eclipse.e4.ui.internal.workbench.swt.E4Application$1.syncExec(E4Application.java:211) at org.eclipse.e4.ui.services.internal.events.UIEventHandler.handleEvent(UIEventHandler.java:36) at org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:201) at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:197) at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:1) at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230) at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148) at org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(EventAdminImpl.java:135) at org.eclipse.equinox.internal.event.EventAdminImpl.sendEvent(EventAdminImpl.java:78) at org.eclipse.equinox.internal.event.EventComponent.sendEvent(EventComponent.java:39) at org.eclipse.e4.ui.services.internal.events.EventBroker.send(EventBroker.java:94) at org.eclipse.e4.ui.internal.workbench.UIEventPublisher.notifyChanged(UIEventPublisher.java:60) at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:374) at org.eclipse.e4.ui.model.application.ui.impl.ElementContainerImpl.setSelectedElement(ElementContainerImpl.java:173) at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.showElementInWindow(ModelServiceImpl.java:617) at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.bringToTop(ModelServiceImpl.java:581) at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.delegateBringToTop(PartServiceImpl.java:770) at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.bringToTop(PartServiceImpl.java:401) at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.showPart(PartServiceImpl.java:1214) at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:3261) at org.eclipse.ui.internal.WorkbenchPage.access$25(WorkbenchPage.java:3176) at org.eclipse.ui.internal.WorkbenchPage$10.run(WorkbenchPage.java:3158) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70) at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:3153) at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:3117) at org.eclipse.ui.actions.OpenWithMenu.openEditor(OpenWithMenu.java:324) at org.eclipse.ui.actions.OpenWithMenu.lambda$1(OpenWithMenu.java:211) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4418) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1079) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4236) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3824) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1121) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1022) at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:150) at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:693) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:610) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:138) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:673) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:610) at org.eclipse.equinox.launcher.Main.run(Main.java:1519) Caused by: java.lang.ClassNotFoundException: org.eclipse.ice.client.widgets.geometry.GeometryEditor cannot be found by org.eclipse.ice.client.widgets_2.2.0.201702201939 at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:461) at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:372) at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:364) at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:161) at java.lang.ClassLoader.loadClass(Unknown Source) at org.eclipse.osgi.internal.framework.EquinoxBundle.loadClass(EquinoxBundle.java:564) at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:174) ... 89 more 

1 Answers

Answers 1

According to Eclipse, the Prerequisites are.

ICE requires a Java Development Kit (JDK) with Java 1.8 or greater.
Sun's version of Java can be used on Linux, Windows, or Mac, and OpenJDK can also be used on Linux and Mac.
The ICE development team prefers OpenJDK for Linux systems. Some tools in ICE also require the installation of third-party libraries. While it is not necessary to install these libraries to run ICE, the Reactors and Visualization perspectives will not work correctly without them.

For Mac OS X ICE developers also recommend installing the Homebrew package manager.

VisIt (Optional)

To visualize 3D data, ICE requires the installation of VisIt (minimum version 2.8.2) on a local or remote machine.

VisIt is available for download from the Lawrence Livermore National Laboratory website, and doesn't require any additional configuration to use with ICE.

3D Graphics

ICE also requires that your system has 3D rendering enabled to edit geometries and visualize 3D data, which is normally done by installing the 3D graphics drivers from the vendor of your graphics card. You should consult your IT specialist if you do not know how to enable this feature on your machine.

Certain features in ICE, currently including the Geometry and Mesh editors, also require JavaFX. This is included in most versions of the JDK, but default distributions for some Linux operating systems (including Fedora and CentOS) do not. In that case, you will need to download the official nightly build from the Java website.

Then in the terminal, run

alternatives --install /usr/bin/java java /path/to/the/jdk installation/jre/bin/java 3 

or some number other than 3 if you already have multiple jdk installations. Then run

alternatives --config java 

And type in the number you assigned to the new JDK in the previous step.

Read More

Thursday, March 2, 2017

Eclipse 4.4 Luna pinning editor tabs

Leave a Comment

I've found this question: Eclipse - How to pin editor tabs? and I've installed "Extended VS Presentation plugin for Eclipse", but it's not working.

How it should look (from http://andrei.gmxhome.de/skins/index.html):

http://andrei.gmxhome.de/skins/extendedvs_props.gif

How it actually looks on my Eclipse 4.4 (on Ubuntu):

Eclipse 4.4 (on Ubuntu)

As you can see, "Current presentation" setting is missing.

When I've installed this plugin (via eclipse), it was in "Eclipse 3.6 - 3.8 plugins", so maybe it's incompatible with 4.4 Luna? However, it was possible to install it, so it should work, right?

Also, if you know any plugin that would allow pinning tabs in eclipse, feel free to post your answer and describe it.

3 Answers

Answers 1

That first Appearance dialog is how it looks in Eclipse 3.x. The appearance code was completely rewritten for Eclipse 4.x.

The fact the plugin installs may just mean the install is not careful enough about specifying the versions of Eclipse it supports.

You should try and contact the plugin author to see if it supports Eclipse Luna.

Answers 2

Support eclipse versions for this plugins:

Eclipse Versions: Juno (4.2, 3.8), Previous to Juno (<=4.1)

This plugin NOT works(See this) in eclipse 3.x on Linux.(But here author says it support Linux platform. Contact author for more details)

This plugin NOT works in eclipse 4.x on any platform.

Please note, that the skin, tab actions and lists are available for Eclipse 3.x only! Eclipse 4.x is not supported.

Answers 3

In my point of view, everything is fine.

As you can see in the images below, (Check bottom (console) ).

Main Page

The above page is updated on 06-25-2014

But the screenshot in that page is taken on 06-02-2008 , (Check bottom (console) ).

Screenshot

The screenshot given in that page is a screenshot of very very old version. The plugin is updated, but the screenshot in the page is not yet updated.
The new plugin will work as shown in the image in the question

Alternative

In Eclipse 4.4.0 there You'll find a pin symbol in the default toolbar of Eclipse on the right side. After clicking it, the Java Editor Tab symbol gets changed indicating this editor is pinned now. Unfortunatelly I could not find a corresponding entry in the popup menu. But it is easy to assign e.g. the keys Ctrl-P to "Pin Editor" in the key bindings of Eclipse. (Don't forget to unbind Ctr-P = Print).
In Eclipse Neon 4.6.0 Pin is not functioning.

Read More

Sunday, February 12, 2017

When adding resources to a Tomcat server in Eclipse, what can be a resource?

Leave a Comment

When I bring up the "Add and Remove" resource dialog to add things like .war files (I think war is an example), I would like to know what sort of things constitute "resources" and how Eclipse identifies them as such. I am working on a new project that has a fairly complex Maven build and it is not clear to me what exactly I am adding to Tomcat. Could a directory be a resource? A pom file?

I should mention that I see a SNAPSHOT file (actually, the thing named this seems to be a Windows folder which does not hold jars) as a resource that can be added but the build does not seem to be producing a war or jar file which is named in this way. What does get added if I choose to add this resource seems to be composed of a bunch of jars or wars.

1 Answers

Answers 1

Perhaps you didn't create your project as "Dynamic Web Project", so Eclipse doesn't recognize it like web project. Create new "Dynamic Web Project" or go to Properties -> Projects Facets and check Dynamic Web Module

Read More

Sunday, February 5, 2017

How to detect the front-end actions at the back-end?

Leave a Comment

I'm new to JavaScript environment and it's the one running on the system i'm newly at. We're using GWT for JavaScript.

What is the best way to detect the connections between the back-end processes and front-end actions? Eg. which back-end method is invoked when "that" button is pressed, tab is clicked, window is opened, ... .

The only way I can think of is using the debugger and Eclipse search/call hierarchies facilities: keep putting breakpoints in places where I anticipate will run-- until i hit the spot.

Is/n't there a more efficient way of doing this?

How do other developers do?

I'm a back-end developer. In a previous system, I put a port monitor-- Fiddler, saw the contents of the request the FE is sending and went from there.

I'm aware that this is a naive Q-- please bear with me.

TIA.

//======================

EDIT:

the best would be a debugger-like tool showing the stack-trace, or even the execution path in any way, telling the back-end methods that are running and/or spawning the threads. is there such a tool?

5 Answers

Answers 1

The following takes for granted that you are using a decent IDE and that you have imported the GWT project into such IDE. There's some help at the end if this is not your case.

If you know which Java class contains the front-end logic, and the element you're interested in

Find the object representing the element (a Button, a ListBox, whatever) and look at the event handlers attached to it.
Something like this:

//... @UiField ListBox myDropDownList; //...     myDropDownList.addChangeHandler(new ChangeHandler() {         @Override         public void onChange(ChangeEvent changeEvent) {             SomeService.someRPCmethod(... params, callback, ...);         }     }); 

The SomeService.someRPCmethod method implementation should contain all the backend calls.

If you know the Java class, but not which one of all the buttons is the one you're looking for

Most GWT apps make use of *.ui.xml files which are like a skeleton for the actual web page. This XML files reference the actual Java objects used in the Java class, and are usually named like the class they represent.
Locate the ui.xml file and look for something like this:

... <g:ListBox ui:field="myDropDownList" styleName="cssClassName"/> ... 

This should appear in your webpage like this:

<select class="cssClassName" ...>     <option ...> 

The position inside the XML file, and the CSS class name, should help you pinpoint the element you're looking for. Once you find it, the ui:field attribute points to the Java object (try ctrl+clicking it in your IDE).
Now you just have to look at the handlers as explained before.

If you don't know the Java class which contains the front-end logic

To find the Java class for a given webpage, you can resort to the good ol' string search.
Locate a not-so-common string literal used in the web page. Not something like "Add" but more like "User registration".
Use your IDE to search the project's code base for that string. It should appear inside a .properties file, or a class with constants and literals, or maybe even hardcoded inside the front-end Java class.
Now just use your IDE to follow the references. It might be something like .properties file -> Constants interface -> .ui.xml file -> front-end Java class, or literals Java class -> front-end Java class.

If you don't have access to the front-end source code

You can try to use your Developer Tools / Fiddler to look for REST calls, which is how GWT implements RPC.
So the call to SomeService.someRPCmethod above might appear in Fiddler as a http:://yourwebpage/somepath/SomeService call with a bunch of GET/POST parameters, one of which should be someRPCmethod (the method's name). But this is not always the case.

Last (or maybe first!) resource

Ask the front-end developers, they put the calls in there and can get you on track in minutes ;)

Answers 2

I had similar issue, so I installed an extension in my chrome.Below is the name of the extension. You can try once.

Visual Event 2.1

Know what event is bound on each dom element 

There is one more approach, You can debug your code from front end. You can inspect element in your browser and then open Source tab.
Press ctrl + P to search the file in which you want to put the debug points.
Put debug points by clicking on the row number.
This way you need not to go to eclipse that often.

Answers 3

I would start by searching the code for the listeners of whatever events you are interested in and go from there. I work in EXT JS and I do this all the time.

Following all code paths through is the only guarantee unless all calls to the backend go through some known class.

Monitoring the network is also a good way to go.

This can be done in Chrome through the "Developer Tools" on the Network tab.

Answers 4

In GWT you have on the client side "import java.util.logging.Logger;" which output your debug info to the browsers console. On the server side you just use "System.out.println("debug");" for debugging which goes to the Apaches Tomcat log files. Which makes debugging on a live server a bit easier.

GWT uses RPC's for communication between the client and server. The data sent is serialized and can be a whole class if needed. The three folder for source in a module as 'client', 'server' and 'shared'.

For example a shared class used for sending data back and forth: (The blank constructor is required to serialise the class)

public class MySharedData implements Serializable {     private static final long serialVersionUID = 1987236748763652L; // used for serializing data      public List<String> lotsOfStrings = new ArrayList<String>(); // use most java vars     public int width, height;      public MySharedData() {} // 'need' a blank constructor     public MySharedData(MySharedData data) { //do stuff } // also can } 

On the server side it may look something like this:

public class MyServerRPCImpl extends RemoteServiceServlet implements MyServerRPC {     private static final long serialVersionUID = 4435555929902374350L;      public List<String> getStringList(int var, List<String> strs) {         // do stuff         System.out.println("debugging output"); // to tomcat log file         return stringList;     } } 

The client will use an Asynchronous callback with two methods, onSuccess() and onFailure() so you can handle call failures. To use this is something along the lines of:

public class MyGWTApp implements EntryPoint {     // the server RPC class     final MyServerRPCAsync server = GWT.create(MyServerRPC.class); // create RPC instance     final Logger log = Logger.getLogger("tag");      public void doSomething() {         MySharedData data = new MySharedData();         server.getStringList(data, new AsyncCallback<List<String>>() {             @Override             public void onFailure(Throwable caught) {                 log.info("error"); // logging goes to the javascript console output             }             @Override             public void onSuccess(List<String> result) {                 log.info("call worked");             }         };)     } } 

The above is my way of managing logging as my projects have to run straight from a Tomcat server. I also believe the server logging when run from Eclipse will go to Eclipse's console log, but I'm unsure on that. All server output and errors, including stack traces will be in the /var/log/tomcat/ folder on linux, or the equivalent on Windows. I can honestly say, I've yet not used breakpoints debugging with GWT.

Client and server code is in separate classes in their own folders within the project.

Answers 5

Just want to mention that sometimes debugger is used in situations where other tools can also help (not sure if this is the situation here - but bear with me just another two sentences):

(1) you can grep the relevant html asset , grep is a wonderful tool to learn large systems

(2) you can add log , in some cases you can switch to debug mode and see tons of log traces

Read More