Why is Target Unreachable, identifier resolved to null on weblogic [duplicate]
Asked Answered
D

1

-1

People are marking this a duplicate, but if you look at my answer below, you will see why it is different.

I am using STS, weblogic, and primefaces 5.3 and I keep getting the error "Target Unreachable, identifier 'dtObservationsView' resolved to null".

This is a spring application using REST.

The application runs perfectly well on tomcat, but not when I deploy to weblogic.

I have read through the posted response at dentifying and solving javax.el.PropertyNotFoundException: Target Unreachable but it has not yielded any solution that works.

I have also tried WebLogic Reference, but I am still getting the same error.

pom.xml:

    <?xml version="1.0" encoding="UTF-8"?>
<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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>gov.fda</groupId>
    <artifactId>pcocar</artifactId>
    <name>pcocar_car_web</name>
    <packaging>war</packaging>
    <version>1.0.0-BUILD-SNAPSHOT</version>
    <properties>
        <java-version>1.7</java-version>
        <org.springframework-version>3.1.1.RELEASE</org.springframework-version>
        <org.aspectj-version>1.6.10</org.aspectj-version>
        <org.slf4j-version>1.6.6</org.slf4j-version>
    </properties>
    <dependencies>
        <!-- Spring -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>${org.springframework-version}</version>
            <exclusions>
                <!-- Exclude Commons Logging in favor of SLF4j -->
                <exclusion>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                 </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>

        <!-- AspectJ -->
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjrt</artifactId>
            <version>${org.aspectj-version}</version>
        </dependency>   

        <!-- Logging -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${org.slf4j-version}</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jcl-over-slf4j</artifactId>
            <version>${org.slf4j-version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>${org.slf4j-version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.15</version>
            <exclusions>
                <exclusion>
                    <groupId>javax.mail</groupId>
                    <artifactId>mail</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>javax.jms</groupId>
                    <artifactId>jms</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.sun.jdmk</groupId>
                    <artifactId>jmxtools</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.sun.jmx</groupId>
                    <artifactId>jmxri</artifactId>
                </exclusion>
            </exclusions>
            <scope>runtime</scope>
        </dependency>

        <!-- @Inject -->
        <dependency>
            <groupId>javax.inject</groupId>
            <artifactId>javax.inject</artifactId>
            <version>1</version>
        </dependency>

        <!-- Servlet -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet.jsp</groupId>
            <artifactId>jsp-api</artifactId>
            <version>2.1</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>

        <!-- Test -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.7</version>
            <scope>test</scope>
        </dependency>
        <!-- Primefaces -->
        <dependency>
            <groupId>org.primefaces</groupId>
            <artifactId>primefaces</artifactId>
            <version>5.3</version>
        </dependency>
        <!-- JSF 2 -->
        <dependency>
            <groupId>com.sun.faces</groupId>
            <artifactId>jsf-impl</artifactId>
            <version>2.2.14</version>
        </dependency>
        <dependency>
            <groupId>com.sun.faces</groupId>
            <artifactId>jsf-api</artifactId>
            <version>2.2.14</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient -->
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>4.5.3</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.jsoup/jsoup -->
        <dependency>
            <groupId>org.jsoup</groupId>
            <artifactId>jsoup</artifactId>
            <version>1.10.3</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.json/json -->
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>20170516</version>
        </dependency>

        <dependency>
            <groupId>com.googlecode.json-simple</groupId>
            <artifactId>json-simple</artifactId>
            <version>1.1.1</version>
        </dependency>

        <dependency>
            <groupId>org.glassfish.web</groupId>
            <artifactId>el-impl</artifactId>
            <version>2.2</version>
        </dependency>

<!--        <dependency>
            <groupId>el.api</groupId>
            <artifactId>el-api</artifactId>
            <version>2.2</version>
        </dependency>
        <dependency>
            <groupId>el.impl</groupId>
            <artifactId>el-impl</artifactId>
            <version>2.2</version>
        </dependency> -->
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-eclipse-plugin</artifactId>
                <version>2.9</version>
                <configuration>
                    <additionalProjectnatures>
                        <projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
                    </additionalProjectnatures>
                    <additionalBuildcommands>
                        <buildcommand>org.springframework.ide.eclipse.core.springbuilder</buildcommand>
                    </additionalBuildcommands>
                    <downloadSources>true</downloadSources>
                    <downloadJavadocs>true</downloadJavadocs>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.5.1</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                    <compilerArgument>-Xlint:all</compilerArgument>
                    <showWarnings>true</showWarnings>
                    <showDeprecation>true</showDeprecation>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.2.1</version>
                <configuration>
                    <mainClass>org.test.int1.Main</mainClass>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

web.xml

    <?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

    <!-- The definition of the Root Spring Container shared by all Servlets and Filters -->
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/spring/root-context.xml</param-value>
    </context-param>

    <!-- Creates the Spring Container shared by all Servlets and Filters -->
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

    <!-- Processes application requests -->
    <servlet>
        <servlet-name>appServlet</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>/WEB-INF/spring/appServlet/servlet-context.xml</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>appServlet</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>

    <!-- Change to "Production" when you are ready to deploy -->
    <context-param>
        <param-name>javax.faces.PROJECT_STAGE</param-name>
        <param-value>Development</param-value>
    </context-param>

    <!-- Welcome page -->
    <!-- 
    <welcome-file-list>
        <welcome-file>faces/test.xhtml</welcome-file>
    </welcome-file-list>
     -->

<!--     <context-param>
       <param-name>com.sun.faces.enableRestoreView11Compatibility</param-name>
       <param-value>true</param-value>
    </context-param> -->

    <context-param>
        <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
        <param-value>.xhtml</param-value>
    </context-param>

    <!-- Facelets pages will use the .xhtml extension -->
    <context-param>
        <param-name>facelets.VIEW_MAPPINGS</param-name>
        <param-value>*.xhtml</param-value>
    </context-param>

    <mime-mapping>
        <extension>xhtml</extension>
        <mime-type>application/xml</mime-type>
    </mime-mapping>

    <!-- JSF mapping -->
    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.xhtml</url-pattern>
        <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>

    <context-param>
        <description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>
        <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
        <param-value>client</param-value>
    </context-param>
    <listener>
        <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
    </listener>

    <!-- Map these files with JSF -->
<!--     <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.jsf</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.faces</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.xhtml</url-pattern>
    </servlet-mapping> -->


</web-app>

observations.xhtml:

    <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:p="http://primefaces.org/ui">

<h:head>
    <style>
        .blockLabel { display: block; }
    </style>
</h:head>
<h:body>
<h2>PREVENTIVE CONTROLS</h2>
<h3>Food and Drug Administration Corrective Action Report</h3>

<h:form id="observationform">
    <p:inputText id="feiInput" value="#{dtObservationsView.feiNumber}" />
    <p:commandButton value="FEIN Search" id="fein_search"
            process="@this :#{p:component('feiInput')}"
            action="#{dtObservationsView.getObservationsByFein}"
            update="@form" />

    <p:dataTable id="observationAddressId" var="address" value="#{dtObservationsView.addresses}" style="margin-bottom:40px" scrollable="true" draggableColumns="true" resizableColumns="true">
            <f:facet name="header">
            Address for Observations below.
        </f:facet>
        <p:column headerText="FEI NUM" sortBy="#{address.feiNum}">
            <h:outputText value="#{address.feiNum}" />
        </p:column>
        <p:column headerText="DUNS NUM" sortBy="#{address.dunsNum}">
            <h:outputText value="#{address.dunsNum}" />
        </p:column>         
        <p:column headerText="AdrLine1" sortBy="#{address.adrLine1}">
            <h:outputText value="#{address.adrLine1}" />
        </p:column>
        <p:column headerText="AdrLine2" sortBy="#{address.adrLine2}">
            <h:outputText value="#{address.adrLine2}" />
        </p:column>
        <p:column headerText="City" sortBy="#{address.city}">
            <h:outputText value="#{address.city}" />
        </p:column>
        <p:column headerText="State" sortBy="#{address.stateCd}">
            <h:outputText value="#{address.stateCd}" />
        </p:column>       
        <p:column headerText="Zip" sortBy="#{address.zipCd}">
            <h:outputText value="#{address.zipCd}" />
        </p:column>
        <p:column headerText="Country" sortBy="#{address.isoCntryCd}">
            <h:outputText value="#{address.isoCntryCd}" />
        </p:column>
        <p:column headerText="RefCd" sortBy="#{address.refCd.id}">
            <h:outputText value="#{address.refCd.id}" />
        </p:column>
    </p:dataTable>

    <p:dataTable id="addressrefcdId" var="addressrefcd" value="#{dtObservationsView.addressRefCds}" style="margin-bottom:40px" scrollable="true" draggableColumns="true" resizableColumns="true">
        <f:facet name="header">
            Single Column Sort For RefCd for the above Address
        </f:facet>
        <p:column headerText="RefCd ID" sortBy="#{addressrefcd.id}">
            <h:outputText value="#{addressrefcd.id}">
            </h:outputText>
        </p:column>
         <p:column headerText="IsActv" sortBy="#{addressrefcd.isActv}">
            <h:outputText value="#{addressrefcd.isActv}">
            </h:outputText>
        </p:column>  
        <p:column headerText="ModuleId" sortBy="#{addressrefcd.moduleId}">
            <h:outputText value="#{addressrefcd.moduleId}">
            </h:outputText>
        </p:column>          
        <p:column headerText="RefType" sortBy="#{addressrefcd.refType}">
            <h:outputText value="#{addressrefcd.refType}">
            </h:outputText>
        </p:column>     

        <p:column headerText="RefValue" sortBy="#{addressrefcd.refValue}">
            <h:outputText value="#{addressrefcd.refValue}">
            </h:outputText>
        </p:column>


        <p:column headerText="Description" sortBy="#{addressrefcd.description}">
            <h:outputText value="#{addressrefcd.description}">
            </h:outputText>
        </p:column>

        <p:column headerText="cFRCiteLanguage" sortBy="#{addressrefcd.cFRCiteLanguage}">
            <h:outputText value="#{addressrefcd.cFRCiteLanguage}">
            </h:outputText>
        </p:column>

    </p:dataTable>

    <p:dataTable id="observationtableId" var="observation" value="#{dtObservationsView.observations}" style="margin-bottom:40px" scrollable="true" draggableColumns="true" resizableColumns="true">
        <f:facet name="header">
            Single Column Sort For Observations
        </f:facet>
        <p:column headerText="Id" sortBy="#{observation.id}">
            <h:outputText value="#{observation.id}" />
        </p:column>

        <p:column headerText="Description" sortBy="#{observation.citationShortDescription}">
            <h:outputText value="#{observation.citationShortDescription}" />
        </p:column>

        <p:column headerText="DtCrrctnRcvd" sortBy="#{observation.dateCorrectionReceived}">
            <h:outputText value="#{observation.dateCorrectionReceived}">
                  <f:convertDateTime type="date" pattern="yyyy-MM-dd" />
            </h:outputText>
        </p:column>

        <p:column headerText="InspctnEndDt" sortBy="#{observation.inspectionEndDate}">
            <h:outputText value="#{observation.inspectionEndDate}">
                 <f:convertDateTime type="date" pattern="yyyy-MM-dd" />
            </h:outputText>
        </p:column>

        <p:column headerText="InspctnDt" sortBy="#{observation.inspectionDate}">
            <h:outputText value="#{observation.inspectionDate}">
                 <f:convertDateTime type="date" pattern="yyyy-MM-dd" />
            </h:outputText>
        </p:column>

        <p:column headerText="Assgnmnt ID" sortBy="#{observation.assignment.id}">
            <h:outputText value="#{observation.assignment.id}">
            </h:outputText>
        </p:column> 


        <p:column headerText="RefCd ID" sortBy="#{observation.refCd.id}">
            <h:outputText value="#{observation.refCd.id}">
            </h:outputText>
        </p:column> 

    </p:dataTable>



</h:form>

</h:body>
</html>

ObservationsView.java:

    /**
 * 
 */
package gov.fda.furls.fsma.pcocar.primefaces.managedbean.observations;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.SessionScoped;
import javax.faces.bean.ViewScoped;

import gov.fda.furls.fsma.pcocar.primefaces.domain.ActionResponse;
import gov.fda.furls.fsma.pcocar.primefaces.domain.Adr;
import gov.fda.furls.fsma.pcocar.primefaces.domain.Assignment;
import gov.fda.furls.fsma.pcocar.primefaces.domain.Atchmnt;
import gov.fda.furls.fsma.pcocar.primefaces.domain.AtchmntDetail;
import gov.fda.furls.fsma.pcocar.primefaces.domain.Cntct;
import gov.fda.furls.fsma.pcocar.primefaces.domain.Evidence;
import gov.fda.furls.fsma.pcocar.primefaces.domain.Observation;
import gov.fda.furls.fsma.pcocar.primefaces.domain.Prfl;
import gov.fda.furls.fsma.pcocar.primefaces.domain.PrflDetail;
import gov.fda.furls.fsma.pcocar.primefaces.domain.RefCd;
import gov.fda.furls.fsma.pcocar.service.AddressService;
import gov.fda.furls.fsma.pcocar.service.ObservationService;

/**
 * @author Denis.Putnam
 *
 */
@ManagedBean(name="dtObservationsView")
//@ViewScoped
@SessionScoped
public class ObservationsView implements Serializable {

    /**
     * 
     */
    private static final long serialVersionUID = -3273738869247166831L;

    private Set<Observation> observations;

    private Set<Adr> addresses;

    private Set<Assignment> assignments;

    private Set<Prfl> profiles;

    private Set<PrflDetail> profileDetails;

    private Set<Cntct> contacts;

//  private List<Citation> citations;

    private Set<Evidence> evidences;

    private Set<ActionResponse> actionResponses;

    private Set<ActionResponse> evidenceActionResponses;

    private Set<AtchmntDetail> attachmentDetails;

    private Set<Atchmnt> attachments;

    private Set<RefCd> refCds;

    private Set<RefCd> addressRefCds;

    private Set<RefCd> observationRefCds;

    private Set<RefCd> attachmentRefCds;

    @ManagedProperty("#{observationService}")
    private ObservationService observationService;

    @ManagedProperty("#{addressService}")
    private AddressService addressService;

    private String feiNumber;

    public ObservationsView(){
        super();
    }

    @PostConstruct
    public void init() {
        this.observations = new HashSet<Observation>();
        this.feiNumber = new String();
    }

//    @PostConstruct
//    public void init() {
//        try {
//          this.observations = new HashSet<Observation>(this.observationService.getObservations());
//      } catch (Exception e) {
//          // TODO Auto-generated catch block
//          e.printStackTrace();
//      }
//    }

    public Set<RefCd> getRefCds() {
        return refCds;
    }

    public void setRefCds(Set<RefCd> refCds) {
        this.refCds = refCds;
    }

//  public List<Citation> getCitations() {
//      return citations;
//  }
//
//  public void setCitations(List<Citation> citations) {
//      this.citations = citations;
//  }


    public AddressService getAddressService() {
        return addressService;
    }

    public void setAddressService(AddressService addressService) {
        this.addressService = addressService;
    }

    public void setObservationService(ObservationService service) {
        this.observationService = service;
    }

    public ObservationService getObservationService(){
        return this.observationService;
    }

    public Set<Observation> getObservations(){
        return this.observations;
    }

    public void getObservationsByFein(){
        if( this.feiNumber != null ){
            try {
                this.observations = new HashSet<Observation>(this.observationService.getObservationsByFein(new Long(feiNumber)));
                this.addresses = new HashSet<Adr>(this.addressService.getAddressesByFein(new Long(feiNumber)));
                this.assignments = new HashSet<Assignment>();
                this.profiles = new HashSet<Prfl>();
                this.profileDetails = new HashSet<PrflDetail>();
                this.contacts = new HashSet<Cntct>();
                this.refCds = new HashSet<RefCd>();
                this.addressRefCds = new HashSet<RefCd>();
                this.observationRefCds = new HashSet<RefCd>();
                this.attachmentRefCds = new HashSet<RefCd>();
//              this.citations = new HashSet<Citation>();
                this.evidences = new HashSet<Evidence>();
//              this.citationEvidences = new HashSet<Evidence>();
                this.actionResponses = new HashSet<ActionResponse>();
                this.evidenceActionResponses = new HashSet<ActionResponse>();
                this.attachmentDetails = new HashSet<AtchmntDetail>();
                this.attachments = new HashSet<Atchmnt>();
//              Set<Citation> citations = null;
                Set<Evidence> evidences = null;
                Set<ActionResponse> actionResponses = null;
                for( Observation observation: this.observations){
                    Assignment assignment = observation.getAssignment();
                    if( assignment != null && assignment.getId() != null ){
                        this.assignments.add(assignment);
                        Prfl profile = assignment.getProfile();
                        if( profile != null && profile.getId() != null ){
                            this.profiles.add(profile);
                            for( PrflDetail profileDetail: profile.getPrflDetails()){
                                this.profileDetails.add(profileDetail);
                                Cntct contact = profileDetail.getCntct();
                                if( contact != null && contact.getId() != null ){
                                    this.contacts.add(contact);
                                    RefCd refCd = contact.getRefCd();
                                    if( refCd != null ){
                                        this.refCds.add(refCd);
                                    }
                                }
                            }
                        }
                    }
                    this.observationRefCds.add(observation.getRefCd());
//                  citations = observation.getCitations();
//                  this.citations.addAll(citations);
//                  for( Citation citation: this.citations ){
//                      if( citation.getEvidences() != null ){
//                          this.citationEvidences.addAll(citation.getEvidences());
//                      }
//                  }
                    actionResponses = observation.getActionResponses();
                    this.actionResponses.addAll(actionResponses);

                    evidences = observation.getEvidences();
                    Set<ActionResponse> evidenceActionResponses = null;
                    Set<AtchmntDetail> attachmentDetails = null;

                    for( Evidence evidence: evidences){
                        evidenceActionResponses = evidence.getActionResponses();
                        attachmentDetails = evidence.getAtchmtDet();
                        this.evidenceActionResponses.addAll(evidenceActionResponses);
                        this.attachmentDetails.addAll(attachmentDetails);
                        for( AtchmntDetail attachmentDetail: attachmentDetails ){
                            this.attachments.add(attachmentDetail.getAtchmnt());
                        }
                    }
                    for( Atchmnt attachment: this.attachments ){
                        this.attachmentRefCds.add(attachment.getRefCd());
                    }
                    this.evidences.addAll(evidences);
                }
                for( Adr address: this.addresses ){
                    RefCd refCd = address.getRefCd();
                    this.addressRefCds.add(refCd);                  
                }
            } catch (Exception e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
//        return this.observations;     
    }

    public Set<Prfl> getProfiles() {
        return profiles;
    }

    public void setProfiles(Set<Prfl> profiles) {
        this.profiles = profiles;
    }

    public void setObservations(Set<Observation> observations){
        this.observations = observations;
    }

    public String getFeiNumber() {
        return feiNumber;
    }

    public void setFeiNumber(String feiNumber) {
        this.feiNumber = feiNumber;
    }

    public Set<Adr> getAddresses() {
        return addresses;
    }

    public void setAddresses(Set<Adr> addresses) {
        this.addresses = addresses;
    }

    public Set<Assignment> getAssignments() {
        return assignments;
    }

    public void setAssignments(Set<Assignment> assignments) {
        this.assignments = assignments;
    }

    public Set<PrflDetail> getProfileDetails() {
        return profileDetails;
    }

    public void setProfileDetails(Set<PrflDetail> profileDetails) {
        this.profileDetails = profileDetails;
    }

    public Set<Cntct> getContacts() {
        return contacts;
    }

    public void setContacts(Set<Cntct> contacts) {
        this.contacts = contacts;
    }

    public Set<Evidence> getEvidences() {
        return evidences;
    }

    public void setEvidences(Set<Evidence> evidences) {
        this.evidences = evidences;
    }

    public Set<ActionResponse> getActionResponses() {
        return actionResponses;
    }

    public void setActionResponses(Set<ActionResponse> actionResponses) {
        this.actionResponses = actionResponses;
    }

    public Set<ActionResponse> getEvidenceActionResponses() {
        return evidenceActionResponses;
    }

    public void setEvidenceActionResponses(Set<ActionResponse> evidenceActionResponses) {
        this.evidenceActionResponses = evidenceActionResponses;
    }

    public Set<RefCd> getAddressRefCds() {
        return addressRefCds;
    }

    public void setAddressRefCds(Set<RefCd> addressRefCds) {
        this.addressRefCds = addressRefCds;
    }

    public Set<RefCd> getObservationRefCds() {
        return observationRefCds;
    }

    public void setObservationRefCds(Set<RefCd> observationRefCds) {
        this.observationRefCds = observationRefCds;
    }

    public Set<AtchmntDetail> getAttachmentDetails() {
        return attachmentDetails;
    }

    public void setAttachmentDetails(Set<AtchmntDetail> attachmentDetails) {
        this.attachmentDetails = attachmentDetails;
    }

    public Set<Atchmnt> getAttachments() {
        return attachments;
    }

    public void setAttachments(Set<Atchmnt> attachments) {
        this.attachments = attachments;
    }

    public Set<RefCd> getAttachmentRefCds() {
        return attachmentRefCds;
    }

    public void setAttachmentRefCds(Set<RefCd> attachmentRefCds) {
        this.attachmentRefCds = attachmentRefCds;
    }

}

stack trace:

    WARNING: JSF1091: No mime type could be found for file images/ui-icons_38667f_256x240.png.  To resolve this, add a mime-type mapping to the applications web.xml.
Jul 31, 2017 2:07:05 PM com.sun.faces.context.PartialViewContextImpl processPartial
INFO: javax.el.PropertyNotFoundException: //C:/Users/Denis.Putnam/Documents/workspace-sts-3.8.4.RELEASE/pcocar_car_web/src/main/webapp/observations.xhtml @20,71 value="#{dtObservationsView.feiNumber}": Target Unreachable, identifier 'dtObservationsView' resolved to null
Diamine answered 31/7, 2017 at 18:31 Comment(7)
I still need help. The examples that I saw dealt with EJB's and not spring and not weblogic. Why does it work on tomcat, but not weblogic? The managed bean does not get instantiated in weblogic. I will be happy to try a solution if you can point me to it.Diamine
Good luck then... I will remove my unhelpful comments and just mark it as a duplicate of the most upvoted question then since you made not clear why it was not helpfulKaine
also related to web logic https://mcmap.net/q/17966/-javax-el-propertynotfoundexception-target-unreachable-identifier-bean-resolved-to-null/5292302Maya
Thank you Peter. Do you know why the exploded ear would make it work?Diamine
No, sorry, I was just reviewing your question and while doing this trying to find something helpful that is related to the difference between tomcat and weblogic, you probably have a problem in 1c. Where's the backing bean class? relative to the possibile duplicate.Maya
Having Spring (to) manage beans requires those beans to be Spring managed beans designating with Spring related annotations (or CDI, if you want CDI to manage your beans). Currently, the given bean DtObservationsView is a JSF managed bean being managed by the JSF framework which the Spring framework is unaware of as both of them have their own separate contexts. It is already mentioned in the link you posted, "In case it's Spring who's managing the bean via @Component, then you need to make sure of the following".Scornful
Thank you Tiny. This actually help me expose my problems. I am going to try and answer this, base on what I discovered.Diamine
D
0

THE FOLLOWING DOCUMENTS HOW TO USE PRIMEFACES ON WEBLOGIC by Newbie.

WEB LINKS:

https://docs.oracle.com/javaee/7/tutorial/cdi-basic.htm

Identifying and solving javax.el.PropertyNotFoundException: Target Unreachable

Why is Target Unreachable, identifier resolved to null on weblogic

https://www.primefaces.org/

https://en.wikipedia.org/wiki/Spring_Framework

VERSIONS:

Primefaces 5.3

Spring 3.1.1

Spring Tool Suite (STS) Version: 3.8.4.RELEASE

Java 1.7

Weblogic 11gR1

Pivotal tc Server Developer Edition v3.2, this contains Tomcat

TERMS and DEFINITIONS:

CDI: This is from the first link above:

Contexts and Dependency Injection for Java EE

Contexts and Dependency Injection for Java EE (CDI) is one of several Java EE features that help to knit together the web tier and the transactional tier of the Java EE platform. CDI is a set of services that, used together, make it easy for developers to use enterprise beans along with JavaServer Faces technology in web applications. Designed for use with stateful objects, CDI also has many broader uses, allowing developers a great deal of flexibility to integrate various kinds of components in a loosely coupled but typesafe way.

SPRING: This from the 5th link above: The Spring Framework is an application framework and inversion of control container for the Java platform. The framework's core features can be used by any Java application, but there are extensions for building web applications on top of the Java EE (Enterprise Edition) platform. Although the framework does not impose any specific programming model, it has become popular in the Java community as an alternative to, replacement for, or even addition to the Enterprise JavaBeans (EJB) model. The Spring Framework is open source.

NOTE:

I gave the above definitions to show that there are two places where dependency injection can occur when you deploy primefaces to Weblogic when you are developing with Spring.
One is with CDI and the other is with Spring. It is important to understand this because, at least from I have read and experienced, you should not mix the annotations for spring and CDI.

Tomcat is much more forgiving when it comes to primefaces deployment than Weblogic. My application worked perfectly fine on tomcat, but with Weblogic, I had all kinds of problems. The first one being the javax-el-propertynotfoundexception-target-unreachable exception. The second link above, goes into a pretty good definition of what you need to do make things work properly with primefaces.

The 3rd link is my post to stackflow, where I was seeking an answer the exception I was getting with Weblogic. If I can get this document posted as an answer there in a readable format, I will do that.

ARCHITECTURE:

So there is a similar architecture with primefaces that I believe mirrors the Spring MVC pattern. In Spring MVC, the Controller is code that gets invoked whenever there is an HTTP request made to the application server, i.e., Tomcat or Weblogic. Weblogic is needed if you wish to user EJB's because Tomcat is servlet container only, and doesn't understand EJBs. Tomcat works very well with Spring since Spring does everything in servlets. So, if you are not using EJBs, I believe that Tomcat is the way to go since it is open source and requires no licensing fees.

In my case, however, the client is only allowing Weblogic, hence the issues I started dealing with.

The next layer in the MVC pattern is the service layer and below that is the repository layer. So it is Controller -> Service -> Repository.

Normally in Spring MVC, the Controller autotwires the Serivice with the @Autowired, and the Service autowires the Repository, which will make user of the @Entity beans. Entity beans in Hibernate are just POJO's with the @Entity annotation. These object get persisted to the database.

In Primefaces, at least based on my limited knowledge, there is a ManagedBean and a ManagedProperty.

Both Primefaces and Spring have annotations that inject the relationships of these various objects in java.

In the case of Spring, you have @Controller or @RestController, @Service, and @Repository. This is not a complete list, but it is the ones I typically use. In Primefaces, you have @ManagedBean and @ManagedProperty. There may be others, but this is what I have used. A @ManagedProperty is like the @Autowired in Spring.

So a ManagedBean is like this:

    @ManagedBean(name="observationsView", eager=true)
public class ObservationsView implements Serializable {

    @ManagedProperty( value = "#{observationService}")
    private ObservationService observationService;

    ...
}

@ManagedBean(name = "observationService")
@ApplicationScoped
public class ObservationServiceImpl implements ObservationService, Serializable {
    @ManagedProperty( value = "#{observationDao}")
    private ObservationDao observationDao;

    ...
}

@ManagedBean(name = "observationDao")
@ApplicationScoped
public class ObservationDaoImpl implements ObservationDao, Serializable{

    @ManagedProperty( value = "#{daoHelper}")
    private DaoHelper daoHelper;

    ...

}

You will note that a ManagedBean "autowires" the ManagedProperty that it needs.

FILES: WEB-INF/weblogic.xml:

    <?xml version="1.0" encoding="UTF-8"?>
<wls:weblogic-web-app xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.3/weblogic-web-app.xsd">
    <wls:container-descriptor>
        <!--<wls:index-directory-enabled>true</wls:index-directory-enabled>  -->
        <wls:prefer-application-packages>
            <wls:package-name>org.slf4j</wls:package-name>
            <wls:package-name>org.springframework.*</wls:package-name>
        </wls:prefer-application-packages>
    </wls:container-descriptor>
    <wls:context-root>pcocar</wls:context-root>
    <wls:weblogic-version>10.3.6</wls:weblogic-version>
</wls:weblogic-web-app>

WEB-INF/faces-config.xml:
<?xml version="1.0" encoding="UTF-8"?>
<faces-config version="2.0" xmlns="http://java.sun.com/xml/ns/javaee"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd">
    <application>
        <el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver>     
    </application>
</faces-config>

WEB-INF/beans.xml: I don't think you need this one. This should only be for CDI as described in the 2nd link above.

    <?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>

MISTAKES TO AVOID:

  1. Make sure that you implement the Serializable for all your managed beans.

  2. Make sure that you create the getters and setters for all of the ManagedProperty's, so that the java reflection can get and set them.

    Here is an example:

    @ManagedBean(name = "observationService")
    

    @ApplicationScoped public class ObservationServiceImpl implements ObservationService, Serializable {

    /**
     * 
     */
    private static final long serialVersionUID = -7242896804221503769L;
    
    /**
     * @return the observationDao
     */
    public ObservationDao getObservationDao() {
        return observationDao;
    }
    
    /**
     * @param observationDao the observationDao to set
     */
    public void setObservationDao(ObservationDao observationDao) {
        this.observationDao = observationDao;
    }
    
    @ManagedProperty( value = "#{observationDao}")
    private ObservationDao observationDao;
    
    public List<Observation> getObservationsByFein( Long fein ) throws Exception{
        return this.observationDao.findByFein(fein);
    }
    
    public List<Observation> getObservations() throws Exception{
        return this.observationDao.findAll();
    }
    

    }

If you don't create the setters and getters, then Primefaces will not work, at least not in Weblogic.

  1. On your @ManagedPropery(), make sure use use 'value = "bean name"', not just @ManagedProperty("bean name").

  2. Name all your managed beans with the @ManagedBean(name = "bean name"). I am not familiar with the scoping rules.

  3. Do not mix the Spring annotation with the Primefaces annotations.

  4. Make sure that you are using the javax.faces.bean annotations:

    import javax.faces.bean.ApplicationScoped;
    
    import javax.faces.bean.ManagedBean;
    
    import javax.faces.bean.ManagedProperty;
    

    Do not use the:

    import org.springframework.web.bind.annotation.*
    

In STS, make sure that the project Properties -> Spring -> Project Builders -> AOP Reference Model Builder is disabled if you added the AOP namespace in the servlet-context.xml file.

Diamine answered 3/8, 2017 at 16:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.