Skip to main content

11. JSF.. What about Java 9?

This post NEEDS has been UPDATED !!!


Java 9 is a bit more complicated to install than java 8, and needs Eclipse Oxygen v2 or higher. But take into account that it is adviseable to install Eclipse after installing Java 9!!!

1. Installing Java 1.9

Lets follow the steps of Shahrukh Aslam.


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
#download repository
sudo add-apt-repository ppa:webupd8team/java

#update reposotory
sudo apt-get update

#install
sudo apt install oracle-java9-installer

#make this java version default
sudo apt install oracle-java9-set-default

To see all the java versions installed try:

sudo update-alternatives --config java


    To verify the java version, from a terminal try java -version . If you don't get java 9, you should add the following lines to the /home/your-user-name/.bashsr file.  

    export JAVA_HOME=/usr/lib/jvm/java-9-oracle
    export PATH=$JAVA_HOME/bin:$PATH

2. Install eclipse Oxygen 2

And install again Lombok.

Eclipse Oxygen2 should be installed after Java 9 installation, not before !!!

3. Update your maven pom.xml

Java 9 does not include many libraries in its JDK, so they must be included in then pom.xml file.

This matter is explained later in this post. It is commented in the pom.xml all the additional libraries needed:


  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
<project xmlns="http://maven.apache.org/POM/4.0.0" 
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
         http://maven.apache.org/xsd/maven-4.0.0.xsd">
  
  <modelVersion>4.0.0</modelVersion>
  <groupId>openweb</groupId>
  <artifactId>OpenWebMaven</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>war</packaging>
  <name>OpenWebMaven</name>
  <description>Alfred's Project</description>
  
  <properties>
    <failOnMissingWebXml>false</failOnMissingWebXml>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.plugin>3.7.0</maven.compiler.plugin>
    <maven.compiler.source>9</maven.compiler.source>
    <maven.compiler.target>9</maven.compiler.target>
  </properties>
  
  <dependencies>
  
    <!-- Alfredo's dependencies in local file (dirty solution)-->
    <!-- @see http://roufid.com/3-ways-to-add-local-jar-to-maven-project/ -->
    <dependency> 
   <groupId>alfred.cullera</groupId>
   <artifactId>temaestany</artifactId>
   <version>1.0</version>
   <scope>system</scope>
   <!--@see http://dantesque-jsf.blogspot.com.es/2017/12/7-jsf-including-additional-files-in.html#p3-->
   <systemPath>${basedir}/src/main/webapp/WEB-INF/lib/temaestany.jar</systemPath>
    </dependency>
     
    <!--  TOMCAT Servlet-api -->
    <!-- https://mvnrepository.com/artifact/org.apache.tomcat/tomcat-servlet-api -->
    <!-- 
    <dependency>
      <groupId>org.apache.tomcat</groupId>
      <artifactId>tomcat-servlet-api</artifactId>
      <version>9.0.1</version>
    </dependency>
    -->
    
    <!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api -->
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>javax.servlet-api</artifactId>
      <version>4.0.0</version>
      <scope>provided</scope>
    </dependency>
    
    <!--  Expression EL evaluation -->
    <!-- https://mvnrepository.com/artifact/javax.el/javax.el-api -->
    <dependency>
      <groupId>javax.el</groupId>
      <artifactId>javax.el-api</artifactId>
      <version>3.0.1-b04</version>
    </dependency>
    
    
       
    <!--  JSF 2.3.3 OracleImplementation -->
    <!-- https://mvnrepository.com/artifact/org.glassfish/javax.faces -->
    <dependency>
      <groupId>org.glassfish</groupId>
      <artifactId>javax.faces</artifactId>
      <version>2.3.3</version>
    </dependency>
    

    <!--  Primefaces -->
    <dependency>
      <groupId>org.primefaces</groupId>
      <artifactId>primefaces</artifactId>
      <version>6.1</version>
    </dependency>
    
    <!-- https://mvnrepository.com/artifact/org.primefaces.themes/all-themes -->
    <dependency>
      <groupId>org.primefaces.themes</groupId>
      <artifactId>all-themes</artifactId>
      <version>1.0.10</version>
    </dependency>

 <!-- https://mvnrepository.com/artifact/org.primefaces.themes/casablanca -->
    <!-- 
    <dependency>
      <groupId>org.primefaces.themes</groupId>
      <artifactId>casablanca</artifactId>
      <version>1.0.10</version>
    </dependency>
 -->
    
    
    <!-- https://mvnrepository.com/artifact/org.primefaces.extensions/all-themes -->
    <!-- 
    <dependency>
      <groupId>org.primefaces.extensions</groupId>
      <artifactId>all-themes</artifactId>
      <version>1.0.8</version>
      <type>pom</type>
    </dependency>
    -->    
    <!-- Weld CDI for Tomcat with all dependencies included (does not fulfill all capabilities !!!) -->
    <dependency>
      <groupId>org.jboss.weld.servlet</groupId>
      <artifactId>weld-servlet-shaded</artifactId>
      <version>3.0.1.Final</version>
    </dependency>
    
        
    <!-- Validation API Optional -->
    <!-- 
    <dependency>
      <groupId>javax.validation</groupId>
      <artifactId>validation-api</artifactId>
      <version>2.0.0.Final</version>
    </dependency>
     -->
         
     
    <!-- JPA & Postgres -->
    <!-- Javassist required by Hibernate in some computers -->
    <!-- https://mvnrepository.com/artifact/org.javassist/javassist -->
    <dependency>
      <groupId>org.javassist</groupId>
      <artifactId>javassist</artifactId>
      <version>3.22.0-GA</version>
    </dependency>
  
  
    <!-- JPA 2.1 Provider -->
    <!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-core -->
    <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate-core</artifactId>
      <version>5.2.12.Final</version>
    </dependency>
    
    <!-- Envers for auditing the database -->
    <!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-envers -->
    <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate-envers</artifactId>
      <version>5.2.12.Final</version>
    </dependency>
    
    
    <!-- POSTGRES XUNGO!!!!!!! -->
    <!-- https://mvnrepository.com/artifact/org.postgresql/postgresql -->
    <dependency>
      <groupId>org.postgresql</groupId>
      <artifactId>postgresql</artifactId>
      <version>42.1.4</version>
    </dependency>  
     
    <!-- https://mvnrepository.com/artifact/org.postgresql/postgresql -->
    <!-- 
    <dependency>
      <groupId>org.postgresql</groupId>
      <artifactId>postgresql</artifactId>
      <version>9.4.1211</version>
    </dependency>
    --> 
    
    <!-- Hibernate Bean Validator Optional -->
    <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate-validator</artifactId>
      <version>6.0.4.Final</version>
    </dependency>  
    
    <!--  Lombok for setters and getters -->
    <dependency>
      <groupId>org.projectlombok</groupId>
      <artifactId>lombok</artifactId>
      <version>1.16.18</version>
    </dependency>
    
       
    <!-- Apache commons codec for md5 digest -->
    <!-- https://mvnrepository.com/artifact/commons-codec/commons-codec -->
    <dependency>
      <groupId>commons-codec</groupId>
      <artifactId>commons-codec</artifactId>
      <version>1.11</version>
    </dependency>
    
    <!-- Hibernate Testing !!! -->
    <!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-testing -->
    <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate-testing</artifactId>
      <version>5.2.12.Final</version>
      <scope>test</scope>
    </dependency>
    
    <!-- Apache commons DBCP Connection Pooling system -->
    <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-dbcp2 -->
    <!-- 
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-dbcp2</artifactId>
      <version>2.1.1</version>
    </dependency>
     -->
     
    <!-- https://mvnrepository.com/artifact/org.apache.tomcat/tomcat-dbcp -->
    <dependency>
      <groupId>org.apache.tomcat</groupId>
      <artifactId>tomcat-dbcp</artifactId>
      <version>9.0.1</version>
    </dependency>
    
    
    <!-- Apache commons lang3 with stringUtils --> 
    <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
      <version>3.7</version>
    </dependency>
    
    <!-- Apache commons BeanUtils --> 
    <!-- https://mvnrepository.com/artifact/commons-beanutils/commons-beanutils -->
 <dependency>
     <groupId>commons-beanutils</groupId>
     <artifactId>commons-beanutils</artifactId>
     <version>1.9.3</version>
 </dependency>
 
 <!-- Java CSV csvreader & csvwriter -->
 <!-- https://mvnrepository.com/artifact/net.sourceforge.javacsv/javacsv -->
    <dependency>
      <groupId>net.sourceforge.javacsv</groupId>
      <artifactId>javacsv</artifactId>
      <version>2.0</version>
    </dependency>

    <!--  Evaluate expressions Apache-commons-JEXL -->
    <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-jexl3 -->
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-jexl3</artifactId>
      <version>3.1</version>
    </dependency>
    
    <!-- Jackson for JSON  -->
    <!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
      <version>2.9.3</version>
    </dependency>

    <!--BEGIN Java 9 references to JEE  not included in JDK9-->
    
    <!-- https://mvnrepository.com/artifact/javax.xml.bind/jaxb-api -->
    <dependency>
      <groupId>javax.xml.bind</groupId>
      <artifactId>jaxb-api</artifactId>
      <version>2.3.0</version>
    </dependency>
    
    <!-- https://mvnrepository.com/artifact/com.sun.xml.bind/jaxb-impl -->
    <dependency>
      <groupId>com.sun.xml.bind</groupId>
      <artifactId>jaxb-impl</artifactId>
      <version>2.3.0</version>
    </dependency>
        
    <!-- https://mvnrepository.com/artifact/com.sun.xml.bind/jaxb-core -->
    <dependency>
      <groupId>com.sun.xml.bind</groupId>
      <artifactId>jaxb-core</artifactId>
      <version>2.3.0</version>
    </dependency>
    
    <!-- https://mvnrepository.com/artifact/javax.activation/javax.activation-api -->
    <dependency>
      <groupId>javax.activation</groupId>
      <artifactId>javax.activation-api</artifactId>
      <version>1.2.0</version>
    </dependency>
    
    
    <!-- END Java 9 references to JEE  not included in JDK9-->

    
 <!--    
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
     -->
  
  <!--  to load from primefaces maven repository !! -->
  <!-- see https://stackoverflow.com/questions/21705509/primefaces-all-themes-v-1-0-10-installation -->
  </dependencies>
  <repositories>
     <repository>
      <id>prime-repo</id>
      <name>PrimeFaces Maven Repository</name>
      <url>http://repository.primefaces.org</url>
      <layout>default</layout>
    </repository>
  </repositories>
  
  
  
  
