Total Pageviews

Showing posts with label Eclipse. Show all posts
Showing posts with label Eclipse. Show all posts

2014/11/18

An internal error occurred during: "Initializing Java Tooling". Duplicate field name&signature in class file org/eclipse/jdt/internal/compiler/ast/ASTNode

Problem
I change to a brand new workspace to import project from gitlab.
After imported and try to do maven => update projects, it show "An internal error occurred during: "Initializing Java Tooling". Duplicate field name&signature in class file org/eclipse/jdt/internal/compiler/ast/ASTNode". 

Here has its screenshot:


Root Cause
This error results from lombok's bug. 


Solution
Step1. Shut down your eclipse
Step2. Go to here to download the jar file : http://projectlombok.org/download-edge.html
Step3. follow the instructions in  http://projectlombok.org/download-edge.html
Step4. Startup your eclipse and do again.



Reference
[1] http://stackoverflow.com/questions/21931107/eclipse-wont-switch-workspace

2014/11/11

How to create project in GitLab and import project into Eclipse

Go to GitLab to create my project
1. Click New Project
 2. Fill in your project name, namespace => Create project


Open Git Bash
1. Change directory to my specific dirctory => make dbm directory => Initialized empty Git repository
1:  albert@ALBERT-PC ~  
2:  $ cd d:  
3:  albert@ALBERT-PC /d  
4:  $ cd git  
5:  albert@ALBERT-PC /d/git  
6:  $ mkdir dbm  
7:  albert@ALBERT-PC /d/git  
8:  $ cd dbm  
9:  albert@ALBERT-PC /d/git/dbm  
10:  $ git init  
11:  Initialized empty Git repository in d:/git/dbm/.git/  

2. create README file => add README to track => commit
1:  albert@ALBERT-PC /d/git/dbm (master)  
2:  $ touch README  
3:  albert@ALBERT-PC /d/git/dbm (master)  
4:  $ git add README  
5:  albert@ALBERT-PC /d/git/dbm (master)  
6:  $ git commit -m "first commit"  
7:  [master (root-commit) b45a8a4] first commit  
8:   1 file changed, 0 insertions(+), 0 deletions(-)  
9:   create mode 100644 README  

3. add git remote repository => push to remote
1:  albert@ALBERT-PC /d/git/dbm (master)  
2:  $ git remote add origin http://192.168.31.166/ifmis/dbm.git  
3:  albert@ALBERT-PC /d/git/dbm (master)  
4:  $ git push -u origin master  
5:  Username for 'http://192.168.31.166': albert_kuo  
6:  Password for 'http://albert_kuo@192.168.31.166':  
7:  Counting objects: 3, done.  
8:  Writing objects: 100% (3/3), 206 bytes | 0 bytes/s, done.  
9:  Total 3 (delta 0), reused 0 (delta 0)  
10:  To http://192.168.31.166/ifmis/dbm.git  
11:   * [new branch]   master -> master  
12:  Branch master set up to track remote branch master from origin.  

README file had been commit into git

Assume I create my project skeleton into my git folder

