当前位置: 首页 > 知识库问答 >
问题:

ServletContext日志:调度传入RPC调用时出现异常

东方俊材
2023-03-14

有没有人能告诉我如何用Google SQL Cloud解决GAE中的这个错误我用localhost运行没有问题,但是当我部署到GAE时,它会显示这个错误

package com.ies.ieschool.util;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;

public class HibernateUtil {

private static final SessionFactory sessionFactory;

static {
try {
// Create the SessionFactory from hibernate.cfg.xml
sessionFactory = new AnnotationConfiguration().configure().buildSessionFactory();
} catch (Throwable ex) {
// Make sure you log the exception, as it might be swallowed
System.err.println("Initial SessionFactory creation failed." + ex);
throw new ExceptionInInitializerError(ex);
}
}

public static SessionFactory getSession() {
return sessionFactory;
}

}
package com.ies.ieschool.shared;
// Generated 31 �.�. 2555, 1:54:03 by Hibernate Tools 3.4.0.CR1
import java.io.Serializable;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import net.sf.gilead.pojo.gwt.LightEntity;

/**
* Province generated by hbm2java
*/
@Entity
@Table(name = "province", catalog = "ieschool")
public class Province extends LightEntity implements Serializable {

private static final long serialVersionUID = 1L;

private short provinceId;
private Geography geography;
private String provinceCode;
private String provinceName;
private Set<Father> fathers;
private Set<Mother> mothers;
private Set<Student> studentsForAddressProvince;
private Set<Student> studentsForAddressCensusProvince;
private Set<Student> studentsForGraduatedSchoolProvince;
private Set<Student> studentsForBirthAddressProvince;
private Set<City> cities;
private Set<ExperienceWork> experienceWorks;
private Set<District> districts;
private Set<Guardian> guardians;
private Set<Postcode> postcodes;
private Set<Personal> personalsForAddressProvince;
private Set<SeminarProfile> seminarProfiles;
private Set<Personal> personalsForLicenseIssueProvince;

public Province() {
}

@Id
@Column(name = "province_id", unique = true, nullable = false)
public short getProvinceId() {
    return this.provinceId;
}

public void setProvinceId(short provinceId) {
    this.provinceId = provinceId;
}

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "geography_id", nullable = false)
public Geography getGeography() {
    return this.geography;
}

public void setGeography(Geography geography) {
    this.geography = geography;
}

@Column(name = "province_code", nullable = false, length = 2)
public String getProvinceCode() {
    return this.provinceCode;
}

public void setProvinceCode(String provinceCode) {
    this.provinceCode = provinceCode;
}

@Column(name = "province_name", nullable = false, length = 150)
public String getProvinceName() {
    return this.provinceName;
}

public void setProvinceName(String provinceName) {
    this.provinceName = provinceName;
}

@OneToMany(fetch = FetchType.LAZY, mappedBy = "province")
public Set<Father> getFathers() {
    return this.fathers;
}

public void setFathers(Set<Father> fathers) {
    this.fathers = fathers;
}

@OneToMany(fetch = FetchType.LAZY, mappedBy = "province")
public Set<Mother> getMothers() {
    return this.mothers;
}

public void setMothers(Set<Mother> mothers) {
    this.mothers = mothers;
}

@OneToMany(fetch = FetchType.LAZY, mappedBy = "provinceByAddressProvince")
public Set<Student> getStudentsForAddressProvince() {
    return this.studentsForAddressProvince;
}

public void setStudentsForAddressProvince(Set<Student> studentsForAddressProvince)                                 {
    this.studentsForAddressProvince = studentsForAddressProvince;
}

@OneToMany(fetch = FetchType.LAZY, mappedBy = "provinceByAddressCensusProvince")
public Set<Student> getStudentsForAddressCensusProvince() {
    return this.studentsForAddressCensusProvince;
}

public void setStudentsForAddressCensusProvince(
        Set<Student> studentsForAddressCensusProvince) {
    this.studentsForAddressCensusProvince = studentsForAddressCensusProvince;
}

