问:
How to configure pom.xml file- spring and hibernate
This is my pom.xml file-

```<project xmlns="http://maven.apache.org/POM/4.0.0"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>
<groupId>com.albatrossoft</groupId>
<artifactId>wbpsc</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>war</packaging>

<properties>
    <war.file.name>wbpsc</war.file.name>

    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

    <java.source.version>1.6</java.source.version>
    <java.target.version>1.6</java.target.version>

    <commons-codec.version>1.7</commons-codec.version>
    <commons-dbcp.version>1.4</commons-dbcp.version>
    <commons-lang.version>3.1</commons-lang.version>
    <commons-pool.version>1.6</commons-pool.version>
    <commons-io.version>2.4</commons-io.version>
    <commons-httpclient.version>3.1</commons-httpclient.version>

    <javax-mail.version>1.4.5</javax-mail.version>
    <javax-jms.version>1.1</javax-jms.version>

    <postgresql.version>9.1-901.jdbc4</postgresql.version>
    <hsqldb.version>2.2.8</hsqldb.version>

    <spring.version>3.1.0.RELEASE</spring.version>
    <spring-data.version>1.2.0.RELEASE</spring-data.version>
    <spring-integration.version>2.2.0.RELEASE</spring-integration.version>
    <spring-security.version>3.1.3.RELEASE</spring-security.version>

    <junit.version>4.11</junit.version>
    <mockito.version>1.9.5</mockito.version>
    <hamcrest.version>1.3</hamcrest.version>

    <javax-servlet.version>2.5</javax-servlet.version>

    <jackson.version>1.9.2</jackson.version>
    <ehcache.version>4.1.7.Final</ehcache.version>
    <hibernate-core.version>4.1.7.Final</hibernate-core.version>
    <hibernate-validator.version>4.3.1.Final</hibernate-validator.version>
    <jersey.version>1.17</jersey.version>
    <freemarker.version>2.3.19</freemarker.version>
    <slf4j.version>1.7.1</slf4j.version>
    <perf4j.version>0.9.12</perf4j.version>
    <log4j.version>1.2.17</log4j.version>
    <jasypt.version>1.9.0</jasypt.version>
    <fop.version>1.0</fop.version>
    <lambdaj.version>2.3.2</lambdaj.version>
    <joda-time.version>2.1</joda-time.version>
    <quartz.version>1.8.6</quartz.version>

    <google.guava.version>12.0</google.guava.version>
    <javassist.version>3.12.1.GA</javassist.version>
    <saxon.version>9.0.0.2</saxon.version>
    <jasperreports.version>5.0.0</jasperreports.version>
    <itext.version>4.2.0</itext.version>
    <groovy.version>2.0.0</groovy.version>

    <maven-assembly-plugin.version>2.2-beta-5</maven-assembly-plugin.version>
    <maven-antrun-plugin.version>1.3</maven-antrun-plugin.version>
    <maven-build-helper-plugin.version>1.5</maven-build-helper-plugin.version>
    <maven-compiler-plugin.version>2.3.2</maven-compiler-plugin.version>
    <maven-clean-plugin.version>2.4.1</maven-clean-plugin.version>
    <maven-dependency-plugin.version>2.1</maven-dependency-plugin.version>
    <maven-deploy-plugin.version>2.5</maven-deploy-plugin.version>
    <maven-eclipse-plugin.version>2.7</maven-eclipse-plugin.version>
    <maven-hibernate-plugin.version>2.2</maven-hibernate-plugin.version>
    <maven-install-plugin.version>2.3</maven-install-plugin.version>
    <maven-jar-plugin.version>2.3.1</maven-jar-plugin.version>
    <maven-project-info-reports-plugin.version>2.1.2</maven-project-info-reports-plugin.version>

    <maven-release-plugin.version>2.1</maven-release-plugin.version>
    <maven-resources-plugin.version>2.4.3</maven-resources-plugin.version>

    <maven-scm-plugin.version>1.3</maven-scm-plugin.version>
    <maven-site-plugin.version>2.0.1</maven-site-plugin.version>
    <maven-source-plugin.version>2.1.2</maven-source-plugin.version>
    <maven-surefire-plugin.version>2.11</maven-surefire-plugin.version>
    <maven-surefire-report-plugin.version>2.11</maven-surefire-report-plugin.version>

    <maven-taglist-plugin.version>2.4</maven-taglist-plugin.version>
    <maven-tomcat-plugin.version>1.0</maven-tomcat-plugin.version>

    <maven-war-plugin.version>2.1</maven-war-plugin.version>
    <maven-jrebel-plugin.version>1.1.3</maven-jrebel-plugin.version>

</properties>

<dependencies>

    <dependency>
        <groupId>org.aspectj</groupId>
        <artifactId>aspectjrt</artifactId>
        <version>1.6.11</version>
    </dependency>

    <dependency>
        <groupId>org.modelmapper</groupId>
        <artifactId>modelmapper</artifactId>
        <version>0.5.5</version>
    </dependency>

    <dependency>
        <groupId>org.codehaus.jackson</groupId>
        <artifactId>jackson-core-asl</artifactId>
        <version>${jackson.version}</version>
    </dependency>

    <dependency>
        <groupId>org.jasypt</groupId>
        <artifactId>jasypt</artifactId>
        <version>${jasypt.version}</version>
    </dependency>

    <dependency>
        <groupId>org.codehaus.jackson</groupId>
        <artifactId>jackson-mapper-asl</artifactId>
        <version>${jackson.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.aspectj</groupId>
        <artifactId>aspectjweaver</artifactId>
        <version>1.6.11</version>
    </dependency>

    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-lang3</artifactId>
        <version>${commons-lang.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>commons-codec</groupId>
        <artifactId>commons-codec</artifactId>
        <version>${commons-codec.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>commons-io</groupId>
        <artifactId>commons-io</artifactId>
        <version>${commons-io.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-beans</artifactId>
        <version>${spring.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-core</artifactId>
        <version>${spring.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context-support</artifactId>
        <version>${spring.version}</version>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>${spring.version}</version>
        <scope>compile</scope>
        <exclusions>

            <exclusion>
                <groupId>commons-logging</groupId>
                <artifactId>commons-logging</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>${spring.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
        <version>${spring.version}</version>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-jdbc</artifactId>
        <version>${spring.version}</version>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-orm</artifactId>
        <version>${spring.version}</version>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-tx</artifactId>
        <version>${spring.version}</version>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-aop</artifactId>
        <version>${spring.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-jpa</artifactId>
        <version>${spring-data.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework.integration</groupId>
        <artifactId>spring-integration-core</artifactId>
        <version>${spring-integration.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework.integration</groupId>
        <artifactId>spring-integration-file</artifactId>
        <version>${spring-integration.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework.integration</groupId>
        <artifactId>spring-integration-mail</artifactId>
        <version>${spring-integration.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework.integration</groupId>
        <artifactId>spring-integration-ftp</artifactId>
        <version>${spring-integration.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework.integration</groupId>
        <artifactId>spring-integration-http</artifactId>
        <version>${spring-integration.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-core</artifactId>
        <version>${spring-security.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-web</artifactId>
        <version>${spring-security.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-config</artifactId>
        <version>${spring-security.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>${hibernate-core.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-entitymanager</artifactId>
        <version>${hibernate-core.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-ehcache</artifactId>
        <version>${hibernate-core.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-validator</artifactId>
        <version>${hibernate-validator.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.hamcrest</groupId>
        <artifactId>hamcrest-all</artifactId>
        <version>${hamcrest.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>joda-time</groupId>
        <artifactId>joda-time</artifactId>
        <version>${joda-time.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-core</artifactId>
        <version>${jersey.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-client</artifactId>
        <version>${jersey.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>com.sun.jersey.contribs</groupId>
        <artifactId>jersey-multipart</artifactId>
        <version>${jersey.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>javax.ws.rs</groupId>
        <artifactId>javax.ws.rs-api</artifactId>
        <version>2.0-m03</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>javax.mail</groupId>
        <artifactId>mail</artifactId>
        <version>${javax-mail.version}</version>
    </dependency>

    <dependency>
        <groupId>commons-httpclient</groupId>
        <artifactId>commons-httpclient</artifactId>
        <version>${commons-httpclient.version}</version>
    </dependency>

    <dependency>
        <groupId>com.google.guava</groupId>
        <artifactId>guava</artifactId>
        <version>${google.guava.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.freemarker</groupId>
        <artifactId>freemarker</artifactId>
        <version>${freemarker.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>net.sf.jasperreports</groupId>
        <artifactId>jasperreports</artifactId>
        <version>${jasperreports.version}</version>
        <exclusions>
            <exclusion>
                <groupId>com.lowagie</groupId>
                <artifactId>itext</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>com.lowagie</groupId>
        <artifactId>itext</artifactId>
        <version>${itext.version}</version>
    </dependency>

    <dependency>
        <groupId>org.quartz-scheduler</groupId>
        <artifactId>quartz</artifactId>
        <version>${quartz.version}</version>
    </dependency>

    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
        <version>2.5</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>com.sun.jersey.contribs</groupId>
        <artifactId>jersey-spring</artifactId>
        <version>${jersey.version}</version>
        <scope>runtime</scope>

        <exclusions>

            <exclusion>
                <groupId>org.springframework</groupId>
                <artifactId>spring-aop</artifactId>
            </exclusion>

            <exclusion>
                <groupId>org.springframework</groupId>
                <artifactId>spring-beans</artifactId>
            </exclusion>

            <exclusion>
                <groupId>org.springframework</groupId>
                <artifactId>spring-core</artifactId>
            </exclusion>

            <exclusion>
                <groupId>org.springframework</groupId>
                <artifactId>spring-asm</artifactId>
            </exclusion>

            <exclusion>
                <groupId>org.springframework</groupId>
                <artifactId>spring-web</artifactId>
            </exclusion>

            <exclusion>
                <groupId>org.springframework</groupId>
                <artifactId>spring-context</artifactId>
            </exclusion>

        </exclusions>
    </dependency>

    <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-servlet</artifactId>
        <version>${jersey.version}</version>
        <scope>runtime</scope>
    </dependency>

    <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-json</artifactId>
        <version>${jersey.version}</version>
        <scope>runtime</scope>
    </dependency>

    <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-server</artifactId>
        <version>${jersey.version}</version>
        <scope>runtime</scope>
    </dependency>

    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>${slf4j.version}</version>
        <scope>runtime</scope>
    </dependency>

    <dependency>
        <groupId>commons-dbcp</groupId>
        <artifactId>commons-dbcp</artifactId>
        <version>${commons-dbcp.version}</version>
        <scope>runtime</scope>
    </dependency>

    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>${log4j.version}</version>
        <scope>runtime</scope>
        <exclusions>
            <exclusion>
                <groupId>javax.mail</groupId>
                <artifactId>mail</artifactId>
            </exclusion>
            <exclusion>
                <groupId>javax.jms</groupId>
                <artifactId>jms</artifactId>
            </exclusion>
            <exclusion>
                <groupId>com.sun.jdmk</groupId>
                <artifactId>jmxtools</artifactId>
            </exclusion>
            <exclusion>
                <groupId>com.sun.jmx</groupId>
                <artifactId>jmxri</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

    <dependency>
        <groupId>org.hsqldb</groupId>
        <artifactId>hsqldb</artifactId>
        <version>${hsqldb.version}</version>
        <scope>runtime</scope>
    </dependency>

    <dependency>
        <groupId>org.codehaus.groovy</groupId>
        <artifactId>groovy-all</artifactId>
        <version>${groovy.version}</version>
        <scope>runtime</scope>
    </dependency>

    <dependency>
        <groupId>postgresql</groupId>
        <artifactId>postgresql</artifactId>
        <version>${postgresql.version}</version>
        <scope>runtime</scope>
    </dependency>

    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>${junit.version}</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-test</artifactId>
        <version>${spring.version}</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-all</artifactId>
        <version>${mockito.version}</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>com.jayway.restassured</groupId>
        <artifactId>rest-assured</artifactId>
        <version>1.7.2</version>
        <scope>test</scope>
    </dependency>

</dependencies>

<build>
    <finalName>wbpsc</finalName>

    <resources>
        <resource>
            <directory>src/main/resources</directory>
        </resource>
        <resource>
            <directory>src/test/resources</directory>
        </resource>
        <resource>
            <directory>target/generated-jasper</directory>
        </resource>
    </resources>

    <plugins>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>${maven-compiler-plugin.version}</version>
            <inherited>true</inherited>
            <configuration>
                <encoding>${project.build.sourceEncoding}</encoding>
                <source>${java.source.version}</source>
                <target>${java.target.version}</target>
            </configuration>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>${maven-surefire-plugin.version}</version>
            <inherited>true</inherited>

            <configuration>

                <forkMode>once</forkMode>
                <excludes>
                    <exclude>**/*IntegrationTest.java</exclude>
                </excludes>

            </configuration>

        </plugin>

        <plugin>
            <groupId>org.zeroturnaround</groupId>
            <artifactId>jrebel-maven-plugin</artifactId>
            <version>${maven-jrebel-plugin.version}</version>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-clean-plugin</artifactId>
            <version>${maven-clean-plugin.version}</version>
            <inherited>true</inherited>
            <configuration>
                <verbose>false</verbose>
                <followSymLinks>false</followSymLinks>
                <filesets>
                    <fileset>
                        <directory>${project.basedir}</directory>
                        <includes>
                            <include>bin</include>
                            <include>dist</include>
                            <include>*-testng-*.xml</include>
                        </includes>
                    </fileset>
                </filesets>
            </configuration>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>${maven-war-plugin.version}</version>
            <configuration>
                <warName>${war.file.name}</warName>
            </configuration>
        </plugin>

        <plugin>
            <groupId>org.zeroturnaround</groupId>
            <artifactId>jrebel-maven-plugin</artifactId>
            <version>${maven-jrebel-plugin.version}</version>

        </plugin>

        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>jasperreports-maven-plugin</artifactId>
            <version>1.0-beta-2</version>

            <configuration>
                <sourceDirectory>${basedir}/src/main/resources/META-INF/jasper</sourceDirectory>
                <outputDirectory>${basedir}/target/classes/generated-jasper</outputDirectory>
                <compiler>net.sf.jasperreports.compilers.JRGroovyCompiler</compiler>
            </configuration>

            <executions>
                <execution>
                    <phase>compile</phase>
                    <goals>
                        <goal>compile-reports</goal>
                    </goals>
                </execution>
            </executions>

            <dependencies>

                <dependency>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>jasperreports-maven-plugin</artifactId>
                    <version>1.0-beta-2</version>
                    <exclusions>
                        <exclusion>
                            <groupId>net.sf.jasperreports</groupId>
                            <artifactId>jasperreports</artifactId>
                        </exclusion>
                    </exclusions>
                </dependency>

                <dependency>
                    <groupId>net.sf.jasperreports</groupId>
                    <artifactId>jasperreports</artifactId>
                    <version>${jasperreports.version}</version>
                    <exclusions>

                        <exclusion>
                            <groupId>com.lowagie</groupId>
                            <artifactId>itext</artifactId>
                        </exclusion>
                    </exclusions>
                </dependency>

                <dependency>
                    <groupId>org.codehaus.groovy</groupId>
                    <artifactId>groovy-all</artifactId>
                    <version>${groovy.version}</version>
                </dependency>
            </dependencies>
        </plugin>

    </plugins>
    <pluginManagement>

        <plugins>

            <plugin>
                <groupId>org.eclipse.m2e</groupId>
                <artifactId>lifecycle-mapping</artifactId>
                <version>1.0.0</version>
                <configuration>
                    <lifecycleMappingMetadata>
                        <pluginExecutions>
                            <pluginExecution>
                                <pluginExecutionFilter>
                                    <groupId>org.codehaus.mojo</groupId>
                                    <artifactId>jasperreports-maven-plugin</artifactId>
                                    <versionRange>[1.0-beta-2,)</versionRange>
                                    <goals>
                                        <goal>compile-reports</goal>
                                    </goals>
                                </pluginExecutionFilter>
                                <action>
                                    <ignore></ignore>
                                </action>
                            </pluginExecution>
                        </pluginExecutions>
                    </lifecycleMappingMetadata>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>
</build>

<profiles>

</profiles>
```

