java.lang.RuntimeException:由于反射错误,表达式的评估失败

时间:2016-03-15 15:49:14

标签: java spring hibernate jsp spring-mvc

我有一个应用程序(使用注释的Spring 4 MVC + Hibernate 4 + MySQL + Maven集成示例),使用基于注释的配置将Spring与Hibernate集成。

我在JSP中有这个问题

  

java.lang.RuntimeException:由于反射错误,表达式[$ {userItem.deviceBody.key}]的评估失败。

但在我的Junit测试中一切都很好:

#include <Streaming.h>         // Include the Streaming library
#include <UIPEthernet.h>       // Include the Ethernet library
#include <SPI.h>
#include <MemoryFree.h>
#include <UIPAgentuino.h>
#include <Flash.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include <DHT.h>
#include <SimpleTimer.h>

//SENSORS DECLARATIONS
#define OWC1 7
OneWire oneWire1(OWC1);
DallasTemperature c1temp(&oneWire1);

#define OWC2 8
OneWire oneWire2(OWC2);
DallasTemperature c2temp(&oneWire2);

#define OWAir 9
OneWire oneWire3(OWAir);
DallasTemperature incAir(&oneWire3);

#define DHT1PIN 6
#define DHT1TYPE DHT22
DHT dht1(DHT1PIN, DHT1TYPE);

//TIMER
SimpleTimer timer;

//ETHERNET DECLARATIONS & VARIABLES
float c1 = 0;
float c2 = 0;
float iAir = 0;
float h1 = 0;
float t1 = 0;
float aInput[5];
int32_t dInput[5];
byte pos = 0;
byte count;
byte i = 0;
// MAC address from Ethernet shield sticker under board
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192, 168, 1, 111); // IP address, may need to change depending on network
EthernetServer server(80);  // create a server at port 80
//String HTTP_req;            // stores the HTTP request


//SENSORS OID

static char h1OID[]    = "1.3.6.1.4.1.36582.4.4.0";     // RH
static int32_t h1int = 0;

//RELAY OID & CONTROL
static int32_t relayState[17];
static byte relay[17];
static int32_t relayCommand[17];
int32_t *relayPointer[17];
static char relay1OID [] = "1.3.6.1.4.1.36582.5.1.0";     // R1


//GENERAL & SNMP
uint32_t prevMillis = millis();
char oid[SNMP_MAX_OID_LEN];
SNMP_API_STAT_CODES api_status;
SNMP_ERR_CODES status;

void CheckSensors() {
  c1temp.requestTemperatures();
  c2temp.requestTemperatures();
  incAir.requestTemperatures();
  c1 = c1temp.getTempCByIndex(0);
  c2 = c2temp.getTempCByIndex(0);
  iAir = incAir.getTempCByIndex(0);
  h1 = dht1.readHumidity();
  t1 = dht1.readTemperature();

  if (isnan(h1) || isnan(t1)) {
    h1 = 200;
    t1 = 200;
    return;
  }
  c1int = c1 * 100;
  c2int = c2 * 100;
  iAirint = iAir * 100;
  t1int = t1 * 100;
  h1int = h1 * 100;
}

void CheckInputs() {
  aInput[1] = analogRead(A0); //read value from A1
  aInput[1] = aInput[1] * (5.0 / 1023.0);
  aInput[2] = analogRead(A1); //read value from A1
  aInput[2] = aInput[2] * (5.0 / 1023.0);
  aInput[3] = analogRead(A2); //read value from A1
  aInput[3] = aInput[3] * (5.0 / 1023.0);
  aInput[4] = analogRead(A3); //read value from A1
  aInput[4] = aInput[4] * (5.0 / 1023.0);

  dInput[1] = digitalRead(10);
  dInput[2] = digitalRead(11);
  dInput[3] = digitalRead(46);
  dInput[4] = digitalRead(47);

  a1Int = aInput[1] * 100;
  a2Int = aInput[2] * 100;
  a3Int = aInput[3] * 100;
  a4Int = aInput[4] * 100;
}

