- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我尝试基于JSF和hibernate做一个休息服务。数据库在 Jbossstandalone.xml 中指定。但是应该给我 MediaType.APPLICATION_JSON 的 Url 却给了我一个 Nullpointer 。de.bht.server/rest/resource/json
package de.bht.server.jax;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import com.database.Service;
import com.database.SurveyQuestion;
@Path("/resource")
public class Resource {
@Inject
private Service service;
// This method is called if Json request
@GET
@Path("/json")
@Produces(MediaType.APPLICATION_JSON)
public List<SurveyQuestion> getJson() {
System.out.println("Resource: " + service);
return service.getAllQuestions();
}
@GET
@Path("/test")
@Produces(MediaType.APPLICATION_JSON)
public List<SurveyQuestion> getTestJson() {
ArrayList<SurveyQuestion> list = new ArrayList<SurveyQuestion>();
SurveyQuestion sq = new SurveyQuestion();
sq.setFreetext(true);
sq.setId(5l);
sq.setIdx(6);
sq.setMandatory(true);
sq.setMultiplechoice(true);
sq.setSheet_id(7l);
sq.setTitle("What's app?");
for (int i = 0; i < 3; ++i)
list.add(sq);
return list;
}
}
我的休息应用程序
package de.bht.server.jax;
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;
@ApplicationPath("/rest")
public class RestApplication extends Application {
}
我的注入(inject)服务
package com.database;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
@Stateless
public class Service {
@PersistenceContext
private EntityManager em;
public List<SurveyQuestion> getAllQuestions() {
System.out.println("Service: " + em);
final Query query = this.em.createNamedQuery("getWholeTable");
System.out.println("ServicePrint: " + query);
return query.getResultList();
}
}
还有我尝试绘制的 Pojo
package com.database;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
@Entity
@NamedQuery(name = "getWholeTable", query = "select t from SurveyQuestion t")
@Table(name = "survey_question", schema = "tnt_test")
public class SurveyQuestion implements Serializable {
/**
*
*/
private static final long serialVersionUID = 4571690522451469184L;
@Id
@GeneratedValue
@Column(name = "id")
private Long id;
@Column(name = "freetext")
private boolean freetext;
@Column(name = "idx")
private Integer idx;
@Column(name = "mandatory")
private boolean mandatory;
@Column(name = "multiplechoice")
private boolean multiplechoice;
@Column(name = "title")
private String title;
@Column(name = "sheet_id")
private Long sheet_id;
public SurveyQuestion() {
}
public boolean getFreetext() {
return freetext;
}
public void setFreetext(boolean freetext) {
this.freetext = freetext;
}
public Integer getIdx() {
return idx;
}
public void setIdx(Integer idx) {
this.idx = idx;
}
public boolean getMandatory() {
return mandatory;
}
public void setMandatory(boolean mandatory) {
this.mandatory = mandatory;
}
public boolean getMultiplechoice() {
return multiplechoice;
}
public void setMultiplechoice(boolean multiplechoice) {
this.multiplechoice = multiplechoice;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public Long getSheet_id() {
return sheet_id;
}
public void setSheet_id(Long sheet_id) {
this.sheet_id = sheet_id;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
@Override
public String toString() {
return "SurveyQuestion ,id=" + id + ", freetext=" + freetext + ", idx="
+ idx + ", mandatory=" + mandatory + ", multiplechoice="
+ multiplechoice + ", title=" + title + ", sheet_id="
+ sheet_id;
}
}
我的堆栈跟踪
2013-12-25 13:12:53,075 INFO [org.jboss.modules] JBoss Modules version 1.1.3.GA
2013-12-25 13:12:53,310 INFO [org.jboss.msc] JBoss MSC version 1.0.2.GA
2013-12-25 13:12:53,388 INFO [org.jboss.as] JBAS015899: JBoss AS 7.2.0.Alpha1-SNAPSHOT "Steropes" starting
2013-12-25 13:12:54,496 INFO [org.jboss.as.server.deployment.scanner] JBAS015003: Found de.bht.server.war in deployment directory. To trigger deployment create a file called de.bht.server.war.dodeploy
2013-12-25 13:12:54,528 INFO [org.xnio] XNIO Version 3.0.6.GA
2013-12-25 13:12:54,528 INFO [org.jboss.as.server] JBAS015888: Creating http management service using socket-binding (management-http)
2013-12-25 13:12:54,528 INFO [org.xnio.nio] XNIO NIO Implementation Version 3.0.6.GA
2013-12-25 13:12:54,544 INFO [org.jboss.remoting] JBoss Remoting version 3.2.8.SP1
2013-12-25 13:12:54,590 INFO [org.jboss.as.configadmin] JBAS016200: Activating ConfigAdmin Subsystem
2013-12-25 13:12:54,606 INFO [org.jboss.as.osgi] JBAS011906: Activating OSGi Subsystem
2013-12-25 13:12:54,606 INFO [org.jboss.as.naming] JBAS011800: Activating Naming Subsystem
2013-12-25 13:12:54,622 INFO [org.jboss.as.security] JBAS013171: Activating Security Subsystem
2013-12-25 13:12:54,668 INFO [org.jboss.as.security] JBAS013170: Current PicketBox version=4.0.13.Final
2013-12-25 13:12:54,746 INFO [org.jboss.as.webservices] JBAS015537: Activating WebServices Extension
2013-12-25 13:12:54,746 INFO [org.jboss.as.connector.logging] JBAS010408: Starting JCA Subsystem (JBoss IronJacamar 1.0.12.Final)
2013-12-25 13:12:54,793 INFO [org.jboss.as.naming] JBAS011802: Starting Naming Service
2013-12-25 13:12:54,809 INFO [org.jboss.as.mail.extension] JBAS015400: Bound mail session [java:jboss/mail/Default]
2013-12-25 13:12:54,980 INFO [org.jboss.as.connector.subsystems.datasources] JBAS010404: Deploying non-JDBC-compliant driver class org.postgresql.Driver (version 9.2)
2013-12-25 13:12:55,043 INFO [org.jboss.ws.common.management.AbstractServerConfig] JBoss Web Services - Stack CXF Server 4.1.0.Beta2
2013-12-25 13:12:55,074 INFO [org.jboss.as.connector.subsystems.datasources] JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
2013-12-25 13:12:55,526 INFO [org.jboss.as.server.deployment.scanner] JBAS015012: Started FileSystemDeploymentService for directory C:\Development\jboss_as\standalone\deployments
2013-12-25 13:12:55,526 INFO [org.jboss.as.server.deployment] JBAS015876: Starting deployment of "de.bht.server.war"
2013-12-25 13:12:55,950 INFO [org.jboss.as.remoting] JBAS017100: Listening on 127.0.0.1:10004
2013-12-25 13:12:55,950 INFO [org.jboss.as.remoting] JBAS017100: Listening on 127.0.0.1:4452
2013-12-25 13:12:55,950 INFO [org.apache.coyote.http11.Http11Protocol] Starting Coyote HTTP/1.1 on http-localhost/127.0.0.1:8085
2013-12-25 13:12:56,090 INFO [org.jboss.as.connector.subsystems.datasources] JBAS010400: Bound data source [java:jboss/datasources/WebappFrameworkDS]
2013-12-25 13:12:58,665 WARN [org.jboss.as.server.deployment] JBAS015893: Encountered invalid class name 'lombok.javac.handlers.HandleConstructor$HandleAllArgsConstructor' for service type 'lombok.javac.JavacAnnotationHandler'
2013-12-25 13:12:58,665 WARN [org.jboss.as.server.deployment] JBAS015893: Encountered invalid class name 'lombok.javac.handlers.HandleConstructor$HandleNoArgsConstructor' for service type 'lombok.javac.JavacAnnotationHandler'
2013-12-25 13:12:58,665 WARN [org.jboss.as.server.deployment] JBAS015893: Encountered invalid class name 'lombok.javac.handlers.HandleConstructor$HandleRequiredArgsConstructor' for service type 'lombok.javac.JavacAnnotationHandler'
2013-12-25 13:12:58,665 WARN [org.jboss.as.server.deployment] JBAS015893: Encountered invalid class name 'lombok.javac.handlers.HandleLog$HandleCommonsLog' for service type 'lombok.javac.JavacAnnotationHandler'
2013-12-25 13:12:58,665 WARN [org.jboss.as.server.deployment] JBAS015893: Encountered invalid class name 'lombok.javac.handlers.HandleLog$HandleJulLog' for service type 'lombok.javac.JavacAnnotationHandler'
2013-12-25 13:12:58,665 WARN [org.jboss.as.server.deployment] JBAS015893: Encountered invalid class name 'lombok.javac.handlers.HandleLog$HandleLog4j2Log' for service type 'lombok.javac.JavacAnnotationHandler'
2013-12-25 13:12:58,665 WARN [org.jboss.as.server.deployment] JBAS015893: Encountered invalid class name 'lombok.javac.handlers.HandleLog$HandleLog4jLog' for service type 'lombok.javac.JavacAnnotationHandler'
2013-12-25 13:12:58,665 WARN [org.jboss.as.server.deployment] JBAS015893: Encountered invalid class name 'lombok.javac.handlers.HandleLog$HandleSlf4jLog' for service type 'lombok.javac.JavacAnnotationHandler'
2013-12-25 13:12:58,665 WARN [org.jboss.as.server.deployment] JBAS015893: Encountered invalid class name 'lombok.javac.handlers.HandleLog$HandleXSlf4jLog' for service type 'lombok.javac.JavacAnnotationHandler'
2013-12-25 13:12:58,665 WARN [org.jboss.as.server.deployment] JBAS015893: Encountered invalid class name 'lombok.core.Main$LicenseApp' for service type 'lombok.core.LombokApp'
2013-12-25 13:12:58,665 WARN [org.jboss.as.server.deployment] JBAS015893: Encountered invalid class name 'lombok.core.Main$VersionApp' for service type 'lombok.core.LombokApp'
2013-12-25 13:12:58,665 WARN [org.jboss.as.server.deployment] JBAS015893: Encountered invalid class name 'lombok.installer.Installer$CommandLineInstallerApp' for service type 'lombok.core.LombokApp'
2013-12-25 13:12:58,665 WARN [org.jboss.as.server.deployment] JBAS015893: Encountered invalid class name 'lombok.installer.Installer$CommandLineUninstallerApp' for service type 'lombok.core.LombokApp'
2013-12-25 13:12:58,665 WARN [org.jboss.as.server.deployment] JBAS015893: Encountered invalid class name 'lombok.installer.Installer$GraphicalInstallerApp' for service type 'lombok.core.LombokApp'
2013-12-25 13:12:58,665 WARN [org.jboss.as.server.deployment] JBAS015893: Encountered invalid class name 'lombok.eclipse.handlers.HandleConstructor$HandleAllArgsConstructor' for service type 'lombok.eclipse.EclipseAnnotationHandler'
2013-12-25 13:12:58,665 WARN [org.jboss.as.server.deployment] JBAS015893: Encountered invalid class name 'lombok.eclipse.handlers.HandleConstructor$HandleNoArgsConstructor' for service type 'lombok.eclipse.EclipseAnnotationHandler'
2013-12-25 13:12:58,665 WARN [org.jboss.as.server.deployment] JBAS015893: Encountered invalid class name 'lombok.eclipse.handlers.HandleConstructor$HandleRequiredArgsConstructor' for service type 'lombok.eclipse.EclipseAnnotationHandler'
2013-12-25 13:12:58,665 WARN [org.jboss.as.server.deployment] JBAS015893: Encountered invalid class name 'lombok.eclipse.handlers.HandleLog$HandleCommonsLog' for service type 'lombok.eclipse.EclipseAnnotationHandler'
2013-12-25 13:12:58,665 WARN [org.jboss.as.server.deployment] JBAS015893: Encountered invalid class name 'lombok.eclipse.handlers.HandleLog$HandleJulLog' for service type 'lombok.eclipse.EclipseAnnotationHandler'
2013-12-25 13:12:58,665 WARN [org.jboss.as.server.deployment] JBAS015893: Encountered invalid class name 'lombok.eclipse.handlers.HandleLog$HandleLog4j2Log' for service type 'lombok.eclipse.EclipseAnnotationHandler'
2013-12-25 13:12:58,665 WARN [org.jboss.as.server.deployment] JBAS015893: Encountered invalid class name 'lombok.eclipse.handlers.HandleLog$HandleLog4jLog' for service type 'lombok.eclipse.EclipseAnnotationHandler'
2013-12-25 13:12:58,681 WARN [org.jboss.as.server.deployment] JBAS015893: Encountered invalid class name 'lombok.eclipse.handlers.HandleLog$HandleSlf4jLog' for service type 'lombok.eclipse.EclipseAnnotationHandler'
2013-12-25 13:12:58,681 WARN [org.jboss.as.server.deployment] JBAS015893: Encountered invalid class name 'lombok.eclipse.handlers.HandleLog$HandleXSlf4jLog' for service type 'lombok.eclipse.EclipseAnnotationHandler'
2013-12-25 13:12:58,962 INFO [org.jboss.as.jpa] JBAS011401: Read persistence.xml for database
2013-12-25 13:12:59,368 INFO [org.jboss.weld.deployer] JBAS016002: Processing weld deployment de.bht.server.war
2013-12-25 13:12:59,992 INFO [org.jboss.weld.deployer] JBAS016005: Starting Services for CDI deployment: de.bht.server.war
2013-12-25 13:13:00,102 INFO [org.jboss.weld.Version] WELD-000900 1.1.16 (Final)
2013-12-25 13:13:00,165 INFO [org.jboss.as.jpa] JBAS011402: Starting Persistence Unit Service 'de.bht.server.war#database'
2013-12-25 13:13:00,321 INFO [org.hibernate.annotations.common.Version] HCANN000001: Hibernate Commons Annotations {4.0.1.Final}
2013-12-25 13:13:00,321 INFO [org.hibernate.Version] HHH000412: Hibernate Core {4.1.6.Final}
2013-12-25 13:13:00,336 INFO [org.hibernate.cfg.Environment] HHH000206: hibernate.properties not found
2013-12-25 13:13:00,336 INFO [org.hibernate.cfg.Environment] HHH000021: Bytecode provider name : javassist
2013-12-25 13:13:00,352 INFO [org.hibernate.ejb.Ejb3Configuration] HHH000204: Processing PersistenceUnitInfo [
name: database
...]
2013-12-25 13:13:00,586 INFO [org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator] HHH000130: Instantiating explicit connection provider: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider
2013-12-25 13:13:01,273 INFO [org.hibernate.dialect.Dialect] HHH000400: Using dialect: org.hibernate.dialect.PostgreSQLDialect
2013-12-25 13:13:01,273 INFO [org.hibernate.engine.jdbc.internal.LobCreatorBuilder] HHH000424: Disabling contextual LOB creation as createClob() method threw error : java.lang.reflect.InvocationTargetException
2013-12-25 13:13:01,289 INFO [org.hibernate.engine.transaction.internal.TransactionFactoryInitiator] HHH000268: Transaction strategy: org.hibernate.engine.transaction.internal.jta.CMTTransactionFactory
2013-12-25 13:13:01,289 INFO [org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory] HHH000397: Using ASTQueryTranslatorFactory
2013-12-25 13:13:01,321 INFO [org.hibernate.cache.spi.UpdateTimestampsCache] HHH000250: Starting update timestamps cache at region: de.bht.server.war#database.org.hibernate.cache.spi.UpdateTimestampsCache
2013-12-25 13:13:01,321 INFO [org.infinispan.factories.GlobalComponentRegistry] ISPN000128: Infinispan version: Infinispan 'Brahma' 5.1.7.Final
2013-12-25 13:13:01,461 INFO [org.infinispan.jmx.CacheJmxRegistration] ISPN000031: MBeans were successfully registered to the platform mbean server.
2013-12-25 13:13:01,477 INFO [org.hibernate.cache.internal.StandardQueryCache] HHH000248: Starting query cache at region: de.bht.server.war#database.org.hibernate.cache.internal.StandardQueryCache
2013-12-25 13:13:01,477 INFO [org.infinispan.jmx.CacheJmxRegistration] ISPN000031: MBeans were successfully registered to the platform mbean server.
2013-12-25 13:13:01,493 INFO [org.hibernate.validator.util.Version] Hibernate Validator 4.2.0.Final
2013-12-25 13:13:01,728 INFO [org.infinispan.jmx.CacheJmxRegistration] ISPN000031: MBeans were successfully registered to the platform mbean server.
2013-12-25 13:13:01,868 INFO [org.hibernate.tool.hbm2ddl.SchemaValidator] HHH000229: Running schema validator
2013-12-25 13:13:01,868 INFO [org.hibernate.tool.hbm2ddl.SchemaValidator] HHH000102: Fetching database metadata
2013-12-25 13:13:01,899 INFO [org.hibernate.tool.hbm2ddl.TableMetadata] HHH000261: Table found: tnt_test.survey_question
2013-12-25 13:13:01,899 INFO [org.hibernate.tool.hbm2ddl.TableMetadata] HHH000037: Columns: [id, title, multiplechoice, idx, mandatory, sheet_id, freetext]
2013-12-25 13:13:02,040 INFO [org.jboss.weld.deployer] JBAS016008: Starting weld service for deployment de.bht.server.war
2013-12-25 13:13:02,274 INFO [org.apache.deltaspike.core.util.ClassDeactivationUtils] class: org.apache.deltaspike.core.impl.config.ConfigurationExtension activated=true
2013-12-25 13:13:02,274 INFO [org.apache.deltaspike.core.util.ClassDeactivationUtils] class: org.apache.deltaspike.core.impl.exception.control.extension.ExceptionControlExtension activated=true
2013-12-25 13:13:02,274 INFO [org.apache.deltaspike.core.util.ClassDeactivationUtils] class: org.apache.deltaspike.security.impl.extension.SecurityExtension activated=true
2013-12-25 13:13:02,289 INFO [org.apache.deltaspike.core.util.ClassDeactivationUtils] class: org.apache.deltaspike.core.impl.message.MessageBundleExtension activated=true
2013-12-25 13:13:02,289 INFO [org.apache.deltaspike.core.util.ClassDeactivationUtils] class: org.apache.deltaspike.core.impl.exclude.extension.ExcludeExtension activated=true
2013-12-25 13:13:02,289 INFO [org.apache.deltaspike.core.util.ClassDeactivationUtils] class: org.apache.deltaspike.core.impl.exclude.CustomProjectStageBeanFilter activated=true
2013-12-25 13:13:02,289 INFO [org.apache.deltaspike.core.util.ClassDeactivationUtils] class: org.apache.deltaspike.core.impl.exclude.GlobalAlternative activated=true
2013-12-25 13:13:02,289 INFO [org.apache.deltaspike.core.util.ClassDeactivationUtils] class: org.apache.deltaspike.core.impl.jmx.MBeanExtension activated=true
2013-12-25 13:13:02,368 INFO [org.apache.deltaspike.core.util.ProjectStageProducer] Computed the following DeltaSpike ProjectStage: Production
2013-12-25 13:13:03,554 INFO [org.jboss.web] JBAS018210: Register web context: /de.bht.server
2013-12-25 13:13:03,726 INFO [javax.enterprise.resource.webcontainer.jsf.config] Mojarra 2.1.13-jbossorg-1 20120919-1641 für Kontext '/de.bht.server' wird initialisiert.
2013-12-25 13:13:07,127 INFO [org.primefaces.webapp.PostConstructApplicationEventListener] Running on PrimeFaces 4.0
2013-12-25 13:13:08,002 INFO [org.jboss.as.server] JBAS018559: Deployed "de.bht.server.war"
2013-12-25 13:13:08,205 INFO [org.jboss.as] JBAS015961: Http management interface listening on http://127.0.0.1:9995/management
2013-12-25 13:13:08,205 INFO [org.jboss.as] JBAS015951: Admin console listening on http://127.0.0.1:9995
2013-12-25 13:13:08,205 INFO [org.jboss.as] JBAS015874: JBoss AS 7.2.0.Alpha1-SNAPSHOT "Steropes" started in 15582ms - Started 204 of 288 services (83 services are passive or on-demand)
2013-12-25 13:13:15,567 INFO [org.jboss.resteasy.cdi.CdiInjectorFactory] Found BeanManager at java:comp/BeanManager
2013-12-25 13:13:15,567 INFO [org.jboss.resteasy.spi.ResteasyDeployment] Deploying javax.ws.rs.core.Application: class de.bht.server.jax.RestApplication
2013-12-25 13:13:15,693 INFO [stdout] Resource: null
2013-12-25 13:13:15,709 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/de.bht.server].[de.bht.server.jax.RestApplication]] Servlet.service() for servlet de.bht.server.jax.RestApplication threw exception: org.jboss.resteasy.spi.UnhandledException: java.lang.NullPointerException
at org.jboss.resteasy.core.SynchronousDispatcher.handleApplicationException(SynchronousDispatcher.java:340)
at org.jboss.resteasy.core.SynchronousDispatcher.handleException(SynchronousDispatcher.java:214)
at org.jboss.resteasy.core.SynchronousDispatcher.handleInvokerException(SynchronousDispatcher.java:190)
at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:540)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:502)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:119)
at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
at org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:206)
at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:179)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50)
at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50)
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:165)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:372)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:679)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:931)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.NullPointerException
at de.bht.server.jax.Resource.getJson(Resource.java:27)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:167)
at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:257)
at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:222)
at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:211)
at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:525)
... 28 more
好像是
@Inject
private Service service;
资源中存在一些问题,但这是为什么呢?我很感谢任何提示。
最佳答案
您的问题的简短答案是,放置一个名为 beans.xml 的空文件。进入 WEB-INF 文件夹。
或者,您可以使用 @EJB
来注释您的服务。
请参阅此答案以获得更长的解释:Should I use @EJB or @Inject
关于java - JSF/Hibernate/Rest,为什么是空指针?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20772810/
什么是 hibernate 和n- hibernate ?我可以在 Visual Studio 2008 中使用它进行 C# Web 应用程序开发吗?请给我建议...我是 asp.net Web 应用
我有一个不系统地发生的异常(exception)。 我试图通过在每次迭代中刷新和清理 session 来解决此问题,但没有成功。 [quartzScheduler_Worker-7] ERROR jd
使用 Hibernate 在数据库中存储 IP 地址的最佳类型是什么? 我虽然是 Byte[] 或 String,但有没有更好的方法,或者你用什么? @Column(name = "range_fr
我正在尝试制定一个公式来选择用户个人资料的用户友好名称。它选择名字 + ' ' + 姓氏 如果其中至少有一个不为空且不为空(包含非空白字符),否则选择 短名称 (条件相同),最后,如果 短名称 为空或
在hibernate中,是否可以将鉴别器作为一个实体?例如,如果我将 Department 作为基类,将 AdminDepartment 和 ProcessingDepartment 作为子类。 De
我只想从表中获取一些列值。因此,我已经使用投影来实现这一目标。该代码有效,但我认为它无效。 我的问题是当我使用ProjectionsList并将标准条件列表设置为ArrayList时-Bulletin
你好: 我对 hibernate 缓存缓存的内容感到困惑。 从文档中,我知道 hibernate 中有缓存类型。 一级 :交易级别。 似乎要被 session 持久化的实体被缓存在这里。 二级缓存 :
我遇到了一个情况: save或update hibernate 的目标表中的某些数据 在目标表上有一个触发器,该触发器将在目标表的insert或update操作之前执行 由 hibernate 将此记
我有一个名为 Master_Info_tbl 的表。它是一个查询表: 这是该表的代码: @Entity @Table(name="MASTER_INFO_T") public class Code
我想知道如何在 Hibernate 查询语言中使用日期文字。我在我的 JPA 项目中做了如下操作(作为 Eclipselink 提供者)并且它工作正常。 SELECT m FROM Me m WHER
@Entity public class Troop { @OneToMany(mappedBy="troop") public Set getSoldiers() { ...
我正在尝试使用 hibernate 查询删除表 'user_role' 中的所有行。但每次我都会出错。有人可以帮我吗。 DaoImpl @Override public void deleteAll(
不是将数据库操作分散在四个 (osgi) 包中,而是在那里做略有不同的事情。我想创建一个负责所有持久性问题的(简单的)OSGi 包。我觉得这并不像听起来那么简单,因为“每个包都有独特的类加载器”。 因
这就是我使用生成器的方式: private Integer id; 我看到的行为是: 创建第一个对象 hibernate 分配 id = 1 删除该对象 关闭服务
对象级别的实体和值类型有什么区别。我知道实体将有一个 id 但值不会,但为什么我们需要不同的方法来映射实体与值类型? 这样做是为了让hibernate可以对值类型应用任何优化吗? 最佳答案 一个实体已
我正在使用 HibernateTemplate.findByCriteria 方法进行一些查询。现在我想在标准上创建一些 SQL 限制,比如 criteria.add(Restrictions.sql
所以我有以下代码: Query query = session.createQuery("from Weather"); List list = query.list();
如何使用Hibernate映射具有多个实体的 View ? 问候, 混沌 最佳答案 请参见Hibernate文档中第5.1.3节“类”,紧接在“Id”节之前: There is no differen
据我所知,Hibernate 有两种类型的实现 JPA的实现(2)(@Entity,@Table注解) 扩展到旧的(传统的) hibernate (没有 JPA),使用 HSQL 查询,没有注释 如果
我需要一个将条目存储为键值对的集合(因此我可以通过键查找值),但我需要一个允许多个值使用 hibernate 共享同一个键的集合 最佳答案 一个键具有多个值的映射称为多映射 - 在 Apache 公共
我是一名优秀的程序员,十分优秀!