1 Reply Latest reply on Mar 17, 2017 9:58 AM by sensorhound-nan

    Error when doing mvn wildfly:deploy:  Couldn't determine main side role for collection com.sensorhound.aigateway.domain.IOConfiguration.nodeData

    sensorhound-nan

      Hey, Guys. I have an error when I do mvn wildfly:deploy. I am using wildfly 10.1.0.Final, hibernate ogm 5.0.10.Final and Cassandra 3.0.9. Here is the full error massage:

      [ERROR] Failed to execute goal org.wildfly.plugins:wildfly-maven-plugin:1.1.0.Final:deploy (default-cli) on project aigateway: Failed to execute goal deploy: {"WFLYCTL0062: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-1" => {"WFLYCTL0080: Failed services" => {"jboss.persistenceunit.\"aigateway.war#JPAService\"" => "org.jboss.msc.service.StartException in service jboss.persistenceunit.\"aigateway.war#JPAService\": javax.persistence.PersistenceException: [PersistenceUnit: JPAService] Unable to build Hibernate SessionFactory
      [ERROR] Caused by: javax.persistence.PersistenceException: [PersistenceUnit: JPAService] Unable to build Hibernate SessionFactory
      [ERROR] Caused by: org.hibernate.HibernateException: Couldn't determine main side role for collection com.sensorhound.aigateway.domain.IOConfiguration.nodeData"},"WFLYCTL0412: Required services that are not installed:" => ["jboss.persistenceunit.\"aigateway.war#JPAService\""],"WFLYCTL0180: Services with missing/unavailable dependencies" => undefined}}}
      [ERROR] -> [Help 1]
      [ERROR] 
      [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
      [ERROR] Re-run Maven using the -X switch to enable full debug logging.
      [ERROR] 
      [ERROR] For more information about the errors and possible solutions, please read the following articles:
      [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
      

       

      Here is a screen shot of the schema of tables I want to create:

      Here is the code for "IO_CONFIGURATION" table:

      @Entity
      @Indexed
      @Table(name = "IO_CONFIGURATION")
      public class IOConfiguration implements Serializable {
      
        private static final long serialVersionUID = 7542743172221933818L;
      
        @Id
        @Column(name = "IO_CONFIGURATION_ID")
        protected String ioConfigurationId;
      
        @Column(name = "ACTIVE")
        protected Boolean active;
      
        @Column(name = "NAME")
        protected String name;
      
        @Column(name = "CONVERSION_TYPE")
        protected String conversionType;
      
        @Column(name = "M_INFO")
        protected Double mInfo;
      
        @Column(name = "B_INFO")
        protected Double bInfo;
      
        @Column(name = "VOLTAGE_DIVIDE")
        protected String voltageDivide;
      
        @Column(name = "SAMPLE_RANGE")
        protected String sampleRange;
      
        @Column(name = "SAMPLE_PERIOD")
        protected Integer samplePeriod;
      
        @Column(name = "STORE_ROW")
        protected Boolean storeRow;
      
        @Column(name = "STORE_CONVERTED")
        protected Boolean storeConverted;
      
        @Column(name = "DEFAULT_GRAPH")
        protected String defaultGraph;
      
        @Column(name = "TITLE")
        protected String title;
      
        @Column(name = "UNIT")
        protected String unit;
      
        @Column(name = "RANGE_LOWERBOUND")
        protected Integer rangeLowerbound;
      
        @Column(name = "RANGE_UPPERBOUND")
        protected Integer rangeUpperbound;
      
        @JsonBackReference
        @OneToMany(mappedBy = "ioConfiguration")
        protected List<Alert> alerts;
      
        @JsonBackReference
        @OneToMany(mappedBy = "ioConfiguration")
        protected List<DataSeriesMeta> dataSeriesMeta;
      
        @JsonBackReference
        @OneToMany(mappedBy = "ioConfiguration")
        protected List<NodeData> nodeData;
      
        @Column(name = "CODE")
        protected String code;
      
        public IOConfiguration() {}
        //...getters and setter
      }
      

       

      Here is the code for "NODE_DATA" table:

      @Entity
      @Indexed
      @IdClass(NodeDataPK.class)
      @Table(name = "NODE_DATA")
      public class NodeData implements Serializable {
      
        private static final long serialVersionUID = -3411753713406246973L;
      
        @Id
        @FieldBridge(impl = ByteBridge.class)
        @JoinColumn(name = "IO_CONFIGURATION_ID", referencedColumnName = "IO_CONFIGURATION_ID")
        @ManyToOne
        protected IOConfiguration ioConfiguration;
      
        @Id
        @Column(name = "TIME")
        protected Long time;
      
        @Column(name = "VALUE")
        protected Double value;
      
        public NodeData() {}
      
        public NodeDataPK getNodeDataId() {
          NodeDataPK nodeDataPK = new NodeDataPK();
          nodeDataPK.setTime(this.time);
          nodeDataPK.setIoConfigurationId(this.ioConfiguration.getIoConfigurationId());
          return nodeDataPK;
        }
      
        public void setNodeDataId(NodeDataPK nodeDataPK) {
          this.time = nodeDataPK.getTime();
          IOConfigurationDAO ioConfigurationDAO = new IOConfigurationDAO();
          ioConfigurationDAO.init();
          IOConfiguration ioConfiguration =
              ioConfigurationDAO.findIOConfiguration(nodeDataPK.getIoConfigurationId());
          this.ioConfiguration = ioConfiguration;
        }
      
      
      
        /**
         * @return the ioConfiguration
         */
        public IOConfiguration getIoConfiguration() {
          return ioConfiguration;
        }
      
        /**
         * @param ioConfiguration the ioConfiguration to set
         */
        public void setIoConfiguration(IOConfiguration ioConfiguration) {
          this.ioConfiguration = ioConfiguration;
        }
      
        /**
         * @return the time
         */
        public Long getTime() {
          return time;
        }
      
        /**
         * @param time the time to set
         */
        public void setTime(Long time) {
          this.time = time;
        }
      
        /**
         * @return the value
         */
        public double getValue() {
          return value;
        }
      
        /**
         * @param value the value to set
         */
        public void setValue(double value) {
          this.value = value;
        }
      
        /**
         * @return the serialversionuid
         */
        public static long getSerialversionuid() {
          return serialVersionUID;
        }
      }
      

       

      Here is the composite primary key for NodeData entity:

      public class NodeDataPK implements Serializable {
      
        /**
         * 
         */
        private static final long serialVersionUID = -3239860594324151192L;
      
        // @Column(name = "IO_CONFIGURATION")
        protected String ioConfiguration;
      
        // @Column(name = "TIME")
        protected Long time;
      
        public NodeDataPK() {}
      
        public NodeDataPK(String ioConfigId, Long time) {
          this.ioConfiguration = ioConfigId;
          this.time = time;
        }
      
        /**
         * @return the channelName
         */
        public String getIoConfigurationId() {
          return ioConfiguration;
        }
      
        /**
         * @param channelName the channelName to set
         */
        public void setIoConfigurationId(String ioConfigurationId) {
          this.ioConfiguration = ioConfigurationId;
        }
      
        /**
         * @return the time
         */
        public Long getTime() {
          return time;
        }
      
        /**
         * @param time the time to set
         */
        public void setTime(Long time) {
          this.time = time;
        }
      
        @Override
        public int hashCode() {
          return ioConfiguration.hashCode() + time.hashCode();
        }
      
        @Override
        public boolean equals(Object o) {
          if (o == null) {
            return false;
          }
          if (!(o instanceof NodeDataPK)) {
            return false;
          }
          NodeDataPK nodeDataPK = (NodeDataPK) o;
          if (((NodeDataPK) o).getIoConfigurationId() != nodeDataPK.getIoConfigurationId()
              && ((NodeDataPK) o).getTime() != nodeDataPK.getTime()) {
            return false;
          }
      
          return true;
        }
      }
      

       

      And here is the ByteBridge I copied:

      public class ByteBridge extends NumberBridge implements Serializable {
        @Override
        public Object stringToObject(String stringValue) {
          if (StringHelper.isEmpty(stringValue))
            return null;
          return Byte.valueOf(stringValue);
        }
      }
      

       

      I don't know what is going on, and there is little message about this error when I google it. If you need for information, I am willing to share. Someone help me please.

       

      Thanks!