Add all files into track => commit => push to remote
1:  albert@ALBERT-PC /d/git/dbm (master)  
2:  $ git add .  
3:  warning: LF will be replaced by CRLF in dbm-webapp/src/main/jasperreports/README.md.  
4:  The file will have its original line endings in your working directory.  
5:  warning: LF will be replaced by CRLF in dbm-webapp/src/main/webapp/WEB-INF/templates/README.md.  
6:  The file will have its original line endings in your working directory.  
7:  warning: LF will be replaced by CRLF in dbm-webapp/src/main/webapp/scripts/README.md.  
8:  The file will have its original line endings in your working directory.  
9:  warning: LF will be replaced by CRLF in dbm-webapp/src/main/webapp/styles/README.md.  
10:  The file will have its original line endings in your working directory.  
11:  warning: LF will be replaced by CRLF in dbm-webapp/src/test/database/README.md.  
12:  The file will have its original line endings in your working directory.  
13:  warning: LF will be replaced by CRLF in dbm-webapp/src/test/database/test-datasource.xml.template-or  
14:  acle.  
15:  The file will have its original line endings in your working directory.  
16:  warning: LF will be replaced by CRLF in dbm-webapp/src/test/database/test-datasource.xml.template-sq  
17:  lserver.  
18:  The file will have its original line endings in your working directory.  
19:  warning: LF will be replaced by CRLF in pom.xml.  
20:  The file will have its original line endings in your working directory.  
21:  albert@ALBERT-PC /d/git/dbm (master)  
22:  $ git commit -m "create project skeleton"  
23:  [master 4abf50e] create project skeleton  
24:  warning: LF will be replaced by CRLF in dbm-webapp/src/main/jasperreports/README.md.  
25:  The file will have its original line endings in your working directory.  
26:  warning: LF will be replaced by CRLF in dbm-webapp/src/main/webapp/WEB-INF/templates/README.md.  
27:  The file will have its original line endings in your working directory.  
28:  warning: LF will be replaced by CRLF in dbm-webapp/src/main/webapp/scripts/README.md.  
29:  The file will have its original line endings in your working directory.  
30:  warning: LF will be replaced by CRLF in dbm-webapp/src/main/webapp/styles/README.md.  
31:  The file will have its original line endings in your working directory.  
32:  warning: LF will be replaced by CRLF in dbm-webapp/src/test/database/README.md.  
33:  The file will have its original line endings in your working directory.  
34:  warning: LF will be replaced by CRLF in dbm-webapp/src/test/database/test-datasource.xml.template-or  
35:  acle.  
36:  The file will have its original line endings in your working directory.  
37:  warning: LF will be replaced by CRLF in dbm-webapp/src/test/database/test-datasource.xml.template-sq  
38:  lserver.  
39:  The file will have its original line endings in your working directory.  
40:  warning: LF will be replaced by CRLF in pom.xml.  
41:  The file will have its original line endings in your working directory.  
42:   22 files changed, 498 insertions(+)  
43:   create mode 100644 README.md  
44:   create mode 100644 dbm-entity/pom.xml  
45:   create mode 100644 dbm-entity/src/main/java/gov/nta/entity/package-info.java  
46:   create mode 100644 dbm-service/pom.xml  
47:   create mode 100644 dbm-service/src/main/java/gov/nta/dbm/repository/package-info.java  
48:   create mode 100644 dbm-service/src/main/java/gov/nta/dbm/service/package-info.java  
49:   create mode 100644 dbm-webapp/pom.xml  
50:   create mode 100644 dbm-webapp/src/main/jasperreports/README.md  
51:   create mode 100644 dbm-webapp/src/main/java/gov/nta/dbm/web/controller/package-info.java  
52:   create mode 100644 dbm-webapp/src/main/java/gov/nta/dbm/web/dto/package-info.java  
53:   create mode 100644 dbm-webapp/src/main/java/gov/nta/dbm/web/rest/package-info.java  
54:   create mode 100644 dbm-webapp/src/main/resources/gov/nta/dbm/Messages.properties  
55:   create mode 100644 dbm-webapp/src/main/webapp/WEB-INF/jboss-deployment-structure.xml  
56:   create mode 100644 dbm-webapp/src/main/webapp/WEB-INF/jboss-web.xml  
57:   create mode 100644 dbm-webapp/src/main/webapp/WEB-INF/templates/README.md  
58:   create mode 100644 dbm-webapp/src/main/webapp/WEB-INF/web.xml  
59:   create mode 100644 dbm-webapp/src/main/webapp/scripts/README.md  
60:   create mode 100644 dbm-webapp/src/main/webapp/styles/README.md  
61:   create mode 100644 dbm-webapp/src/test/database/README.md  
62:   create mode 100644 dbm-webapp/src/test/database/test-datasource.xml.template-oracle  
63:   create mode 100644 dbm-webapp/src/test/database/test-datasource.xml.template-sqlserver  
64:   create mode 100644 pom.xml  
65:  albert@ALBERT-PC /d/git/dbm (master)  
66:  $ git push -u origin master  
67:  Username for 'http://192.168.31.166': albert_kuo  
68:  Password for 'http://albert_kuo@192.168.31.166':  
69:  Counting objects: 64, done.  
70:  Delta compression using up to 4 threads.  
71:  Compressing objects: 100% (34/34), done.  
72:  Writing objects: 100% (63/63), 10.12 KiB | 0 bytes/s, done.  
73:  Total 63 (delta 2), reused 0 (delta 0)  
74:  To http://192.168.31.166/ifmis/dbm.git  
75:    b45a8a4..4abf50e master -> master  
76:  Branch master set up to track remote branch master from origin.