@OneToMany(fetch = FetchType.LAZY, mappedBy = "provinceByGraduatedSchoolProvince")
public Set<Student> getStudentsForGraduatedSchoolProvince() {
    return this.studentsForGraduatedSchoolProvince;
}

public void setStudentsForGraduatedSchoolProvince(
        Set<Student> studentsForGraduatedSchoolProvince) {
    this.studentsForGraduatedSchoolProvince = studentsForGraduatedSchoolProvince;
}

@OneToMany(fetch = FetchType.LAZY, mappedBy = "provinceByBirthAddressProvince")
public Set<Student> getStudentsForBirthAddressProvince() {
    return this.studentsForBirthAddressProvince;
}

public void setStudentsForBirthAddressProvince(
        Set<Student> studentsForBirthAddressProvince) {
    this.studentsForBirthAddressProvince = studentsForBirthAddressProvince;
}

@OneToMany(fetch = FetchType.LAZY, mappedBy = "province")
public Set<City> getCities() {
    return this.cities;
}

public void setCities(Set<City> cities) {
    this.cities = cities;
}

@OneToMany(fetch = FetchType.LAZY, mappedBy = "province")
public Set<ExperienceWork> getExperienceWorks() {
    return this.experienceWorks;
}

public void setExperienceWorks(Set<ExperienceWork> experienceWorks) {
    this.experienceWorks = experienceWorks;
}

@OneToMany(fetch = FetchType.LAZY, mappedBy = "province")
public Set<District> getDistricts() {
    return this.districts;
}

public void setDistricts(Set<District> districts) {
    this.districts = districts;
}

@OneToMany(fetch = FetchType.LAZY, mappedBy = "province")
public Set<Guardian> getGuardians() {
    return this.guardians;
}

public void setGuardians(Set<Guardian> guardians) {
    this.guardians = guardians;
}

@OneToMany(fetch = FetchType.LAZY, mappedBy = "province")
public Set<Postcode> getPostcodes() {
    return this.postcodes;
}

public void setPostcodes(Set<Postcode> postcodes) {
    this.postcodes = postcodes;
}

@OneToMany(fetch = FetchType.LAZY, mappedBy = "provinceByAddressProvince")
public Set<Personal> getPersonalsForAddressProvince() {
    return this.personalsForAddressProvince;
}

public void setPersonalsForAddressProvince(Set<Personal> personalsForAddressProvince) {
    this.personalsForAddressProvince = personalsForAddressProvince;
}

@OneToMany(fetch = FetchType.LAZY, mappedBy = "province")
public Set<SeminarProfile> getSeminarProfiles() {
    return this.seminarProfiles;
}

public void setSeminarProfiles(Set<SeminarProfile> seminarProfiles) {
    this.seminarProfiles = seminarProfiles;
}

@OneToMany(fetch = FetchType.LAZY, mappedBy = "provinceByLicenseIssueProvince")
public Set<Personal> getPersonalsForLicenseIssueProvince() {
    return this.personalsForLicenseIssueProvince;
}

public void setPersonalsForLicenseIssueProvince(
        Set<Personal> personalsForLicenseIssueProvince) {
    this.personalsForLicenseIssueProvince = personalsForLicenseIssueProvince;
}
}
package com.ies.ieschool.server;

import java.util.ArrayList;
import java.util.List;
import org.hibernate.Session;
import com.ies.ieschool.client.service.ProvinceService;
import com.ies.ieschool.shared.Province;
import net.sf.gilead.core.PersistentBeanManager;
import net.sf.gilead.core.hibernate.HibernateUtil;
import net.sf.gilead.core.serialization.GwtProxySerialization;
import net.sf.gilead.core.store.stateless.StatelessProxyStore;
import net.sf.gilead.gwt.PersistentRemoteService;