I am trying to run my project exceptions are as follows-

SEVERE: Exception sending context initialized event to listener
  instance of class
  org.springframework.web.context.ContextLoaderListener
  org.springframework.beans.factory.BeanCreationException: Error
  creating bean with name 'multiUserReport' defined in class path
  resource [META-INF/spring/wbpsc-spring-context-jasper.xml]:
  Initialization of bean failed; nested exception is
  java.lang.AbstractMethodError:
  org.codehaus.groovy.control.CompilationUnit$ClassgenCallback.call(Lorg/objectweb/asm/ClassVisitor;Lorg/codehaus/groovy/ast/ClassNode;)V
    at
  org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)
    at
  org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    at
  org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
    at
  org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
    at
  org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
    at
  org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
    at
  org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
    at
  org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
    at
  org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
    at
  org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:384)
    at
  org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:283)
    at
  org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
    at
  org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939)
    at
  org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)
    at
  org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at
  org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
    at
  org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
    at java.util.concurrent.FutureTask.run(Unknown Source)  at
  java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)     at
  java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)    at
  java.lang.Thread.run(Unknown Source) Caused by:
  java.lang.AbstractMethodError:
  org.codehaus.groovy.control.CompilationUnit$ClassgenCallback.call(Lorg/objectweb/asm/ClassVisitor;Lorg/codehaus/groovy/ast/ClassNode;)V
    at
  org.codehaus.groovy.control.CompilationUnit$14.call(CompilationUnit.java:779)
    at
  org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:964)
    at
  org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:549)
    at
  org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:527)
    at
  org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:504)
    at
  net.sf.jasperreports.compilers.JRGroovyCompiler.compileUnits(JRGroovyCompiler.java:109)
    at
  net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:201)
    at
  net.sf.jasperreports.engine.JasperCompileManager.compile(JasperCompileManager.java:240)
    at
  net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:490)
    at
  org.springframework.web.servlet.view.jasperreports.AbstractJasperReportsView.loadReport(AbstractJasperReportsView.java:510)
    at
  org.springframework.web.servlet.view.jasperreports.AbstractJasperReportsView.loadReport(AbstractJasperReportsView.java:476)
    at
  org.springframework.web.servlet.view.jasperreports.AbstractJasperReportsView.initApplicationContext(AbstractJasperReportsView.java:306)
    at
  org.springframework.context.support.ApplicationObjectSupport.initApplicationContext(ApplicationObjectSupport.java:119)
    at
  org.springframework.web.context.support.WebApplicationObjectSupport.initApplicationContext(WebApplicationObjectSupport.java:72)
    at
  org.springframework.context.support.ApplicationObjectSupport.setApplicationContext(ApplicationObjectSupport.java:73)
    at
  org.springframework.context.support.ApplicationContextAwareProcessor.invokeAwareInterfaces(ApplicationContextAwareProcessor.java:117)
    at
  org.springframework.context.support.ApplicationContextAwareProcessor.postProcessBeforeInitialization(ApplicationContextAwareProcessor.java:92)
    at
  org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:394)
    at
  org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1448)
    at
  org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
    ... 20 more