See..my project skeleton had been commit

Import Git project into Eclipse
1. Copy url

2. File => Import => choose SCM type to "git" => paste url => Finish

3. Well done.




Do not have git connector when I want to Checkout Maven project from SCM

Problem
I would like to import Maven project from Git
File => import

Check out Maven Projects from SCM => Next

I do not have "git" option to select !

Solution
Install git connector

Window => Preferences

Maven => Discovery => Open Catalog

Check "m2e-egit" => Finish

After installation, click Yes to restart eclipse

File => import => Check out Maven Projects from SCM => Next
We have "git" option now!




Unable to ignore resources. Attempted to beginRule: .....

Problem
After I imported Maven project from Git, I always get this error when I do maven-->update projects

Solution
This link, http://www.eclipse.org/forums/index.php/t/493493/ , provides some workaround solutions. 

But you can check the post in the bottom, the author say its plug-in's problem. After I updated it, this error message had gone away.



2014/11/09

Failed to launch Eclipse after updated Mac OS Yosemite (10.10)

Problem
After I upgraded Mac OS Yosemite, I found out I cannot launch Eclipse correctly.

Solution
Please go to here to download Java for OS X 2014-001
http://support.apple.com/kb/DL1572?viewlocale=en_US&locale=en_US

After installed Java for OS X 2014-001, my Eclipse can startup correctly.

2014/10/15

JRebel - Reload any changes without restart server

As a developer, we do not want to waste time to restart server again and again to see the implace of code changes.
You can try JRebel to save your time.

If you are using Eclipse, here has good step-by-step installation and configuration guide: http://manuals.zeroturnaround.com/jrebel/ide/eclipse.html

For more information, please check http://zeroturnaround.com/software/jrebel/learn/

Demo

Here has code snippet, and it will print debug message as entering this method
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
  @RequestMapping(value = "/query/tab1", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)  
  public @ResponseBody  
  List findTab1(@RequestBody Fms420rFormBean formBean, Alerter alerter) {  
    log.debug("test");  
    List dataList = service.queryTab1(formBean.getYear(), formBean.getMonth());  
    if (CollectionUtils.isEmpty(dataList)) {  
      alerter.info(Messages.warning_notFound());  
    } else {  
      alerter.info(Messages.success_find());  
     }  
     return dataList;  
   } 

And the console will print "test" debugging message as entering this method:
1:  19:15:45,493 INFO [stdout]  [20123] DEBUG gov.nta.fms.web.rest.Fms420rResource - test  

In order to test JRebel, I just modified the debug message to "JRebel test" and submit query without restart application server
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
 @RequestMapping(value = "/query/tab1", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)  
 public @ResponseBody  
 List findTab1(@RequestBody Fms420rFormBean formBean, Alerter alerter) {  
   log.debug("JRebel test");  
   List dataList = service.queryTab1(formBean.getYear(), formBean.getMonth());  
   if (CollectionUtils.isEmpty(dataList)) {  
     alerter.info(Messages.warning_notFound());  
   } else {  
     alerter.info(Messages.success_find());  
    }  
    return dataList;  
  } 
 
See....I don't redeploy and restart application server, but the console print the up-to-date debug message. 
1:  19:16:19,742 INFO [stdout]  [20123] DEBUG gov.nta.fms.web.rest.Fms420rResource - JRebel test  

It's because of JRebel reload any changes classes automatically. 
When you change any class or resource in your IDE, the change will reflect in you application immediately, skipping the build and redeploy phases.




2014/04/02

SVN error on Eclipse: org.tigris.subversion.javahl.ClientException: Attempted to lock an already-locked dir

Problem
As I commit my source code to SVN in eclipse, but Eclipse shut down unexpectedly. After I launch Eclipse again, and try to commit again, it show this error message:




 org.apache.subversion.javahl.ClientException: Attempted to lock an already-locked dir  
 svn: Commit failed (details follow):  
 svn: Working copy 'D:\workspace\fms\fms-webapp\src\main\java\gov\nta\fms\web\controller' locked.  
 svn: 'D:\workspace\fms\fms-webapp\src\main\java\gov\nta\fms\web\controller' is already locked. 