</project>



4. Alternative maven pom.xml (not recommended)


This is the pom-xml that I initialy proposed. But I think the previous one is best. So take care if you use this one. We have explicitly indicated to use maven 3.7.0 compiler for Java 9 and updated the pluggins to newer versions.


  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>OpenWebMaven</groupId>
  <artifactId>OpenWebMaven</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>war</packaging>
  <name>OpenWebMaven</name>
  <description>Alfred's program to Maven</description>

  <properties>
    <failOnMissingWebXml>false</failOnMissingWebXml>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>9</maven.compiler.source>
    <maven.compiler.target>9</maven.compiler.target>
  </properties>

  <dependencies>
  
    <!-- Alfredo's dependencies in local file (dirty solution)-->
    <!-- @see http://roufid.com/3-ways-to-add-local-jar-to-maven-project/ -->
    <dependency>
   <groupId>alfred.cullera</groupId>
   <artifactId>temaestany</artifactId>
   <version>1.0</version>
   <scope>system</scope>
   <!--@see http://dantesque-jsf.blogspot.com.es/2017/12/7-jsf-including-additional-files-in.html#p3-->
   <systemPath>${basedir}/src/main/webapp/WEB-INF/lib/temaestany.jar</systemPath>
    </dependency>
     
    <!--  TOMCAT Servlet-api -->
    <!-- https://mvnrepository.com/artifact/org.apache.tomcat/tomcat-servlet-api -->
    <!-- 
    <dependency>
      <groupId>org.apache.tomcat</groupId>
      <artifactId>tomcat-servlet-api</artifactId>
      <version>9.0.1</version>
    </dependency>
    -->
    
    <!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api -->
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>javax.servlet-api</artifactId>
      <version>4.0.0</version>
      <scope>provided</scope>
    </dependency>
    
    <!--  Expression EL evaluation -->
    <!-- https://mvnrepository.com/artifact/javax.el/javax.el-api -->
    <dependency>
      <groupId>javax.el</groupId>
      <artifactId>javax.el-api</artifactId>
      <version>3.0.1-b04</version>
    </dependency>
    
    
       
    <!--  JSF 2.3.3 OracleImplementation -->
    <!-- https://mvnrepository.com/artifact/org.glassfish/javax.faces -->
    <dependency>
      <groupId>org.glassfish</groupId>
      <artifactId>javax.faces</artifactId>
      <version>2.3.3</version>
    </dependency>
    

    <!--  Primefaces -->
    <dependency>
      <groupId>org.primefaces</groupId>
      <artifactId>primefaces</artifactId>
      <version>6.1</version>
    </dependency>
    
    <!-- https://mvnrepository.com/artifact/org.primefaces.themes/all-themes -->
    <dependency>
      <groupId>org.primefaces.themes</groupId>
      <artifactId>all-themes</artifactId>
      <version>1.0.10</version>
    </dependency>

 <!-- https://mvnrepository.com/artifact/org.primefaces.themes/casablanca -->
    <!-- 
    <dependency>
      <groupId>org.primefaces.themes</groupId>
      <artifactId>casablanca</artifactId>
      <version>1.0.10</version>
    </dependency>
 -->
    
    
    <!-- https://mvnrepository.com/artifact/org.primefaces.extensions/all-themes -->
    <!-- 
    <dependency>
      <groupId>org.primefaces.extensions</groupId>
      <artifactId>all-themes</artifactId>
      <version>1.0.8</version>
      <type>pom</type>
    </dependency>
    -->    
    <!-- Weld CDI for Tomcat with all dependencies included (does not fulfill all capabilities !!!) -->
    <dependency>
      <groupId>org.jboss.weld.servlet</groupId>
      <artifactId>weld-servlet-shaded</artifactId>
      <version>3.0.1.Final</version>
    </dependency>
    
        
    <!-- Validation API Optional -->
    <!-- 
    <dependency>
      <groupId>javax.validation</groupId>
      <artifactId>validation-api</artifactId>
      <version>2.0.0.Final</version>
    </dependency>
     -->
         
     
    <!-- JPA & Postgres -->
    <!-- Javassist required by Hibernate in some computers -->
    <!-- https://mvnrepository.com/artifact/org.javassist/javassist -->
    <dependency>
      <groupId>org.javassist</groupId>
      <artifactId>javassist</artifactId>
      <version>3.22.0-GA</version>
    </dependency>
  
  
    <!-- JPA 2.1 Provider -->
    <!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-core -->
    <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate-core</artifactId>
      <version>5.2.12.Final</version>
    </dependency>
    
    <!-- Envers for auditing the database -->
    <!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-envers -->
    <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate-envers</artifactId>
      <version>5.2.12.Final</version>
    </dependency>
    
    
    <!-- POSTGRES XUNGO!!!!!!! -->
    <!-- https://mvnrepository.com/artifact/org.postgresql/postgresql -->
    <dependency>
      <groupId>org.postgresql</groupId>
      <artifactId>postgresql</artifactId>
      <version>42.1.4</version>
    </dependency>  
     
    <!-- https://mvnrepository.com/artifact/org.postgresql/postgresql -->
    <!-- 
    <dependency>
      <groupId>org.postgresql</groupId>
      <artifactId>postgresql</artifactId>
      <version>9.4.1211</version>
    </dependency>
    --> 
    
    <!-- Hibernate Bean Validator Optional -->
    <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate-validator</artifactId>
      <version>6.0.4.Final</version>
    </dependency>  
    
    <!--  Lombok for setters and getters -->
    <dependency>
      <groupId>org.projectlombok</groupId>
      <artifactId>lombok</artifactId>
      <version>1.16.18</version>
    </dependency>
    
       
    <!-- Apache commons codec for md5 digest -->
    <!-- https://mvnrepository.com/artifact/commons-codec/commons-codec -->
    <dependency>
      <groupId>commons-codec</groupId>
      <artifactId>commons-codec</artifactId>
      <version>1.11</version>
    </dependency>
    
    <!-- Hibernate Testing !!! -->
    <!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-testing -->
    <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate-testing</artifactId>
      <version>5.2.12.Final</version>
      <scope>test</scope>
    </dependency>
    
    <!-- Apache commons DBCP Connection Pooling system -->
    <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-dbcp2 -->
    <!-- 
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-dbcp2</artifactId>
      <version>2.1.1</version>
    </dependency>
     -->
     
    <!-- https://mvnrepository.com/artifact/org.apache.tomcat/tomcat-dbcp -->
    <dependency>
      <groupId>org.apache.tomcat</groupId>
      <artifactId>tomcat-dbcp</artifactId>
      <version>9.0.1</version>
    </dependency>
    
    
    <!-- Apache commons lang3 with stringUtils --> 
    <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
      <version>3.7</version>
    </dependency>
    
    <!-- Apache commons BeanUtils --> 
    <!-- https://mvnrepository.com/artifact/commons-beanutils/commons-beanutils -->
 <dependency>
     <groupId>commons-beanutils</groupId>
     <artifactId>commons-beanutils</artifactId>
     <version>1.9.3</version>
 </dependency>
 
 <!-- Java CSV csvreader & csvwriter -->
 <!-- https://mvnrepository.com/artifact/net.sourceforge.javacsv/javacsv -->
    <dependency>
      <groupId>net.sourceforge.javacsv</groupId>
      <artifactId>javacsv</artifactId>
      <version>2.0</version>
    </dependency>

    <!--  Evaluate expressions Apache-commons-JEXL -->
    <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-jexl3 -->
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-jexl3</artifactId>
      <version>3.1</version>
    </dependency>
    
    <!-- Jackson for JSON  -->
    <!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
      <version>2.9.3</version>
    </dependency>

    
 <!--    
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
     -->
  
  <!--  to load from primefaces maven repository !! -->
  <!-- see https://stackoverflow.com/questions/21705509/primefaces-all-themes-v-1-0-10-installation -->
  </dependencies>
  <repositories>
     <repository>
      <id>prime-repo</id>
      <name>PrimeFaces Maven Repository</name>
      <url>http://repository.primefaces.org</url>
      <layout>default</layout>
    </repository>
  </repositories>
  
  
  <!--  To use JAVA 9  !!!!--> 
  <build>
 <plugins>
  <plugin>
   <artifactId>maven-compiler-plugin</artifactId>
   <version>3.7.0</version>
   <configuration>
    <!-- fork compilation and use the
       specified executable -->
    <fork>true</fork>
    <executable>javac9</executable>
   </configuration>
  </plugin>
  
  
  <plugin>
        <artifactId>maven-clean-plugin</artifactId>
        <version>3.0.0</version>
        <executions>
          <execution>
            <id>default-clean</id>
            <phase>clean</phase>
            <goals>
              <goal>clean</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <version>3.0.2</version>
        <executions>
          <execution>
            <id>default-testResources</id>
            <phase>process-test-resources</phase>
            <goals>
              <goal>testResources</goal>
            </goals>
          </execution>
          <execution>
            <id>default-resources</id>
            <phase>process-resources</phase>
            <goals>
              <goal>resources</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-war-plugin</artifactId>
        <version>3.2.0</version>
        <executions>
          <execution>
            <id>default-war</id>
            <phase>package</phase>
            <goals>
              <goal>war</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.20.1</version>
        <executions>
          <execution>
            <id>default-test</id>
            <phase>test</phase>
            <goals>
              <goal>test</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-install-plugin</artifactId>
        <version>2.5.2</version>
        <executions>
          <execution>
            <id>default-install</id>
            <phase>install</phase>
            <goals>
              <goal>install</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-deploy-plugin</artifactId>
        <version>2.8.2</version>
        <executions>
          <execution>
            <id>default-deploy</id>
            <phase>deploy</phase>
            <goals>
              <goal>deploy</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-site-plugin</artifactId>
        <version>3.6</version>
        <executions>
          <execution>
            <id>default-site</id>
            <phase>site</phase>
            <goals>
              <goal>site</goal>
            </goals>
            <configuration>
              <outputDirectory>/home/eduard/Workspace/WorkSpaceOxygen02/OpenWebMavenCasa/target/site</outputDirectory>
              <reportPlugins>
                <reportPlugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-project-info-reports-plugin</artifactId>
                </reportPlugin>
              </reportPlugins>
            </configuration>
          </execution>
          <execution>
            <id>default-deploy</id>
            <phase>site-deploy</phase>
            <goals>
              <goal>deploy</goal>
            </goals>
            <configuration>
              <outputDirectory>/home/eduard/Workspace/WorkSpaceOxygen02/OpenWebMavenCasa/target/site</outputDirectory>
              <reportPlugins>
                <reportPlugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-project-info-reports-plugin</artifactId>
                </reportPlugin>
              </reportPlugins>
            </configuration>
          </execution>
        </executions>
        <configuration>
          <outputDirectory>/home/eduard/Workspace/WorkSpaceOxygen02/OpenWebMavenCasa/target/site</outputDirectory>
          <reportPlugins>
            <reportPlugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-project-info-reports-plugin</artifactId>
            </reportPlugin>
          </reportPlugins>
        </configuration>
      </plugin>
  
  
 </plugins>
