为什么Target无法访问,标识符在weblogic上解析为null
人们将此标记为重复项,但如果您查看下面的答案,则会看到为什么它不同。为什么Target无法访问,标识符在weblogic上解析为null
我正在使用STS,weblogic和primefaces 5.3,并且我不断收到错误“Target Unreachable,标识符'dtObservationsView'解析为null”。
这是一个使用REST的应用程序。
该应用程序在tomcat上运行得非常好,但是当我部署到weblogic时没有运行。
我已通读在dentifying and solving javax.el.PropertyNotFoundException: Target Unreachable张贴的回应,但它没有屈服任何解决方案的作品。
我也试过WebLogic Reference,但我仍然得到相同的错误。
的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;
}
}
堆栈跟踪:
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
下列文件如何通过新手使用方法PRIMEFACES在WebLogic 。
网络链接:
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://en.wikipedia.org/wiki/Spring_Framework
个版本:
Primefaces 5.3
春3.1.1
春天工具套件(STS)版本:3.8.4.RELEASE
的Java 1.7
的Weblogic 11gR1中
Pivotal tc Server Developer Edition v3。2,这包含Tomcat的
术语和定义:
CDI: 这是从上面的第一个链接:
上下文和依赖注入的Java EE
上下文和依赖注入的Java EE (CDI)是帮助将Java EE平台的Web层和事务层组织在一起的几个Java EE特性之一。 CDI是一组服务,它们一起使用,使开发人员可以轻松地在Web应用程序中使用企业bean和JavaServer Faces技术。 设计用于有状态对象,CDI也有许多更广泛的用途,使开发人员可以灵活地将各种组件以松散耦合但类型安全的方式进行集成。
SPRING: 这从上面的第5个链接: Spring框架是一个应用程序框架和Java平台的控制容器的反转。该框架的核心功能可以被任何Java应用程序使用, ,但是在Java EE(企业版)平台之上有扩展来构建Web应用程序。 虽然框架没有强加任何特定的编程模型,但它作为替代 替代或甚至添加Enterprise JavaBeans(EJB)模型的替代品而在Java社区中变得流行起来。 Spring框架是开源的。
注:
我给上面的定义表明,有两个地方,当你部署primefaces到Weblogic当你使用Spring开发有可能产生依赖注入。
一个是CDI,另一个是Spring。理解这一点很重要,因为至少从我阅读和经历过的情况来看,不应该混合春季和CDI的注释。
当涉及到primefaces部署而非Weblogic时,Tomcat更为宽容。我的应用程序在tomcat上工作得很好,但使用Weblogic时,我遇到了各种问题。 第一个是javax-el-propertynotfoundexception- target-unreachable异常。上面的第二个链接,对你需要做的 做一个相当不错的定义,让事情与primefaces正常工作。
第三个链接是我的帖子到stackflow,在那里我正在寻找一个答案,我用Weblogic得到的异常。如果我能以可读的 格式将该文档作为答案发布,我会这样做。
架构:
因此,有一个类似的架构,我认为反映了Spring MVC模式primefaces。在Spring MVC中,控制器是代码,只要 是对应用程序服务器(即Tomcat或Weblogic)发出的HTTP请求就会被调用。如果您希望使用EJB,那么需要Weblogic,因为Tomcat只是servlet容器,并且不会理解EJB。由于Spring在servlet中完成了所有工作,因此Tomcat与Spring很好地协作。所以,如果你不使用EJB,我相信Tomcat是开源的方式,因为它是开源的,不需要许可费用。
但在我的情况下,客户端只允许Weblogic,因此我开始处理的问题。
MVC模式中的下一层是服务层,下面是存储库层。所以它是Controller - > Service - > Repository。
通常在Spring MVC中,控制器使用@Autowired自动连接Serivice,服务自动装载存储库,这将使@Entity bean的用户。 Hibernate中的实体bean只是POJO的@Entity注解。这些对象被持久化到数据库中。
在Primefaces中,至少基于我有限的知识,有一个ManagedBean和一个ManagedProperty。
Primefaces和Spring都有注释,它们在java中注入了这些不同对象的关系。
在Spring的情况下,您有@Controller或@RestController,@Service和@Repository。这不是一个完整的列表,但它是我通常使用的列表。 在Primefaces中,您拥有@ManagedBean和@ManagedProperty。可能有其他的,但这是我用过的。一个@ManagedProperty就像 Spring中的@Autowired。
所以一个ManagedBean是这样的:
@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;
...
}
你会注意到一个ManagedBean “autowires” 的ManagedProperty它需要。
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中:我不认为你需要这一个。这应该只适用于CDI,如上面的第二个链接所述。
<?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>
错误,以避免:
确保您实现Serializable你所有的托管bean。
-
确保您为所有 ManagedProperty创建了获取者和设置者,以便java反射可以从 获取并设置它们。
下面是一个例子:
@ManagedBean(name = "observationService")
@ApplicationScoped 公共类ObservationServiceImpl实现ObservationService,序列化{
/** * */ 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(); }
}
如果你没有创建setter方法和getters,那么Primefaces至少不会工作不在Weblogic中。
在您的@ManagedPropery()中,确保使用use'value =“bean name”',而不仅仅是@ManagedProperty(“bean name”)。
用@ManagedBean(name =“bean name”)命名所有托管的bean。我并不熟悉范围规则。
请勿将Spring注释与Primefaces注释混合使用。
-
确保您使用的是javax.faces.bean注释:
import javax.faces.bean.ApplicationScoped; import javax.faces.bean.ManagedBean; import javax.faces.bean.ManagedProperty;
不要使用:
import org.springframework.web.bind.annotation.*
在STS,确保项目属性 - > Spring - > Project Builders - >如果您在servlet-context.xml文件中添加了AOP名称空间,则会禁用AOP参考模型构建器。
我还需要帮助。我看到的例子处理了EJB,而不是spring,而不是weblogic。为什么它在tomcat上工作,但不是weblogic?托管bean不会在weblogic中实例化。如果您能指出我的意见,我会很乐意尝试解决方案。 – DenisMP
祝你好运然后...我将删除我无用的评论,并将其标记为最有问题的问题的副本,然后您不明白为什么它没有帮助 – Kukeltje
也与网络逻辑相关https://*.com/ q/34092269/5292302 –