Solution
Right click on the offending project, click Team and then select Refresh/Cleanup. SVN gets the offending .lock files and deletes them. 

cleanup D:/workspace/fms/fms-webapp/src/main/java  

After Refresh/Cleanup, I can commit source code successfully
commit -m "add 4 spaces for rptInfo parameter" D:/workspace/fms/fms-webapp/src/main/java/gov/nta/fms/web/controller/Fms406rReportController.java  
   Sending    D:/workspace/fms/fms-webapp/src/main/java/gov/nta/fms/web/controller/Fms406rReportController.java  
   Transmitting file data ...  
   Committed revision 1264.  

Reference

2013/12/24

An internal error occurred during: "Initializing Java Tooling" from Eclipse

Problem
One day as I startup my eclipse it show the error as bellows:

Solution
Step1. Close Eclipse
Step2. Go to your eclipse workspace, and go to this directory
 %workspace%/.metadata/.plugins/org.eclipse.jdt.core/  
ex.

Step3. delete variablesAndContainers.dat
Step4. Start Eclipse







2011/09/23

There are no resources that can be added or removed from the server


Today I simply would like to deploy my ear file to WAS (Web Application Server) as usual. 


But it fail to find my EAR file:
 

I spent more than two hours to find its root cause and solution. But it's still in vain.
Finally, I decide to give up. I just switch to another workspace and check out source code from SubVersion, then it's going to normal. I don't know why!
 

2011/09/15

How to Organize Imports Automatically in Eclipse

Problem
When using Eclipse, I find myself typing Ctrl+Shift+O several times, to organize imports (usually imports which are no longer required, generating warnings).



Solution
Preferences->Java->Editor->Save Actions->Check "Perform the selected actions on save" --> Check "Organize Imports"



See....after save action had been trigger, it will organize imports automatically
 

2011/09/05

How to Adjust Your Eclipse's Tab Policy to Spaces Only


1. Window --> Preference

2. Use "formatter" as keyword to search --> New


3. Give it a new name in New Profile dialog --> Click OK 

4. In General Settings, choose "Spaces Only" in Tab policy

5. Click OK

2011/08/24

illegal character: \65279 when using file encoding UTF8

Problem
As I try to compile classes in my workspace, it show this error message "illegal character: \65279 when using file encoding UTF8".

Root Cause
Some Java class has BOM(Byte-Order Mark) character, so you need to remove it.

Solution
Use notepad++ to remove it.



2011/08/12

Install jquerywtp to Make Eclipse WTP's JavaScript Content Assistance Support jQuery

1. Go to download jar file, jqueryWTP1.00foEN.jar, from http://code.google.com/a/eclipselabs.org/p/jquerywtp/downloads/list

2. execute java -jar jqueryWTP1.20foEN.jar in command line

3. Jar File --> Browse --> Choose org.eclipse.wst.jsdt.core_1.1.4.v201102102045.jar


4. Output Dir --> Browse

5. Click Generate Button


6. You can get new jar file, org.eclipse.wst.jsdt.core_1.1.4.v201102102045.jar, in C:\

7. Overwrite jar file in eclipse\plugins

8. Then restart eclipse with -clean to clear plug-in cache.

9. Check the result

Remember to remove -clean after you launch eclipse

2011/05/31

eclipse-fonts

Easily control Eclipse fonts size. Update site: http://eclipse-fonts.googlecode.com/svn/trunk/FontsUpdate/

Shortcuts -

CTRL+= : Increase fonts

CTRL+- : Decrease fonts

2011/01/27

Eclipse Error – Failed to load the JNI shared library "C:\Program Files (x86)\Java\jre6\bin\client\jvm.dll"

Scenario
As I start up eclipse after I installed Windows 7 64-bit, it complained this error:
Failed to load the JNI shared library "C:\Program Files (x86)\Java\jre6\bin\client\jvm.dll"

Root Cause
I install JDK 32-bit version on Windows 7 64-bit.

Solution
Uninstall JDK 32-bit version, and install JDK 64-bit version.

2010/08/26

Enable code completion in xhtml file (facelets)

[Problem] code completion function does not work in xhtml file

[Solution]
Window > Preferences

General > Content Types > Text > JSP

Add (xhtml)

Click OK

[CHECK Result]