void pduReceived()
{
  SNMP_PDU pdu;
  api_status = Agentuino.requestPdu(&pdu);
  //
  if ((pdu.type == SNMP_PDU_GET || pdu.type == SNMP_PDU_SET)
      && pdu.error == SNMP_ERR_NO_ERROR && api_status == SNMP_API_STAT_SUCCESS )
  {
    pdu.OID.toString(oid);
     //SENSOR 5 - RH
    if ( strcmp(oid, h1OID) == 0 ) {
      // handle temp1 (set/get) requests
      if ( pdu.type == SNMP_PDU_SET ) {
        // response packet from set-request - object is read-only
        pdu.type = SNMP_PDU_RESPONSE;
        pdu.error = SNMP_ERR_READ_ONLY;
      } else {
        // response packet from get-request
        status = pdu.VALUE.encode(SNMP_SYNTAX_INT, h1int);
        pdu.type = SNMP_PDU_RESPONSE;
        pdu.error = status;
      }
    }
    //RELAY 1
    else if ( strcmp(oid, relay1OID ) == 0 ) {
      // handle sysName (set/get) requests
      if ( pdu.type == SNMP_PDU_SET ) {
        // response packet from set-request - object is read/write
        status = pdu.VALUE.decode(relayPointer[1]);
        if (status == 0) {
          relayCommand[1] = *pdu.VALUE.data;
          if (relayCommand[1] == 1) {
            digitalWrite(relay[1], LOW);
            relayState[1] = 1;
          }
          else {
            digitalWrite(relay[1], HIGH);
            relayState[1] = 0;
          }
        }
        pdu.type = SNMP_PDU_RESPONSE;
        pdu.error = status;
      } else {
        // response packet from get-request
        status = pdu.VALUE.encode(SNMP_SYNTAX_INT32, relayState[1]);
        pdu.type = SNMP_PDU_RESPONSE;
        pdu.error = status;
      }
      //
    } 
    else {
      // oid does not exist
      // response packet - object not found
      pdu.type = SNMP_PDU_RESPONSE;
      pdu.error = SNMP_ERR_NO_SUCH_NAME;
    }
    //
    Agentuino.responsePdu(&pdu);
  }
  //
  Agentuino.freePdu(&pdu);
  //
}

void setup()
{
  pinMode(10, INPUT_PULLUP);
  pinMode(11, INPUT_PULLUP);
  pinMode(46, INPUT_PULLUP);
  pinMode(47, INPUT_PULLUP);
  for (i = 1; i < 17; i = i + 1) {
    relay[i] = 21 + i;
  }
  for (i = 1; i < 17; i = i + 1) {
    pinMode(relay[i], OUTPUT);
  }
  for (i = 1; i < 17; i = i + 1) {
    digitalWrite(relay[i], HIGH);
  }
  for (i = 1; i < 17; i = i + 1) {
    relayState[i] = 0;
  }
  for (i = 1; i < 5; i = i + 1) {
    aInput[i] = 0;
  }
  for (i = 1; i < 5; i = i + 1) {
    dInput[i] = 0;
  }
  Ethernet.begin(mac, ip);  // initialize Ethernet device
  server.begin();           // start to listen for clients
  //Serial.begin(9600);       // for diagnostics
  c1temp.begin();
  c2temp.begin();
  incAir.begin();
  dht1.begin();
  timer.setInterval(10000, CheckSensors);
  //timer.setInterval(1001, CheckInputs);
  //
  api_status = Agentuino.begin();
  //
  if ( api_status == SNMP_API_STAT_SUCCESS ) {
    //
    Agentuino.onPduReceive(pduReceived);
    //
    delay(10);
    //
    return;
  }
  //
  delay(10);
}

void loop()
{
  timer.run();
  // listen/handle for incoming SNMP requests

  Agentuino.listen();
}

这里有完整的错误:

for (User user : deviceBodies) {
    assertNotNull (user.getDeviceBody());
    assertNotNull (user.getDeviceBody().getKey());
}

0 个答案:

没有答案