Please help me to solve this problem.

答:
Below configuration of spring and hibernate works for me</p>

```<code><properties>
    <spring.version>5.0.6.RELEASE</spring.version>
    <hibernate.version>5.2.16.Final</hibernate.version>
    <mysql.connector>5.1.45</mysql.connector>
    <c3po.version>0.9.5.2</c3po.version>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
  </properties>

  <dependencies>

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>${spring.version}</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-tx</artifactId>
        <version>${spring.version}</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-orm</artifactId>
        <version>${spring.version}</version>
    </dependency>

    <!-- Add Jackson for JSON converters -->
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
        <version>2.9.5</version>
    </dependency>

    <!-- Hibernate -->
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>${hibernate.version}</version>
    </dependency>

    <!-- MySQL -->
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>${mysql.connector}</version>
    </dependency>

    <!-- C3PO -->
    <dependency>
        <groupId>com.mchange</groupId>
        <artifactId>c3p0</artifactId>
        <version>${c3po.version}</version>
    </dependency>

    <!-- Servlet+JSP+JSTL -->
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <version>3.1.0</version>
    </dependency>

    <dependency>
        <groupId>javax.servlet.jsp</groupId>
        <artifactId>javax.servlet.jsp-api</artifactId>
        <version>2.3.1</version>
    </dependency>

    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
    </dependency>

    <!-- to compensate for java 9+ not including jaxb -->
    <dependency>
        <groupId>javax.xml.bind</groupId>
        <artifactId>jaxb-api</artifactId>
        <version>2.3.0</version>
    </dependency>

  </dependencies>

  <build>
    <finalName>TestSpringHibernate</finalName>
  </build>
</code>```

Body:
This is my pom.xml file-

<project xmlns="http://maven.apache.org/POM/4.0.0"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>
<groupId>com.albatrossoft</groupId>
<artifactId>wbpsc</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>war</packaging>

<properties>
    <war.file.name>wbpsc</war.file.name>

    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

    <java.source.version>1.6</java.source.version>
    <java.target.version>1.6</java.target.version>

    <commons-codec.version>1.7</commons-codec.version>
    <commons-dbcp.version>1.4</commons-dbcp.version>
    <commons-lang.version>3.1</commons-lang.version>
    <commons-pool.version>1.6</commons-pool.version>
    <commons-io.version>2.4</commons-io.version>
    <commons-httpclient.version>3.1</commons-httpclient.version>

    <javax-mail.version>1.4.5</javax-mail.version>
    <javax-jms.version>1.1</javax-jms.version>

    <postgresql.version>9.1-901.jdbc4</postgresql.version>
    <hsqldb.version>2.2.8</hsqldb.version>

    <spring.version>3.1.0.RELEASE</spring.version>
    <spring-data.version>1.2.0.RELEASE</spring-data.version>
    <spring-integration.version>2.2.0.RELEASE</spring-integration.version>
    <spring-security.version>3.1.3.RELEASE</spring-security.version>

    <junit.version>4.11</junit.version>
    <mockito.version>1.9.5</mockito.version>
    <hamcrest.version>1.3</hamcrest.version>

    <javax-servlet.version>2.5</javax-servlet.version>

    <jackson.version>1.9.2</jackson.version>
    <ehcache.version>4.1.7.Final</ehcache.version>
    <hibernate-core.version>4.1.7.Final</hibernate-core.version>
    <hibernate-validator.version>4.3.1.Final</hibernate-validator.version>
    <jersey.version>1.17</jersey.version>
    <freemarker.version>2.3.19</freemarker.version>
    <slf4j.version>1.7.1</slf4j.version>
    <perf4j.version>0.9.12</perf4j.version>
    <log4j.version>1.2.17</log4j.version>
    <jasypt.version>1.9.0</jasypt.version>
    <fop.version>1.0</fop.version>
    <lambdaj.version>2.3.2</lambdaj.version>
    <joda-time.version>2.1</joda-time.version>
    <quartz.version>1.8.6</quartz.version>

    <google.guava.version>12.0</google.guava.version>
    <javassist.version>3.12.1.GA</javassist.version>
    <saxon.version>9.0.0.2</saxon.version>
    <jasperreports.version>5.0.0</jasperreports.version>
    <itext.version>4.2.0</itext.version>
    <groovy.version>2.0.0</groovy.version>

    <maven-assembly-plugin.version>2.2-beta-5</maven-assembly-plugin.version>
    <maven-antrun-plugin.version>1.3</maven-antrun-plugin.version>
    <maven-build-helper-plugin.version>1.5</maven-build-helper-plugin.version>
    <maven-compiler-plugin.version>2.3.2</maven-compiler-plugin.version>
    <maven-clean-plugin.version>2.4.1</maven-clean-plugin.version>
    <maven-dependency-plugin.version>2.1</maven-dependency-plugin.version>
    <maven-deploy-plugin.version>2.5</maven-deploy-plugin.version>
    <maven-eclipse-plugin.version>2.7</maven-eclipse-plugin.version>
    <maven-hibernate-plugin.version>2.2</maven-hibernate-plugin.version>
    <maven-install-plugin.version>2.3</maven-install-plugin.version>
    <maven-jar-plugin.version>2.3.1</maven-jar-plugin.version>
    <maven-project-info-reports-plugin.version>2.1.2</maven-project-info-reports-plugin.version>

    <maven-release-plugin.version>2.1</maven-release-plugin.version>
    <maven-resources-plugin.version>2.4.3</maven-resources-plugin.version>

    <maven-scm-plugin.version>1.3</maven-scm-plugin.version>
    <maven-site-plugin.version>2.0.1</maven-site-plugin.version>
    <maven-source-plugin.version>2.1.2</maven-source-plugin.version>
    <maven-surefire-plugin.version>2.11</maven-surefire-plugin.version>
    <maven-surefire-report-plugin.version>2.11</maven-surefire-report-plugin.version>

    <maven-taglist-plugin.version>2.4</maven-taglist-plugin.version>
    <maven-tomcat-plugin.version>1.0</maven-tomcat-plugin.version>

    <maven-war-plugin.version>2.1</maven-war-plugin.version>
    <maven-jrebel-plugin.version>1.1.3</maven-jrebel-plugin.version>

</properties>