</build>
</project>


The major changes are:

  • Lines 13 and 14:  Java version has changed for 1.8 to 9
  • Lines 275 and downwards: References to new pluggins are introduced. Special mention to compiler version to 3.7.0 (line 280)

5. Java Build Path aims at JDK 9 instead of JDK 5

Right Click on your project- Build Path - Configure Build Path and verify that in Java Compiler you jave JavaSE-9 in use compliance from execution environment.



In the same window, configure also Project Facets so that aims to Java 9


6. The JEP 320 or the missing reference problem

As indicates this JEP 320 all the modules that can be qualified as JEE have been deprecated. The recommended way to use them seems to be adding the jars to the build path.

PROBLEM:

The removed references/utilities from JDK 9  textually quoting are:
  • java.xml.ws (JAX-WS, plus the related technologies SAAJ and Web Services Metadata)
  • java.xml.bind (JAXB)
  • java.activation (JAF)
  • java.xml.ws.annotation (Common Annotations)
  • java.corba (CORBA)
  • java.transaction (JTA)
Related modules in Java SE 9 are also deprecated for removal:
  • java.se.ee (Aggregator module for the six modules above)
  • jdk.xml.ws (Tools for JAX-WS)
  • jdk.xml.bind (Tools for JAXB)
  This JEP will remove the nine modules listed above:
  • Their source code will be deleted from the OpenJDK repository.
  • Their classes will not exist in the JDK runtime image.
  • Their tools will no longer be available:
    • wsgen and wsimport (from jdk.xml.ws)
    • schemagen and xjc (from jdk.xml.bind)
    • idljorbdservertool, and tnamesrv (from java.corba)
  • The JNDI CosNaming provider (from java.corba) will no longer be available.
  • No command line flag will be capable of enabling them, as --add-modulesdoes on JDK 9.
