1

Trying to get "Primefaces Showcase autocomplete" running I'm facing a problem that "CountryService.java" won't load. I copied it from (https://www.primefaces.org/showcase/ui/input/autoComplete.xhtml?jfwid=52f7c). It looks like it's caused by the "@Inject private CountryService countryService;" not functioning.

In autoCompleteView.java I added a printline to the method completeText:

public List completeText(String query) { System.out.println(thisClassName + ": completeText (1) - " + query + " / " + countryService);}

When running it shows this: "AutoCompleteView: completeText (1) - ned / null", meaning 'countryService' has not been initialized. Could it be an CDI issue? I'm using 'tomee-8.0.6-webprofile' that according to documentation should support CDI! Or must I install CDI2.0 seperately into my java library lists?

I tried the @BalusC solution of: How to inject FacesContext with JSF 2.3 and TomEE?

Maybe something is missing in my installation? :

Eclipse 18-12;

Apache Tomcat (TomEE)/9.0.41 (8.0.6);

JSF2.3;

myfaces2.3;

Primefaces 8.0;

Could anyone help me please? I would appreciate that very much!

Erik DdW
  • 71
  • 1
  • 5

1 Answers1

1

Found the right answer in this answer

I added "beans.xml" to my WEB-INF directory:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee 
                           http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
       version="1.1" bean-discovery-mode="all">

</beans>
Dharman
  • 21,838
  • 18
  • 57
  • 107
Erik DdW
  • 71
  • 1
  • 5