Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/gwt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
spring、web.xml和servlet调度问题_Spring_Gwt_Servlets_Spring Mvc_Jpa - Fatal编程技术网

spring、web.xml和servlet调度问题

spring、web.xml和servlet调度问题,spring,gwt,servlets,spring-mvc,jpa,Spring,Gwt,Servlets,Spring Mvc,Jpa,我遇到了这个错误: [WARN] Exception while dispatching incoming RPC call com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract void ne.projl.client.service.ProjService.testdao(java.lang.Integer) throws java.lang.IllegalArgumentEx

我遇到了这个错误:

 [WARN] Exception while dispatching incoming RPC call
com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract void ne.projl.client.service.ProjService.testdao(java.lang.Integer) throws java.lang.IllegalArgumentException' threw an unexpected exception: java.lang.NullPointerException
    at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:389)
。。。。。

第37行:
返回getEntityManager().find(entityClass,id)

web.xml

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
    xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context"
     xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="
                http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
                http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
                http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
                http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">

    <context:annotation-config />

<!DOCTYPE web-app PUBLIC
 "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
 "http://java.sun.com/dtd/web-app_2_3.dtd" >
<web-app>
    <display-name>Geomajas GWT face example application</display-name>
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>
            classpath:org/geomajas/spring/geomajasContext.xml
            classpath:org/geomajas/plugin/rasterizing/DefaultRasterizedPipelines.xml
            WEB-INF/applicationContext.xml
<!--            WEB-INF/applicationContext2.xml -->
<!--            WEB-INF/layer*.xml -->
<!--            WEB-INF/map*.xml -->
            WEB-INF/layerOsm.xml
            WEB-INF/mapOsm.xml
<!--            WEB-INF/applicationContext2.xml -->

       </param-value>
    </context-param>


    <filter>
        <filter-name>CacheFilter</filter-name>
        <filter-class>org.geomajas.servlet.CacheFilter</filter-class>
    </filter>

    <filter-mapping>
        <filter-name>CacheFilter</filter-name>
        <url-pattern>*</url-pattern>
    </filter-mapping>

    <listener>
        <listener-class>org.geomajas.servlet.PrepareScanningContextListener</listener-class>
    </listener>

    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    <listener>
        <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
    </listener>

    <servlet>
        <servlet-name>GeomajasServiceServlet</servlet-name>
        <servlet-class>org.geomajas.gwt.server.GeomajasServiceImpl</servlet-class>
    </servlet>

    <servlet>
        <servlet-name>dispatcher</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>classpath*:META-INF/geomajasWebContext.xml</param-value>
            <description>Spring Web-MVC specific (additional) context files.</description>
        </init-param>
        <load-on-startup>3</load-on-startup>
    </servlet>

<!-- SpringGwt remote service servlet --> 
    <servlet>
        <servlet-name>springGwtRemoteServiceServlet</servlet-name>
        <servlet-class>org.spring4gwt.server.SpringGwtRemoteServiceServlet</servlet-class>
        <init-param>
        <param-name>contexConfigLocation</param-name>
        <param-value>WEB-INF/applicationContext2.xml</param-value>
        <description>j</description>
        </init-param>
    </servlet>

    <servlet-mapping>
        <servlet-name>GeomajasServiceServlet</servlet-name>
        <url-pattern>/showcase/geomajasService</url-pattern>
    </servlet-mapping>

    <servlet-mapping>
        <servlet-name>dispatcher</servlet-name>
        <url-pattern>/d/*</url-pattern>
    </servlet-mapping>



    <servlet-mapping>
        <servlet-name>springGwtRemoteServiceServlet</servlet-name>
        <url-pattern>/showcase/springGwtServices/test</url-pattern>
    </servlet-mapping>

    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
    </welcome-file-list>

</web-app>

The file applicationContext2.xml below .

Geomajas GWT人脸示例应用程序
上下文配置位置
类路径:org/geomajas/spring/geomajasContext.xml
类路径:org/geomajas/plugin/rasterising/DefaultRasterizedPipelines.xml
WEB-INF/applicationContext.xml
WEB-INF/layerOsm.xml
WEB-INF/mapOsm.xml
缓存过滤器
org.geomajas.servlet.CacheFilter
缓存过滤器
*
org.geomajas.servlet.PrepareScanningContextListener
org.springframework.web.context.ContextLoaderListener
org.springframework.web.context.request.RequestContextListener
GeomajasServiceServlet
org.geomajas.gwt.server.GeomajasServiceImpl
调度员
org.springframework.web.servlet.DispatcherServlet
上下文配置位置
classpath*:META-INF/geomajasWebContext.xml
SpringWebMVC特定(附加)上下文文件。
3.
springGwtRemoteServiceServlet
org.spring4gwt.server.SpringGwtRemoteServiceServlet
contexConfigLocation
WEB-INF/applicationContext2.xml
J
GeomajasServiceServlet
/showcase/geomajasService
调度员
/d/*
springGwtRemoteServiceServlet
/showcase/SpringWtService/test
index.html
下面是applicationContext2.xml文件。
我感觉我在applicationContext2.xml中声明的内容没有被检测到,因为如果我不将context:component scan base package=“ne.projl.*/>放在applicationContext.xml中(没有2),它就不会检测到我的带注释的serviceimpl。

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
    xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context"
     xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="
                http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
                http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
                http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
                http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">

    <context:annotation-config />

<tx:annotation-driven transaction-manager="transactionManager" /> 
<context:component-scan base-package="ne.projl.*" />
<!--    <context:component-scan base-package="FULLY QUALIFIED" /> -->

<bean class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean" id="entityManagerFactory">
        <property name="persistenceUnitName" value="MyPUnit" />
    </bean>

    <bean class="org.springframework.orm.jpa.JpaTransactionManager" id="transactionManager">
        <property name="entityManagerFactory" ref="entityManagerFactory" />
    </bean>


</beans>

编辑1:

@Repository("poiCategDAO")
public class PoiCategDAO extends AbstractDAO<Integer,PoiCateg> {
    @PersistenceContext(unitName = "ProjPUnit")
    EntityManager entityManager;

    //@Override
    protected EntityManager getEntityManager() {
        return entityManager;
    }


}
@Repository(“poiCategDAO”)
公共类PoiCategDAO扩展了AbstractDAO{
@PersistenceContext(unitName=“ProjPUnit”)
实体管理器实体管理器;
//@凌驾
受保护的EntityManager getEntityManager(){
返回实体管理器;
}
}

该错误表示您的EntityManager为空。你是怎么设置的


如果您正在注入,请包括进行注入的配置文件,以及如何访问注入的类。

Aaaaaa来吧,伙计们,一个线索。。。或者我应该发布一些额外的数据?什么是
ProjPUnit
?我认为应该用
MyPUnit
@PersistenceContext(unitName=“MyPUnit”)
替换它。进行注入的文件不是已经发布了吗?ie applicationContext2.xml。
@Repository("poiCategDAO")
public class PoiCategDAO extends AbstractDAO<Integer,PoiCateg> {
    @PersistenceContext(unitName = "ProjPUnit")
    EntityManager entityManager;

    //@Override
    protected EntityManager getEntityManager() {
        return entityManager;
    }


}