Я создал класс Java в Eclipse, Java EE IDE (Luna Release 2 (4.4.2) и Java jre1.8.0_66Неразрешенные проблемы с компиляцией: тип java.lang.String не может быть разрешен. . Неявный конструктор Object() не определен
package com.luv2code.jsf.hello;
import javax.faces.bean.ManagedBean;
@ManagedBean
public class Student {
private String sfirstName;
private String slastName;
// create a no-arg constructor
public Student() {
}
public String getFirstName() {
return sfirstName;
}
public void setFirstName(String sfirstName) {
this.sfirstName = sfirstName;
}
public String getLastName() {
return slastName;
}
public void setLastName(String slastName) {
this.slastName = slastName;
}
// define public getter and setter methods to expose properties of the managed Bean
}
Ошибка я получаю:
HTTP Status 500- Unresolved compilation problems
type Exception report
message unresolved compilation problem
description The server encountered an internal error that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Unresolved compilation problems:
The type java.lang.String cannot be resolved. It is indirectly referenced from required .class files
String cannot be resolved to a type
String cannot be resolved to a type
Implicit super constructor Object() is undefined. Must explicitly invoke another constructor
String cannot be resolved to a type
String cannot be resolved to a type
String cannot be resolved to a type
String cannot be resolved to a type
String cannot be resolved to a type
String cannot be resolved to a type
String cannot be resolved to a type
String cannot be resolved to a type
javax.faces.webapp.FacesServlet.service(FacesServlet.java:659)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
root cause
java.lang.Error: Unresolved compilation problems:
The type java.lang.String cannot be resolved. It is indirectly referenced from required .class files
String cannot be resolved to a type
String cannot be resolved to a type
Implicit super constructor Object() is undefined. Must explicitly invoke another constructor
String cannot be resolved to a type
String cannot be resolved to a type
String cannot be resolved to a type
String cannot be resolved to a type
String cannot be resolved to a type
String cannot be resolved to a type
String cannot be resolved to a type
String cannot be resolved to a type
com.luv2code.jsf.hello.Student.<init>(Student.java:1)r
com.luv2code.jsf.hello.Student.<init>(Student.java:1)
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
java.lang.reflect.Constructor.newInstance(Unknown Source)
java.lang.Class.newInstance(Unknown Source)
com.sun.faces.mgbean.BeanBuilder.newBeanInstance(BeanBuilder.java:186)
com.sun.faces.mgbean.BeanBuilder.build(BeanBuilder.java:100)
com.sun.faces.mgbean.BeanManager.createAndPush(BeanManager.java:409)
com.sun.faces.mgbean.BeanManager.create(BeanManager.java:269)
com.sun.faces.el.ManagedBeanELResolver.resolveBean(ManagedBeanELResolver.java:244)
com.sun.faces.el.ManagedBeanELResolver.getValue(ManagedBeanELResolver.java:116)
com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)
com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)
org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:80)
org.apache.el.parser.AstValue.getValue(AstValue.java:137)
org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:184)
com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109)
javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:194)
javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:182)
javax.faces.component.UIOutput.getValue(UIOutput.java:174)
javax.faces.component.UIInput.getValue(UIInput.java:291)
com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getValue(HtmlBasicInputRenderer.java:205)
com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue(HtmlBasicRenderer.java:355)
com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd(HtmlBasicRenderer.java:164)
javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:924)
javax.faces.component.UIComponent.encodeAll(UIComponent.java:1863)
javax.faces.render.Renderer.encodeChildren(Renderer.java:176)
javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:894)
javax.faces.component.UIComponent.encodeAll(UIComponent.java:1856)
javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:443)
com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120)
com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:219)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:647)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
и если я парить над String, я вижу
String cannot be resolved to a type
и если я парить над Student
(в конструктор без аргументов) Я вижу:
Implicit constructor Object() is undefined. Must explicitly invoke another constructor.
Я не уверен, почему это не позволит мне использовать приватную String in m Student class. Может ли кто-нибудь объяснить это или предложить мне какое-нибудь предложение?
Читали ли вы ошибки OP получили? Ничто из этого не связано с JSF. OP просто полностью испортил конфигурацию IDE. Я отредактировал вопрос, чтобы уменьшить нерелевантный шум, чтобы он лучше сфокусировался. – BalusC