The rmic compiler will be updated to remove the -idl and -iiop options. Consequently, rmic will no longer be able to generate IDL or IIOP stubs and tie classes.
The JDK documentation and man pages will be updated to remove any references to these modules and tools, and to indicate the rmic changes.

Also continues with the

SOLUTION PROPOSAL:

This proposal assumes that developers who wish to compile or run applications on the latest JDK can find and deploy alternate versions of the Java EE technologies. The Reference Implementations (RIs) of JAX-WS and JAXB are a good starting point because they are complete replacements for the java.xml.ws and java.xml.bindmodules in JDK 9. The RIs are available as Maven artifacts: (note that they must be deployed on the class path)
The tools for JAX-WS and JAXB are also available as Maven artifacts:
There are also Maven artifacts that contain just the APIs of the Java EE technologies:

BUT:

Take into account that some of the references should be added <type>pom</type> that they could be found. For instance

    <properties>
       <jax.version>2.3.0</jax.version>
    </properties>

    <dependency>
      <groupId>com.sun.xml.ws</groupId>
      <artifactId>jaxws-ri</artifactId>
      <version>${jax.version}</version>
      <type>pom</type>
    </dependency>
    
    <dependency>
      <groupId>com.sun.xml.bind</groupId>
      <artifactId>jaxb-ri</artifactId>
      <version>${jax.version}</version>
      <type>pom</type>
    </dependency>
    
    <dependency>
      <groupId>javax.transaction</groupId>
      <artifactId>javax.transaction-api</artifactId>
      <version>1.2</version>
    </dependency>
    
     <dependency>
      <groupId>javax.annotation</groupId>
      <artifactId>javax.annotation-api</artifactId>
      <version>1.2</version>
    </dependency>