@SuppressWarnings("serial")
public class ProvinceImpl extends PersistentRemoteService implements  ProvinceService{

public ProvinceImpl() {
    HibernateUtil hibernateUtil = new HibernateUtil();    
                      hibernateUtil.setSessionFactory(com.ies.ieschool.util.HibernateUtil.getSession());

    PersistentBeanManager persistentBeanManager = new PersistentBeanManager();   
    persistentBeanManager.setPersistenceUtil(hibernateUtil); 
    StatelessProxyStore sps = new StatelessProxyStore();
    sps.setProxySerializer(new GwtProxySerialization());
    persistentBeanManager.setProxyStore(sps);

    setBeanManager(persistentBeanManager);
}

@Override
public Province findProvinceByPK(int provinceId) throws Exception {

    Province province;
    Session session = com.ies.ieschool.util.HibernateUtil.getSession().getCurrentSession();
    session.beginTransaction();
    province = (Province) session.createQuery("SELECT new Province( " +
            "pvn.provinceId, " +
            "pvn.provinceName " +
            ") " +
            "FROM Province pvn " +
            "WHERE pvn.provinceId = :id " +
            "ORDER BY pvn.provinceName").setInteger("id", provinceId).uniqueResult();   
    session.getTransaction().commit();
    return province;
}

@Override
public List<Province> findAllProvince() throws Exception {

    List<Province> list = null;
    Session session = com.ies.ieschool.util.HibernateUtil.getSession().getCurrentSession();
    session.beginTransaction();
    list = new ArrayList<Province> (session.createQuery("SELECT new Province( " +
            "pvn.provinceId, " +
            "pvn.provinceName " +
            ") " +
            "FROM Province pvn " +
            "ORDER BY pvn.provinceName").list());   
    session.getTransaction().commit();
    return list;
}
}
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>        
     <property name="hibernate.connection.driver_class">com.google.appengine.api.rdbms.AppEngineDriver</property>
    <property name="hibernate.connection.useUnicode">true</property>
    <property name="hibernate.connection.characterEncoding">UTF-8</property>
    <property name="hibernate.connection.charSet">UTF-8</property>
    <property name="hibernate.connection.url">jdbc:google:rdbms://ies-thamvitya-db:ieschool/ieschool_rif</property>
    <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
    <property name="hibernate.connection.username"></property>
    <property name="hibernate.connection.password"></property>
    <property name="hibernate.connection.pool_size">1</property>
    <property name="show_sql">true</property>
    <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
    <property name="current_session_context_class">thread</property>
    <property name="javax.persistence.validation.mode">none</property>  
    <mapping class="com.ies.ieschool.shared.Province" />
</session-factory>
</hibernate-configuration>

共有1个答案

司徒光霁
2023-03-14

据我所知,RPC调用在像IOS和Andriod这样的一些设备中是无法运行的。所以您最好避免使用RPC调用。

尝试使用Ajax请求从后面调用您的函数。在任何情况下都很顺利。

 类似资料:
  • 嗨,我拿了GWT的MyWEbApp,它工作了,我需要做一个mapdb数据库,我导入了mapdb并且只在服务器中添加了: 但它给了我一个错误: grave:javax.servlet.servletContext日志:调度传入RPC调用com.google.gwt.user.server.RPC.expectiontedException:服务方法'public abstract java.lang

  • 这是我的客户端代码 这是我的Rest控制器代码: 如果我在调用后使用 String.class 作为返回类型,则相同的代码也有效。但不是响应实体类。我做错了什么,如果我需要客户端也相同的响应实体

  • 我试图在运行在Android中的SubscriptionClient实例上调用RegisterMessageHandler方法。 在将消息发布到特定主题(通过自动测试)20秒左右之后,我在我的Android应用程序中收到了几个超时异常,该应用程序实际上包含了SubscriptionClient实例的RegisterMessageHandler。 输出窗口 这里有个错误: **System.Time

  • 要开启调试日志,首先需要在配置nginx时打开调试功能,然后编译: https://www.wenjiangs.com/doc/BZ7EWB2Econfigure --with-debug ... 然后在配置文件中设置error_log的级别为debug: error_log /path/to/log debug; nginx的windows二进制版本总是将调试日志开启的,因此只需要设

  • 但是,该方法(authContext.AcquireTokenAsync)与其他参数(如客户端id等)很好地配合使用,如下所示。result=await authContext.AcquireTokenSilentAsync(ResourceId,clientId); UWP是否对具有ClientCredential(clientid,key)的AuthContext.AcquireTokenSi

  • 我不明白为什么我总是得到这个错误