异常:Bean named 'org.springframework.transaction.interceptor.TransactionInterceptor#0' is expected to be of type 'org.aopalliance.aop.Advice' but was actually of type 'org.springframework.transaction.interceptor.TransactionInterceptor'
场景;在使用spring整合hibernate事务时报错
解决:spring-aop中已经包含aopaliance,删除多余的jar包

 

异常:getHibernateFlushMode is not valid without active transaction; nested exception is org.hibernate.HibernateException: getHibernateFlushMode is not valid without active transaction getHibernateFlushMode is not valid without active transaction
场景:在使用spring整合hibernate调用的HibernateTemplate时报错
解决: 在spring配置文件中添加事务的配置

    <bean id="hibernateTransactionManager" class="org.springframework.orm.hibernate5.HibernateTransactionManager">
        <!-- 注入sessionFactory,配置sessionFactory -->
        <property name="sessionFactory" ref="sessionFactory"></property>
    </bean>
    <tx:advice id="txAdvice" transaction-manager="hibernateTransactionManager">
           <tx:attributes>
            <tx:method name="get*" read-only="true" />
            <tx:method name="*" />
        </tx:attributes>
    </tx:advice>
    <aop:config>
           <aop:pointcut id="personServiceOperation" expression="execution(* user.service.UserServiceImpl.*(..))" />
        <aop:advisor advice-ref="txAdvice" pointcut-ref="personServiceOperation" />
    </aop:config>

 

异常:android.os.NetworkOnMainThreadException
场景:安卓开发时在主线程访问网络
解决:将访问网络的代码使用Thread操作

Handler handler = new Handler(){
    @Override
    public void handleMessage(Message msg){
        Bundle data = msg.getData();
        //从data中拿出存的数据
        String val = data.getString("value");
        //将数据进行显示到界面等操作
    }
};
Runnable runnable = new Runnable(){
    @Override
    public void run(){
        //进行访问网络操作
        Message msg = Message.obtain();
        Bundle data = new Bundle();
        data.putString("value", "存放数据");
        msg.setData(data);
        handler.sendMessage(msg);
    }
};

 


异常: Call From * 9000 failed on connection exception: java.net.ConnectException: Connection refused: no further information; For more details see: http://wiki.apache.org/hadoop/ConnectionRefused
场景: eclipse链接不上阿里云hadoop
解决: 将hadoop的配置文件中的ip改为内网IP即可

 

异常: Recieved SHUTDOWN signal from Resourcemanager ,Registration of NodeManager failed, Message from ResourceManager: NodeManager from localhost doesn't satisfy minimum allocations, Sending SHUTDOWN signal to the NodeManager.
场景: 在配置hadoop时,无法启动 NodeManager
解决: 本机配置不满足,修改yarn-siet.xml文件

<!-- 设置内存 -->
<property>
    <name>yarn.nodemanager.resource.memory-mb</name>
    <value>1600</value>
</property>
<!-- 设置cpu 核数 -->
<property>
    <name>yarn.nodemanager.resource.cpu-vcores</name>
    <value>1</value>
</property>

 


异常: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.
场景: Java 连接 MySQL 时连接不上
解决: 修改数据库时区
1.在mysql中执行如下语句
set global time_zone='+8:00';
2.修改数据库连接的url,加上如下参数(指定时区):
serverTimezone=GMT

 


 

 

可以关注一下鄙人的公众号, 谢谢各位了!

内容来源于网络如有侵权请私信删除
你还没有登录,请先登录注册
  • 还没有人评论,欢迎说说您的想法!

相关课程

5444 0元 限免
3746 0元 50元 限免