But with jars that reference to APIs, we may need implementation, so for javax-activation, we may need this pom entry:

     <dependency>
      <groupId>com.sun.activation</groupId>
      <artifactId>javax.activation</artifactId>
      <version>1.2.0</version>
    </dependency>

Take into account that the pom.xml proposed at first includes this points yet.

Comments

Popular posts from this blog

10. JSF How to access my resources files?

Sometimes it is really difficult to access any resources form different Java applications. So let's see some scenarios: 1. Executable jar application in a NO WEB environment. Take into account that this is not a JSF application !!! It is desired to have a property file outside the "jar file" so that we can change properties when needed. For instance, we will place the properties file in the same folder that the "jar file" lies. To access the folder where the jar is, the trick is to access the folder where the compiled classed are placed and scale 3 folders . (Oh! rather strange, if anybody knows a better idea.., he will be welcome). Here is a simple code. The name of the class containing the code is ThisClass, and we have created a Property class that feeds with a file in the same folder that the" jar file" 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 /** * Gets the folder where resides the executable

2. Create a Maven JSF project and a simple login page

Updated on Oct-25-2107 0. Introduction Remember to install previously: Java JDK 8 Eclipse Oxygen Lombok  Apache Tomcat 9 1. Create a Maven Project In the top menu select : File - New - Maven Project Press Next Now fill the next form as follows It is important to select: Group id: org.ximodante.jsf  (or another packet you like) Packaging: war Artifact Id and Name: JSFv02 or any name for the project Press Finish 2. The pom.xml file Eclipse complains about the simple generated file. It seems that a web.xml is required if the packaging is selected to war. The simple generated file is  1 2 3 4 5 6 7 8 9 <project xmlns= "http://maven.apache.org/POM/4.0.0" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation= "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" > <modelVersion> 4.0.0 </modelVersion> <groupId> org.ximodante

9. JSF: Solving common problems

1. Target Unreachable, identifier [bean] resolved to null When you reference a bean in a xhtml file with "#{bean.method}" and get this error, you should verify that: The bean implements Serializable . The references (javax.servlet-api.4.0.0, javax.faces.2.3.3,  javax.el.api.3.0.1, org.primefaces.6.1) have been selected in your pom.xml You have created the files bean.xml and faces-config.xml in the webapp/WEB-INF folder You have used the correct annotations from CDI  (javax.inject.Named and javax.enterprise.context.SessionScoped, ...) and not ManagedBean or jsf2.2 scopes. 2. Bean declaring a passivating scope must be passivation capable This error causes server not starting and fills up the console with long chained exceptions. It is very annoying. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 SEVERE: A child container failed during start java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start co