<dependencies>

    <dependency>
        <groupId>org.aspectj</groupId>
        <artifactId>aspectjrt</artifactId>
        <version>1.6.11</version>
    </dependency>

    <dependency>
        <groupId>org.modelmapper</groupId>
        <artifactId>modelmapper</artifactId>
        <version>0.5.5</version>
    </dependency>

    <dependency>
        <groupId>org.codehaus.jackson</groupId>
        <artifactId>jackson-core-asl</artifactId>
        <version>${jackson.version}</version>
    </dependency>

    <dependency>
        <groupId>org.jasypt</groupId>
        <artifactId>jasypt</artifactId>
        <version>${jasypt.version}</version>
    </dependency>

    <dependency>
        <groupId>org.codehaus.jackson</groupId>
        <artifactId>jackson-mapper-asl</artifactId>
        <version>${jackson.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.aspectj</groupId>
        <artifactId>aspectjweaver</artifactId>
        <version>1.6.11</version>
    </dependency>

    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-lang3</artifactId>
        <version>${commons-lang.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>commons-codec</groupId>
        <artifactId>commons-codec</artifactId>
        <version>${commons-codec.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>commons-io</groupId>
        <artifactId>commons-io</artifactId>
        <version>${commons-io.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-beans</artifactId>
        <version>${spring.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-core</artifactId>
        <version>${spring.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context-support</artifactId>
        <version>${spring.version}</version>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>${spring.version}</version>
        <scope>compile</scope>
        <exclusions>

            <exclusion>
                <groupId>commons-logging</groupId>
                <artifactId>commons-logging</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>${spring.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
        <version>${spring.version}</version>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-jdbc</artifactId>
        <version>${spring.version}</version>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-orm</artifactId>
        <version>${spring.version}</version>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-tx</artifactId>
        <version>${spring.version}</version>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-aop</artifactId>
        <version>${spring.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-jpa</artifactId>
        <version>${spring-data.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework.integration</groupId>
        <artifactId>spring-integration-core</artifactId>
        <version>${spring-integration.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework.integration</groupId>
        <artifactId>spring-integration-file</artifactId>
        <version>${spring-integration.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework.integration</groupId>
        <artifactId>spring-integration-mail</artifactId>
        <version>${spring-integration.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework.integration</groupId>
        <artifactId>spring-integration-ftp</artifactId>
        <version>${spring-integration.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework.integration</groupId>
        <artifactId>spring-integration-http</artifactId>
        <version>${spring-integration.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-core</artifactId>
        <version>${spring-security.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-web</artifactId>
        <version>${spring-security.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-config</artifactId>
        <version>${spring-security.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>${hibernate-core.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-entitymanager</artifactId>
        <version>${hibernate-core.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-ehcache</artifactId>
        <version>${hibernate-core.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-validator</artifactId>
        <version>${hibernate-validator.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.hamcrest</groupId>
        <artifactId>hamcrest-all</artifactId>
        <version>${hamcrest.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>joda-time</groupId>
        <artifactId>joda-time</artifactId>
        <version>${joda-time.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-core</artifactId>
        <version>${jersey.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-client</artifactId>
        <version>${jersey.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>com.sun.jersey.contribs</groupId>
        <artifactId>jersey-multipart</artifactId>
        <version>${jersey.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>javax.ws.rs</groupId>
        <artifactId>javax.ws.rs-api</artifactId>
        <version>2.0-m03</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>javax.mail</groupId>
        <artifactId>mail</artifactId>
        <version>${javax-mail.version}</version>
    </dependency>

    <dependency>
        <groupId>commons-httpclient</groupId>
        <artifactId>commons-httpclient</artifactId>
        <version>${commons-httpclient.version}</version>
    </dependency>

    <dependency>
        <groupId>com.google.guava</groupId>
        <artifactId>guava</artifactId>
        <version>${google.guava.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.freemarker</groupId>
        <artifactId>freemarker</artifactId>
        <version>${freemarker.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>net.sf.jasperreports</groupId>
        <artifactId>jasperreports</artifactId>
        <version>${jasperreports.version}</version>
        <exclusions>
            <exclusion>
                <groupId>com.lowagie</groupId>
                <artifactId>itext</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>com.lowagie</groupId>
        <artifactId>itext</artifactId>
        <version>${itext.version}</version>
    </dependency>

    <dependency>
        <groupId>org.quartz-scheduler</groupId>
        <artifactId>quartz</artifactId>
        <version>${quartz.version}</version>
    </dependency>

    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
        <version>2.5</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>com.sun.jersey.contribs</groupId>
        <artifactId>jersey-spring</artifactId>
        <version>${jersey.version}</version>
        <scope>runtime</scope>

        <exclusions>

            <exclusion>
                <groupId>org.springframework</groupId>
                <artifactId>spring-aop</artifactId>
            </exclusion>

            <exclusion>
                <groupId>org.springframework</groupId>
                <artifactId>spring-beans</artifactId>
            </exclusion>

            <exclusion>
                <groupId>org.springframework</groupId>
                <artifactId>spring-core</artifactId>
            </exclusion>

            <exclusion>
                <groupId>org.springframework</groupId>
                <artifactId>spring-asm</artifactId>
            </exclusion>

            <exclusion>
                <groupId>org.springframework</groupId>
                <artifactId>spring-web</artifactId>
            </exclusion>

            <exclusion>
                <groupId>org.springframework</groupId>
                <artifactId>spring-context</artifactId>
            </exclusion>

        </exclusions>
    </dependency>

    <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-servlet</artifactId>
        <version>${jersey.version}</version>
        <scope>runtime</scope>
    </dependency>

    <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-json</artifactId>
        <version>${jersey.version}</version>
        <scope>runtime</scope>
    </dependency>

    <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-server</artifactId>
        <version>${jersey.version}</version>
        <scope>runtime</scope>
    </dependency>

    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>${slf4j.version}</version>
        <scope>runtime</scope>
    </dependency>

    <dependency>
        <groupId>commons-dbcp</groupId>
        <artifactId>commons-dbcp</artifactId>
        <version>${commons-dbcp.version}</version>
        <scope>runtime</scope>
    </dependency>

    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>${log4j.version}</version>
        <scope>runtime</scope>
        <exclusions>
            <exclusion>
                <groupId>javax.mail</groupId>
                <artifactId>mail</artifactId>
            </exclusion>
            <exclusion>
                <groupId>javax.jms</groupId>
                <artifactId>jms</artifactId>
            </exclusion>
            <exclusion>
                <groupId>com.sun.jdmk</groupId>
                <artifactId>jmxtools</artifactId>
            </exclusion>
            <exclusion>
                <groupId>com.sun.jmx</groupId>
                <artifactId>jmxri</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

    <dependency>
        <groupId>org.hsqldb</groupId>
        <artifactId>hsqldb</artifactId>
        <version>${hsqldb.version}</version>
        <scope>runtime</scope>
    </dependency>

    <dependency>
        <groupId>org.codehaus.groovy</groupId>
        <artifactId>groovy-all</artifactId>
        <version>${groovy.version}</version>
        <scope>runtime</scope>
    </dependency>

    <dependency>
        <groupId>postgresql</groupId>
        <artifactId>postgresql</artifactId>
        <version>${postgresql.version}</version>
        <scope>runtime</scope>
    </dependency>

    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>${junit.version}</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-test</artifactId>
        <version>${spring.version}</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-all</artifactId>
        <version>${mockito.version}</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>com.jayway.restassured</groupId>
        <artifactId>rest-assured</artifactId>
        <version>1.7.2</version>
        <scope>test</scope>
    </dependency>

</dependencies>

<build>
    <finalName>wbpsc</finalName>

    <resources>
        <resource>
            <directory>src/main/resources</directory>
        </resource>
        <resource>
            <directory>src/test/resources</directory>
        </resource>
        <resource>
            <directory>target/generated-jasper</directory>
        </resource>
    </resources>

    <plugins>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>${maven-compiler-plugin.version}</version>
            <inherited>true</inherited>
            <configuration>
                <encoding>${project.build.sourceEncoding}</encoding>
                <source>${java.source.version}</source>
                <target>${java.target.version}</target>
            </configuration>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>${maven-surefire-plugin.version}</version>
            <inherited>true</inherited>

            <configuration>

                <forkMode>once</forkMode>
                <excludes>
                    <exclude>**/*IntegrationTest.java</exclude>
                </excludes>

            </configuration>

        </plugin>

        <plugin>
            <groupId>org.zeroturnaround</groupId>
            <artifactId>jrebel-maven-plugin</artifactId>
            <version>${maven-jrebel-plugin.version}</version>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-clean-plugin</artifactId>
            <version>${maven-clean-plugin.version}</version>
            <inherited>true</inherited>
            <configuration>
                <verbose>false</verbose>
                <followSymLinks>false</followSymLinks>
                <filesets>
                    <fileset>
                        <directory>${project.basedir}</directory>
                        <includes>
                            <include>bin</include>
                            <include>dist</include>
                            <include>*-testng-*.xml</include>
                        </includes>
                    </fileset>
                </filesets>
            </configuration>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>${maven-war-plugin.version}</version>
            <configuration>
                <warName>${war.file.name}</warName>
            </configuration>
        </plugin>

        <plugin>
            <groupId>org.zeroturnaround</groupId>
            <artifactId>jrebel-maven-plugin</artifactId>
            <version>${maven-jrebel-plugin.version}</version>

        </plugin>

        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>jasperreports-maven-plugin</artifactId>
            <version>1.0-beta-2</version>

            <configuration>
                <sourceDirectory>${basedir}/src/main/resources/META-INF/jasper</sourceDirectory>
                <outputDirectory>${basedir}/target/classes/generated-jasper</outputDirectory>
                <compiler>net.sf.jasperreports.compilers.JRGroovyCompiler</compiler>
            </configuration>

            <executions>
                <execution>
                    <phase>compile</phase>
                    <goals>
                        <goal>compile-reports</goal>
                    </goals>
                </execution>
            </executions>

            <dependencies>

                <dependency>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>jasperreports-maven-plugin</artifactId>
                    <version>1.0-beta-2</version>
                    <exclusions>
                        <exclusion>
                            <groupId>net.sf.jasperreports</groupId>
                            <artifactId>jasperreports</artifactId>
                        </exclusion>
                    </exclusions>
                </dependency>

                <dependency>
                    <groupId>net.sf.jasperreports</groupId>
                    <artifactId>jasperreports</artifactId>
                    <version>${jasperreports.version}</version>
                    <exclusions>

                        <exclusion>
                            <groupId>com.lowagie</groupId>
                            <artifactId>itext</artifactId>
                        </exclusion>
                    </exclusions>
                </dependency>

                <dependency>
                    <groupId>org.codehaus.groovy</groupId>
                    <artifactId>groovy-all</artifactId>
                    <version>${groovy.version}</version>
                </dependency>
            </dependencies>
        </plugin>

    </plugins>
    <pluginManagement>

        <plugins>

            <plugin>
                <groupId>org.eclipse.m2e</groupId>
                <artifactId>lifecycle-mapping</artifactId>
                <version>1.0.0</version>
                <configuration>
                    <lifecycleMappingMetadata>
                        <pluginExecutions>
                            <pluginExecution>
                                <pluginExecutionFilter>
                                    <groupId>org.codehaus.mojo</groupId>
                                    <artifactId>jasperreports-maven-plugin</artifactId>
                                    <versionRange>[1.0-beta-2,)</versionRange>
                                    <goals>
                                        <goal>compile-reports</goal>
                                    </goals>
                                </pluginExecutionFilter>
                                <action>
                                    <ignore></ignore>
                                </action>
                            </pluginExecution>
                        </pluginExecutions>
                    </lifecycleMappingMetadata>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>
</build>

<profiles>

</profiles>

I am trying to run my project exceptions are as follows-

SEVERE: Exception sending context initialized event to listener
  instance of class
  org.springframework.web.context.ContextLoaderListener
  org.springframework.beans.factory.BeanCreationException: Error
  creating bean with name 'multiUserReport' defined in class path
  resource [META-INF/spring/wbpsc-spring-context-jasper.xml]:
  Initialization of bean failed; nested exception is
  java.lang.AbstractMethodError:
  org.codehaus.groovy.control.CompilationUnit$ClassgenCallback.call(Lorg/objectweb/asm/ClassVisitor;Lorg/codehaus/groovy/ast/ClassNode;)V
    at
  org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)
    at
  org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    at
  org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
    at
  org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
    at
  org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
    at
  org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
    at
  org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
    at
  org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
    at
  org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
    at
  org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:384)
    at
  org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:283)
    at
  org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
    at
  org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939)
    at
  org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)
    at
  org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at
  org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
    at
  org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
    at java.util.concurrent.FutureTask.run(Unknown Source)  at
  java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)     at
  java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)    at
  java.lang.Thread.run(Unknown Source) Caused by:
  java.lang.AbstractMethodError:
  org.codehaus.groovy.control.CompilationUnit$ClassgenCallback.call(Lorg/objectweb/asm/ClassVisitor;Lorg/codehaus/groovy/ast/ClassNode;)V
    at
  org.codehaus.groovy.control.CompilationUnit$14.call(CompilationUnit.java:779)
    at
  org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:964)
    at
  org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:549)
    at
  org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:527)
    at
  org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:504)
    at
  net.sf.jasperreports.compilers.JRGroovyCompiler.compileUnits(JRGroovyCompiler.java:109)
    at
  net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:201)
    at
  net.sf.jasperreports.engine.JasperCompileManager.compile(JasperCompileManager.java:240)
    at
  net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:490)
    at
  org.springframework.web.servlet.view.jasperreports.AbstractJasperReportsView.loadReport(AbstractJasperReportsView.java:510)
    at
  org.springframework.web.servlet.view.jasperreports.AbstractJasperReportsView.loadReport(AbstractJasperReportsView.java:476)
    at
  org.springframework.web.servlet.view.jasperreports.AbstractJasperReportsView.initApplicationContext(AbstractJasperReportsView.java:306)
    at
  org.springframework.context.support.ApplicationObjectSupport.initApplicationContext(ApplicationObjectSupport.java:119)
    at
  org.springframework.web.context.support.WebApplicationObjectSupport.initApplicationContext(WebApplicationObjectSupport.java:72)
    at
  org.springframework.context.support.ApplicationObjectSupport.setApplicationContext(ApplicationObjectSupport.java:73)
    at
  org.springframework.context.support.ApplicationContextAwareProcessor.invokeAwareInterfaces(ApplicationContextAwareProcessor.java:117)
    at
  org.springframework.context.support.ApplicationContextAwareProcessor.postProcessBeforeInitialization(ApplicationContextAwareProcessor.java:92)
    at
  org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:394)
    at
  org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1448)
    at
  org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
    ... 20 more

Please help me to solve this problem.

Body:
Below configuration of spring and hibernate works for me

<properties>
    <spring.version>5.0.6.RELEASE</spring.version>
    <hibernate.version>5.2.16.Final</hibernate.version>
    <mysql.connector>5.1.45</mysql.connector>
    <c3po.version>0.9.5.2</c3po.version>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
  </properties>

  <dependencies>

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>${spring.version}</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-tx</artifactId>
        <version>${spring.version}</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-orm</artifactId>
        <version>${spring.version}</version>
    </dependency>

    <!-- Add Jackson for JSON converters -->
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
        <version>2.9.5</version>
    </dependency>

    <!-- Hibernate -->
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>${hibernate.version}</version>
    </dependency>

    <!-- MySQL -->
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>${mysql.connector}</version>
    </dependency>

    <!-- C3PO -->
    <dependency>
        <groupId>com.mchange</groupId>
        <artifactId>c3p0</artifactId>
        <version>${c3po.version}</version>
    </dependency>

    <!-- Servlet+JSP+JSTL -->
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <version>3.1.0</version>
    </dependency>

    <dependency>
        <groupId>javax.servlet.jsp</groupId>
        <artifactId>javax.servlet.jsp-api</artifactId>
        <version>2.3.1</version>
    </dependency>

    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
    </dependency>

    <!-- to compensate for java 9+ not including jaxb -->
    <dependency>
        <groupId>javax.xml.bind</groupId>
        <artifactId>jaxb-api</artifactId>
        <version>2.3.0</version>
    </dependency>

  </dependencies>

  <build>
    <finalName>TestSpringHibernate</finalName>
  </build>


来源: stackexchange

问:
Activiti get users by group id
I need to send an email notification to all of the group members on a new task assignment. I have created a TaskListener in which I am trying to get all the users by group id. But every time it returns empty user list.

```<code>IdentityService is = Context.getProcessEngineConfiguration().getIdentityService();
List<User> users = is.createUserQuery().memberOfGroup("2007").list();
LOGGER.info("The users are: "  +users); // Always prints []
</code>```

Also, I have following dependencies in my pom.xml

```<code>        <dependency>
        <groupId>com.activiti</groupId>
        <artifactId>activiti-app-logic</artifactId>
        <version>1.6.2</version>
    </dependency>
    <dependency>
        <groupId>com.activiti</groupId>
        <artifactId>activiti-app-data</artifactId>
        <version>1.6.2</version>
    </dependency>
    <dependency>
        <groupId>com.activiti</groupId>
        <artifactId>activiti-dmn-engine</artifactId>
        <version>1.6.2</version>
    </dependency>
    <dependency>
        <groupId>com.activiti</groupId>
        <artifactId>activiti-app-model</artifactId>
        <version>1.6.2</version>
    </dependency>

    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-email</artifactId>
        <version>1.1</version>
    </dependency>
</code>```

should I have the org.activiti in my pom.xml instead of com.activiti?

Let me know if there is any other/better way to send notification to the group.

Thanks for your time

答:
I use this way of getting list of users:

```<code>Set<String> users_list = authorityService.getContainedAuthorities(AuthorityType.USER, "yourGroupName", false);
</code>```

Returns collection of all contained authorities - USERs in you group.

See method description: https://dev.alfresco.com/resource/docs/java/org/alfresco/service/cmr/security/AuthorityService.html#getContainedAuthorities-org.alfresco.service.cmr.security.AuthorityType-java.lang.String-boolean-

When you have such users list, you can get NodeRef of each user and get his e-mail address from NodeRef properties like this:

```<code>NodeRef user = personService.getPerson("userName");
String email = nodeService.getProperty(user, "email");
</code>```

Hope it helps.

ContentLicense: CC BY-SA 4.0

Title: Activiti get users by group id

Body:
I need to send an email notification to all of the group members on a new task assignment. I have created a TaskListener in which I am trying to get all the users by group id. But every time it returns empty user list.

IdentityService is = Context.getProcessEngineConfiguration().getIdentityService();
List<User> users = is.createUserQuery().memberOfGroup("2007").list();
LOGGER.info("The users are: "  +users); // Always prints []

Also, I have following dependencies in my pom.xml

        <dependency>
        <groupId>com.activiti</groupId>
        <artifactId>activiti-app-logic</artifactId>
        <version>1.6.2</version>
    </dependency>
    <dependency>
        <groupId>com.activiti</groupId>
        <artifactId>activiti-app-data</artifactId>
        <version>1.6.2</version>
    </dependency>
    <dependency>
        <groupId>com.activiti</groupId>
        <artifactId>activiti-dmn-engine</artifactId>
        <version>1.6.2</version>
    </dependency>
    <dependency>
        <groupId>com.activiti</groupId>
        <artifactId>activiti-app-model</artifactId>
        <version>1.6.2</version>
    </dependency>

    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-email</artifactId>
        <version>1.1</version>
    </dependency>

should I have the org.activiti in my pom.xml instead of com.activiti?

Let me know if there is any other/better way to send notification to the group.

Thanks for your time

Body:
I use this way of getting list of users:

Set<String> users_list = authorityService.getContainedAuthorities(AuthorityType.USER, "yourGroupName", false);

Returns collection of all contained authorities - USERs in you group.

See method description: https://dev.alfresco.com/resource/docs/java/org/alfresco/service/cmr/security/AuthorityService.html#getContainedAuthorities-org.alfresco.service.cmr.security.AuthorityType-java.lang.String-boolean-

When you have such users list, you can get NodeRef of each user and get his e-mail address from NodeRef properties like this:

NodeRef user = personService.getPerson("userName");
String email = nodeService.getProperty(user, "email");

Hope it helps.


问:
Unity ScriptableObject is missing on mobile build
I have a MonoBehaviour class that has a property referencing another class which is ScriptableObject.

I've created several prefabs of my first class and created several ScriptableObjects of my second class, I've referenced them in the first class respectively.

In the editor everything works fine, except sometimes my so are shown in the Inspector as Missing Script and in property reference as NameOfSO (), don't know what causing this, but again, Play in the Editor is working just fine.

If build my game for Android and connect to the Debug, to see what's going on, I can clearly see, that's ScriptableObject reference is null. Why? Don't know, came here to ask a question.

Thanks!

答:
I figured it out, turns out this was happening because of the weird thing with namings.
Allow me to explain, when I first created a class from ScriptableObject I used, lets say, MyClas name, I've created several instances of that class, but then I saw the error in the name of the class, I've changed it to the MyClass but only in the file itself, not the actual .cs file, so, this was happening. All I had to do is to ensure that my class and my file names are the same, delete old instances of ScriptableObject and create new ones from scratch and... Voila!
Sorry.


问:
Count duplicate entries with a special condition in MYSQL
I am not new to MYSQL but I can't get my head around this problem. Any help is greatly appreciated!

My tables are simplified for the example:

```
categories_table
+-----+
| id  |
+-----+
|   1 |
|   2 |
|   3 |
+-----+
```

```
links_table
+------+-------------+-------------------+
| id   | category_id | link              |
+------+-------------+-------------------+
| 1    |           1 | http://google.com |
| 2    |           2 | http://google.com |
| 3    |           2 | http://google.com |
| 4    |           5 | http://yahoo.com  |
| 5    |           1 | http://php.net    |
| 6    |           2 | http://php.net    |
+------+-------------+-------------------+
```

In links table I have thousands of rows (yes, the same links connected to the same category), and I would like to have a view table that lists the DISTINCT links, with the sum of DISTINCT categories a link is attached to. So in links_table id's 2 and 3 should only count once!

So in this example, the view table should look like this:

```
view
+-------------------+-------------------+
| sum_of_categories | link              |
+-------------------+-------------------+
| 2                 | http://google.com |
| 1                 | http://yahoo.com  |
| 2                 | http://php.net    |
+-------------------+-------------------+
```

Can anyone help?

答:
```<code>select link, count( distinct category_id ) sum_of_categories
   from links_table
   group by link
</code>```

ContentLicense: CC BY-SA 3.0

Body:
I am not new to MYSQL but I can't get my head around this problem. Any help is greatly appreciated!

My tables are simplified for the example:

categories_table
+-----+
| id  |
+-----+
|   1 |
|   2 |
|   3 |
+-----+

links_table
+------+-------------+-------------------+
| id   | category_id | link              |
+------+-------------+-------------------+
| 1    |           1 | http://google.com |
| 2    |           2 | http://google.com |
| 3    |           2 | http://google.com |
| 4    |           5 | http://yahoo.com  |
| 5    |           1 | http://php.net    |
| 6    |           2 | http://php.net    |
+------+-------------+-------------------+

In links table I have thousands of rows (yes, the same links connected to the same category), and I would like to have a view table that lists the DISTINCT links, with the sum of DISTINCT categories a link is attached to. So in links_table id's 2 and 3 should only count once!

So in this example, the view table should look like this:

view
+-------------------+-------------------+
| sum_of_categories | link              |
+-------------------+-------------------+
| 2                 | http://google.com |
| 1                 | http://yahoo.com  |
| 2                 | http://php.net    |
+-------------------+-------------------+

Can anyone help?


问:
Unable to marshal response: datetime.datetime(2019, 5, 29, 13, 41, 46, 937000, tzinfo=tzlocal()) is not JSON serializable",
I am trying to pass time as shown in the code, for ON_DEMAND kinesis video but I am getting this error:

"errorMessage": "Unable to marshal response: datetime.datetime(2019, 5, 29, 13, 41, 46, 937000, tzinfo=tzlocal()) is not JSON serializable",
```

<pre class="lang-py prettyprint-override"><code>import json
import boto3, datetime
from botocore.exceptions import  ClientError

dynamodb = boto3.resource('dynamodb')

def lambda_handler(event, context):

        try:

            # for live video streaming getting HLS URL LIVE and ON DEMAND

            live_data_end_point= boto3.client('kinesisvideo', region_name ="us-east-1").get_data_endpoint(
                  StreamName=event["device_name"],
                  APIName='GET_HLS_STREAMING_SESSION_URL'
                   )
            live_data_end_point = live_data_end_point["DataEndpoint"]

            if event["mode"]=="LIVE":
                media = boto3.client('kinesis-video-archived-media',region_name = 'us-east-1', endpoint_url=live_data_end_point)
                url_response = media.get_hls_streaming_session_url(

                StreamName=event["device_name"],
                PlaybackMode='LIVE',
                DiscontinuityMode='ALWAYS',
                Expires=1000,
                MaxMediaPlaylistFragmentResults=123,
                )

                hls_url = url_response['HLSStreamingSessionURL']
                hls_live_medial_url = [{'hls_url':hls_url}]
            else:
                media = boto3.client('kinesis-video-archived-media',region_name = 'us-east-1', endpoint_url=live_data_end_point)
                url_response = media.get_hls_streaming_session_url(

                StreamName=event["device_name"],
                PlaybackMode='ON_DEMAND',
                HLSFragmentSelector={
                'FragmentSelectorType':'SERVER_TIMESTAMP',
                'TimestampRange': {
                    'StartTimestamp':datetime.datetime(2019, 5, 29, 13, 41),
                    'EndTimestamp':  datetime.datetime(2019, 5, 29, 13, 55)
                }
                  },
                DiscontinuityMode='ALWAYS',
                Expires=1000,
                MaxMediaPlaylistFragmentResults=500,
                )

                hls_url = url_response['HLSStreamingSessionURL']
                hls_live_medial_url = [{'hls_url':hls_url}]

            # for getting list of all fragments:

            end_point_list_frag = boto3.client('kinesisvideo', region_name ="us-east-1").get_data_endpoint(
                  StreamName=event["device_name"],
                  APIName='LIST_FRAGMENTS'
                   )

            end_point_list_frag = end_point_list_frag["DataEndpoint"]
            client_frag =  boto3.client('kinesis-video-archived-media', region_name = "us-east-1", endpoint_url = end_point_list_frag)

            response = client_frag.list_fragments(
                StreamName=event["device_name"],
                MaxResults=123,
                FragmentSelector={
               'FragmentSelectorType': 'SERVER_TIMESTAMP',
               'TimestampRange': {
               'StartTimestamp': datetime.datetime(2019, 5, 29, 13, 41),
               'EndTimestamp': datetime.datetime(2019, 5, 29, 13, 55)
               }
               }
               )

            fragments = response['Fragments']

            # listing all videos available for that devices by using get_media_for_fragment_list

            return {
             'ResponseCode': 200,
             'hls_url': hls_live_medial_url,

             'fragment_list':response,

              }

        except ClientError as ex:
            return {'Result':ex.response['Error']}

##############################################
</code>```

答: Use datetime.srtptime(datetime_object, format) to parse your date into correct format.

Body:
I am trying to pass time as shown in the code, for ON_DEMAND kinesis video but I am getting this error:

"errorMessage": "Unable to marshal response: datetime.datetime(2019, 5, 29, 13, 41, 46, 937000, tzinfo=tzlocal()) is not JSON serializable",

import json
import boto3, datetime
from botocore.exceptions import  ClientError

dynamodb = boto3.resource('dynamodb')

def lambda_handler(event, context):

        try:

            # for live video streaming getting HLS URL LIVE and ON DEMAND

            live_data_end_point= boto3.client('kinesisvideo', region_name ="us-east-1").get_data_endpoint(
                  StreamName=event["device_name"],
                  APIName='GET_HLS_STREAMING_SESSION_URL'
                   )
            live_data_end_point = live_data_end_point["DataEndpoint"]

            if event["mode"]=="LIVE":
                media = boto3.client('kinesis-video-archived-media',region_name = 'us-east-1', endpoint_url=live_data_end_point)
                url_response = media.get_hls_streaming_session_url(

                StreamName=event["device_name"],
                PlaybackMode='LIVE',
                DiscontinuityMode='ALWAYS',
                Expires=1000,
                MaxMediaPlaylistFragmentResults=123,
                )

                hls_url = url_response['HLSStreamingSessionURL']
                hls_live_medial_url = [{'hls_url':hls_url}]
            else:
                media = boto3.client('kinesis-video-archived-media',region_name = 'us-east-1', endpoint_url=live_data_end_point)
                url_response = media.get_hls_streaming_session_url(

                StreamName=event["device_name"],
                PlaybackMode='ON_DEMAND',
                HLSFragmentSelector={
                'FragmentSelectorType':'SERVER_TIMESTAMP',
                'TimestampRange': {
                    'StartTimestamp':datetime.datetime(2019, 5, 29, 13, 41),
                    'EndTimestamp':  datetime.datetime(2019, 5, 29, 13, 55)
                }
                  },
                DiscontinuityMode='ALWAYS',
                Expires=1000,
                MaxMediaPlaylistFragmentResults=500,
                )

                hls_url = url_response['HLSStreamingSessionURL']
                hls_live_medial_url = [{'hls_url':hls_url}]

            # for getting list of all fragments:

            end_point_list_frag = boto3.client('kinesisvideo', region_name ="us-east-1").get_data_endpoint(
                  StreamName=event["device_name"],
                  APIName='LIST_FRAGMENTS'
                   )

            end_point_list_frag = end_point_list_frag["DataEndpoint"]
            client_frag =  boto3.client('kinesis-video-archived-media', region_name = "us-east-1", endpoint_url = end_point_list_frag)

            response = client_frag.list_fragments(
                StreamName=event["device_name"],
                MaxResults=123,
                FragmentSelector={
               'FragmentSelectorType': 'SERVER_TIMESTAMP',
               'TimestampRange': {
               'StartTimestamp': datetime.datetime(2019, 5, 29, 13, 41),
               'EndTimestamp': datetime.datetime(2019, 5, 29, 13, 55)
               }
               }
               )

            fragments = response['Fragments']

            # listing all videos available for that devices by using get_media_for_fragment_list

            return {
             'ResponseCode': 200,
             'hls_url': hls_live_medial_url,

             'fragment_list':response,

              }

        except ClientError as ex:
            return {'Result':ex.response['Error']}

##############################################


问:
How can I set the value of a DropDownList using jQuery?
As the question says, how do I set the value of a DropDownList control using jQuery?</p>

答:
set value and update dropdown list event

```<code>$("#id").val("1234").change();
</code>```

OwnerDisplayName: manwood

ContentLicense: CC BY-SA 2.5

Body:
set value and update dropdown list event

$("#id").val("1234").change();


问:
How to use didFinish navigation on an WKWebView passed to another class
I'm setting up an app, where the WKWebView object is created in one class, and then passed to another class for handling, but when I use didFinish navigation in the second class, it never gets called.

I have added the WKNavigationDelegate protocol, and set  navigationDelegate = self

```<code>class one: UIViewController {
   var webView: WKWebView = WKWebView();

    override func viewDidLoad(){
      var second = Second()
      second.web = webView;
      second.test()
   }
}

class second: NSObject, WKNavigationDelegate {
  var web: WKWebView? = nil;

  func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
     print("Test")
  }

  func test(){
     self.web!.load(URLRequest(url: URL(string: "https://google.com")!))
  }
}
</code>```

I never see the "Test" message.

答:
```<code>import UIKit
import WebKit

class WKWebViewController: UIViewController, WKNavigationDelegate {

    @IBOutlet weak var webWK: WKWebView!
    @IBOutlet weak var activityIndi: UIActivityIndicatorView!

    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.

        webWK.navigationDelegate = self
        let appStoreURL = URL(string: "https://google.com")
        webWK.load(URLRequest(url: appStoreURL!))
    }

    func webView(_ webView: WKWebView, didStartProvisionalNavigation navigation: WKNavigation!) {
        activityIndi.startAnimating()
    }

    func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
        activityIndi.stopAnimating()
    }

}
</code>```

Body:
I'm setting up an app, where the WKWebView object is created in one class, and then passed to another class for handling, but when I use didFinish navigation in the second class, it never gets called.

I have added the WKNavigationDelegate protocol, and set  navigationDelegate = self

class one: UIViewController {
   var webView: WKWebView = WKWebView();

    override func viewDidLoad(){
      var second = Second()
      second.web = webView;
      second.test()
   }
}

class second: NSObject, WKNavigationDelegate {
  var web: WKWebView? = nil;

  func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
     print("Test")
  }

  func test(){
     self.web!.load(URLRequest(url: URL(string: "https://google.com")!))
  }
}

I never see the "Test" message.


问:
Extracting Data from Ajax Request in Python
I am unsure how to extract data from an Ajax request from my Javascript code in a python application in Flask. My Ajax request does not use jQuery.

I have tried using request.form.get() and request.get_json() in my Python code but both produce a None value.

```<code>@app.route("/", methods=["GET", "POST"])
def index():
    if not request.get_json() == None:
        print(request.get_json())
        name = request.get_json()
        session["name"] = name.user
    return render_template("index.html", channels=channels)
</code>```

In my Javascript code I perform a simple Ajax request:

```<code>    if(localStorage.getItem("user")) {
        document.querySelector("#logout").addEventListener("click", () => {
            localStorage.removeItem("user");
        })

        const request = new XMLHttpRequest();
        request.open("POST", "/")
        user = JSON.stringify(localStorage.getItem("user"))
        request.send(user)
    }
</code>```

答:
If i understand it clearly you don't want to send the whole dictionary like ('user':'value') only the value.

In this case request.get_data() works just fine in this case:

```<code>from flask import Flask, request
app = Flask(__name__)

@app.route('/', methods=["GET","POST"])
def index():
    data = open('index.html').read()
    print request.get_data()
    return data

if __name__ == '__main__':
    app.run(host='0.0.0.0', port=8080)
</code>```

index.html is a simple page with a button which triggers the following javascript:

```<code>var request = new XMLHttpRequest()
request.open("POST","/", true)
var send_data = "Hello World"
request.send(send_data)
</code>```

Body:
I am unsure how to extract data from an Ajax request from my Javascript code in a python application in Flask. My Ajax request does not use jQuery.

I have tried using request.form.get() and request.get_json() in my Python code but both produce a None value.

@app.route("/", methods=["GET", "POST"])
def index():
    if not request.get_json() == None:
        print(request.get_json())
        name = request.get_json()
        session["name"] = name.user
    return render_template("index.html", channels=channels)

In my Javascript code I perform a simple Ajax request:

    if(localStorage.getItem("user")) {
        document.querySelector("#logout").addEventListener("click", () => {
            localStorage.removeItem("user");
        })

        const request = new XMLHttpRequest();
        request.open("POST", "/")
        user = JSON.stringify(localStorage.getItem("user"))
        request.send(user)
    }

Body:
If i understand it clearly you don't want to send the whole dictionary like ('user':'value') only the value.

In this case request.get_data() works just fine in this case:

from flask import Flask, request
app = Flask(__name__)

@app.route('/', methods=["GET","POST"])
def index():
    data = open('index.html').read()
    print request.get_data()
    return data

if __name__ == '__main__':
    app.run(host='0.0.0.0', port=8080)

index.html is a simple page with a button which triggers the following javascript:

var request = new XMLHttpRequest()
request.open("POST","/", true)
var send_data = "Hello World"
request.send(send_data)


问:
Two textfield displays same GMSPlace Autocomplete
Im my GMSAUtocompleteController I have two textfield but they display same location when clicked</p>

```<code>extension RideAddDetailsViewController: GMSAutocompleteViewControllerDelegate {
    func viewController(_ viewController: GMSAutocompleteViewController, didAutocompleteWith place: GMSPlace) {

    locationTextField.text = place.name
    destinationTextField.text = place.name

    dismiss(animated: true, completion: nil)
  }
   func viewController(_ viewController: GMSAutocompleteViewController, didFailAutocompleteWithError error: Error) {
    // Handle the error
    print("Error: ", error.localizedDescription)
 }
 func wasCancelled(_ viewController: GMSAutocompleteViewController) {
    // Dismiss when the user canceled the action
    dismiss(animated: true, completion: nil)
}
</code>```

答:
You can use tag to separate them.

```<code>    if textField.isEqual(locationTextField)
    {

       let autocompleteController = GMSAutocompleteViewController()
       autocompleteController.view.tag = 1 // assign the tag you want
       autocompleteController.delegate = self

       present(autocompleteController, animated: true, completion: nil)
    }
    else if  textField.isEqual(destinationTextField)
   {

       let autocompleteController = GMSAutocompleteViewController()
       autocompleteController.view.tag = 2 // assign the tag you want
       autocompleteController.delegate = self

       present(autocompleteController, animated: true, completion: nil)
    }
</code>```

Now you can separate the value from delegate method like this and assign to the textfield.

```<code>    func viewController(_ viewController: GMSAutocompleteViewController, didAutocompleteWith place: GMSPlace) {

    if viewController.view.tag == 1
    {
       locationTextField.text = place.name
     }
     else viewController.view.tag == 2
     {
        destinationTextField.text = place.name
     }

        dismiss(animated: true, completion: nil)
  }
</code>```

Body:
Im my GMSAUtocompleteController I have two textfield but they display same location when clicked

extension RideAddDetailsViewController: GMSAutocompleteViewControllerDelegate {
    func viewController(_ viewController: GMSAutocompleteViewController, didAutocompleteWith place: GMSPlace) {

    locationTextField.text = place.name
    destinationTextField.text = place.name

    dismiss(animated: true, completion: nil)
  }
   func viewController(_ viewController: GMSAutocompleteViewController, didFailAutocompleteWithError error: Error) {
    // Handle the error
    print("Error: ", error.localizedDescription)
 }
 func wasCancelled(_ viewController: GMSAutocompleteViewController) {
    // Dismiss when the user canceled the action
    dismiss(animated: true, completion: nil)
}

Body:
You can use tag to separate them.

    if textField.isEqual(locationTextField)
    {

       let autocompleteController = GMSAutocompleteViewController()
       autocompleteController.view.tag = 1 // assign the tag you want
       autocompleteController.delegate = self

       present(autocompleteController, animated: true, completion: nil)
    }
    else if  textField.isEqual(destinationTextField)
   {

       let autocompleteController = GMSAutocompleteViewController()
       autocompleteController.view.tag = 2 // assign the tag you want
       autocompleteController.delegate = self

       present(autocompleteController, animated: true, completion: nil)
    }

Now you can separate the value from delegate method like this and assign to the textfield.

    func viewController(_ viewController: GMSAutocompleteViewController, didAutocompleteWith place: GMSPlace) {

    if viewController.view.tag == 1
    {
       locationTextField.text = place.name
     }
     else viewController.view.tag == 2
     {
        destinationTextField.text = place.name
     }

        dismiss(animated: true, completion: nil)
  }


问:
Writing to a read-only file using XmlWriter in .NET
I would like to write to a read-only file using XmlWriter. What is the proper way to do this?

Currently I have:

```<code>XmlWriterSettings lSettings = new XmlWriterSettings();
lSettings.Encoding = new UTF8Encoding(false);
lSettings.Indent = true;

XmlWriter lWriter = XmlWriter.Create(lPath, lSettings);
lXml.WriteContentTo(lWriter);
lWriter.Close();
</code>```

I'm wondering if there's a way to avoid clearing and re-setting the read-only flag.

答:
If a file is set as read-only, you do need to re-set the flag, no workarounds.

Of course, you could delete the file (which still requires you to clear the flag) and write a new one, but then risk that if your write operation doesn't happen (exception somewhere), you lose the contents.

Body:
I would like to write to a read-only file using XmlWriter. What is the proper way to do this?

Currently I have:

XmlWriterSettings lSettings = new XmlWriterSettings();
lSettings.Encoding = new UTF8Encoding(false);
lSettings.Indent = true;

XmlWriter lWriter = XmlWriter.Create(lPath, lSettings);
lXml.WriteContentTo(lWriter);
lWriter.Close();

I'm wondering if there's a way to avoid clearing and re-setting the read-only flag.


问:
setSmallIcon() and setLargeIcon() not working in Android Notification
I am pushing the notification from the Firebase Console. I am able to easily receive the notification data and notification also appears but what i am trying to do is change the small icon and the large icon of the notification.

I am using both the methods but none of them seem to work. I have also tried making the small icon using the Vector option via res>New>Vector>Clip Art.
Neither small icon appears nor does the large icon and the notification is also not expandable.

MessagingService.kt

class MessagingService(): FirebaseMessagingService() {

  override fun onMessageReceived(p0: RemoteMessage ? ) {
    super.onMessageReceived(p0)
    showNotification(p0!!.notification!!.title!!, p0!!.notification!!.body!!)
  }

  fun showNotification(title: String, body: String) {
    val icon = BitmapFactory.decodeResource(resources,
      R.drawable.iphn)
    NotificationCompat.Builder(this, "MyNotifications")
      .setLargeIcon(icon)
      .setSmallIcon(R.drawable.ic_notif)
      .setContentTitle(title)
      .setContentText(body)
      .setStyle(NotificationCompat.BigPictureStyle()
        .bigPicture(icon)
        .bigLargeIcon(null))
      .build()

  }
}
```

ic_notif is the drawable i created using Vector

答:
```<code>private var mBuilder: NotificationCompat.Builder? = null
val mNotificationManager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
val intent = Intent(activity, MainActivity::class.java)
val pi = PendingIntent.getActivity(activity, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT)

  if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
     val icon = BitmapFactory.decodeResource(resources, shapemyapp.admin.R.drawable.iphn)
     val importance = NotificationManager.IMPORTANCE_DEFAULT
     val notificationChannel = NotificationChannel("ID", "Name", importance)
     mNotificationManager.createNotificationChannel(notificationChannel)
     mBuilder = NotificationCompat.Builder(this, "MyNotifications")
          .setLargeIcon(icon)
          .setSmallIcon(R.drawable.ic_notifications_active_black_24dp)
          .setContentTitle(title)
          .setContentText(body)
          .build()
  } else {
        mBuilder = NotificationCompat.Builder(activity)
           .setSmallIcon(R.drawable.ic_notifications_active_black_24dp)
  }
    mBuilder!!.setContentIntent(pi)
    mNotificationManager.notify(NotificationID.id, mBuilder!!.build())
</code>```

Body:
I am pushing the notification from the Firebase Console. I am able to easily receive the notification data and notification also appears but what i am trying to do is change the small icon and the large icon of the notification.

I am using both the methods but none of them seem to work. I have also tried making the small icon using the Vector option via res>New>Vector>Clip Art.
Neither small icon appears nor does the large icon and the notification is also not expandable.

MessagingService.kt

class MessagingService(): FirebaseMessagingService() {

  override fun onMessageReceived(p0: RemoteMessage ? ) {
    super.onMessageReceived(p0)
    showNotification(p0!!.notification!!.title!!, p0!!.notification!!.body!!)
  }

  fun showNotification(title: String, body: String) {
    val icon = BitmapFactory.decodeResource(resources,
      R.drawable.iphn)
    NotificationCompat.Builder(this, "MyNotifications")
      .setLargeIcon(icon)
      .setSmallIcon(R.drawable.ic_notif)
      .setContentTitle(title)
      .setContentText(body)
      .setStyle(NotificationCompat.BigPictureStyle()
        .bigPicture(icon)
        .bigLargeIcon(null))
      .build()

  }
}

ic_notif is the drawable i created using Vector


问:
Where should I chain multiple network requests in MVVM? UseCases or Repository?
I am refactoring our codebase. Right now we have a singleton Repository which ceates network requests and manages operators chaining with RxJava and Kotlin Coroutines.

However that Repository is being injected into multiple ViewModels and becomes harder to mantain.

I would like to abstract our codebase and integrate some useCases. As far as I know it is general opinion to use a single network request in useCase, this is why I am unsure about chaining network requests.

I need to chain multiple network requests using Observable.zip and RxJava Subjects.

Would the following flow be correct approach?

Viewmodel calls useCase, which creates network request(from repository), handles that network request, creates a LiveData and forwards that LiveData to ViewModel and also updates subject from the Repository, so that Repository could emit some data after all network requests have finished?

Then our Repository remains similar to our current approach with less code and will only be responsible for multiple network requests chaining.

I hope I was clear enough. I have investigated multiple MVVM examples, but they seemed not practical for real applications, with complex networking logic.

答:
You should not chain different API calls in repository. Mapping to more complex domain objects should be done in a use case. Usually there is more than one repository, each of them is responsible for some part of business domain models (e.g. UsersRepository, PostsRepository, etc). Use case can depend on multiple repositories.

Example (Plaid app)


问:
Apple Business Chat Sandbox not loading
I'm seeing the following while trying to sign into Apple Chat Business Sandbox for the first time:

The spinner keeps spinning without any response...

This is happening in both Safari and Chrome browsers.

I'm on  and

What's missing?

答:
Contrary to the usual promotional bruhaha made by Apple for a couple of years in a row for its Apple Business Chat Sandbox as a great tool for developers, this seems to be yet another of their software duds.

After a lot (over a month) of back and forth emailing Apple support and experiencing loads of gaslighting and obfuscating by Apple folks of the real state of things, i.e:

I finally asked them directly:

Here's Apple's response:

Perhaps this will serve as a warning for someone looking to implement Apple Business Chat to take their much ballyhooed products with a grain of salt.

Title: Apple Business Chat Sandbox not loading