2014年2月17日星期一

idea keygen

https://sskaje.me/sskaje/keygen/ 

update 子查询隐含风险

update examinees s
   set (s.birthdate,
        s.issuecertdate,
        s.acceptgradedate,
        s.lastmodifieddate) = 
(select  to_char(t.birthdate, 'yyyy/mm/dd'),
        to_char(t.issuecertdate, 'yyyy/mm/dd'),
        to_char(t.acceptgradedate, 'yyyy/mm/dd'),
        to_char(t.lastmodifieddate, 'yyyy/mm/dd') from examinees_impto_zt t where
         s.examineeid = to_char(t.examineeid))
 where exists(select 1 from examinees_impto_zt b where s.examineeid = to_char(b.examineeid));

Steps To Solve “bind an object under the name HibernateSessionFactory in the JNDI tree” error | Weblogic

If you are getting errors like below in logs while deploying application or in general then try below mentioned steps to make it working.
<14-Dec-2010 10:41:01 CET> <error> <cluster> <BEA-000123> <Conflict start: Youtried to bind an object under the name in the JNDI tree HibernateSessionFactory. Theobject from 4004698486404642S: hrofserver01: ckm : is not HPOF01_1-clusterable, andyou have tried to bind more than two ounces or more servers from. Such objects canonly be deployed from one server.>
< 14-Dec-2010 10:41:01 CET> <error> <cluster> <BEA-000123> <Conflict start: Youtried to bind an object under the name in the JNDI tree HibernateSessionFactory.From the object-2465366582483676621S: hrofserver02: [7010.7010, -1, -1, -1, -1, -1]ckm: HPOF02_1 is non-clusterable, and you have tried to bind more than two ounces ormore from servers. Such objects can only be deployed from one server.> ”
OR error like below in server logs:
####<Nov 12, 2011 8:34:05 AM CET> <Error> <Cluster> <sun879> <M2> <[ACTIVE] ExecuteThread: ’5′ for queue: ‘weblogic.kernel.Default (self-tuning)’> <> <> <> <1289918045285> <BEA-000123> <Conflict start: You tried to bind an object under the name HibernateSessionFactory in the JNDI tree. The object from 4449434054399910424S:hpof.Server.com:[8001,8001,-1,-1,-1,-1,-1]:hpof.Server.com:8001,hpof1.Server.com:8001:MYEAPAPP:M2 is non-clusterable, and you have tried to bind more than once from two or more servers. Such objects can only be deployed from one server.>
In persistance.xml when the below property is added you will face this issue
<property name="hibernate.session_factory_name">hibernate.SessionFactory</property>
<!-- JNDI bound Session Factory Name -->
Unlike EJB entity beans, Hibernate itself is not clusterable so your application may be doing a JNDI lookup on a cluster JNDI tree which does not exist,
so it will only be pinned to one of your server as stated in the log message.

Please add the below property to persistance.xml to resolve this issue.
<property name="hibernate.jndi.weblogic.jndi.replicateBindings">false</property>

<!-- because SessionFactory is not clusterable -->
By adding this option, there won’t be any cluster communication on the hibernate object and the cluster features won’t be activated.
After updating the xml you have to clean the tmp folder and cache folder and need to do a complete bounce to make it working.

BEA-149500:An exception occurred while registering the MBean null

<Error> <JMX> <BEA-149500> <An exception occurred while registering the MBean null.
java.lang.IllegalArgumentException: Registered more than one instance with the same objectName : com.bea:ServerRuntime=AdminServer,Name=portal,Type=ApplicationRuntime new:weblogic.j2ee.J2EEApplicationRuntimeMBeanImpl@13e959da existing weblogic.j2ee.J2EEApplicationRuntimeMBeanImpl@135ebbc5
        at weblogic.management.jmx.ObjectNameManagerBase.registerObject(ObjectNameManagerBase.java:168)
        at weblogic.management.mbeanservers.internal.WLSObjectNameManager.lookupObjectName(WLSObjectNameManager.java:131)
        at weblogic.management.jmx.modelmbean.WLSModelMBeanFactory.registerWLSModelMBean(WLSModelMBeanFactory.java:87)
        at weblogic.management.mbeanservers.internal.RuntimeMBeanAgent$1.registered(RuntimeMBeanAgent.java:105)
        at weblogic.management.provider.core.RegistrationManagerBase.invokeRegistrationHandlers(RegistrationManagerBase.java:180)
        Truncated. see log file for complete stacktrace

以上错误的原因是新加的一个数据源名称和我们一个项目的名称相同,导致weblogic不能识别2个同名的实例名
并不影响系统的运行,若不想看到这个错误,包项目名称换成别的。h

ssh -L6666:172.20.66.218:22 root@192.168.20.156

本文讨论所有机器均为Linux操作系统。 比如说我的机器是A,中间服务器为B,目标服务器是C。 从A可以ssh到B,从B可以ssh到C,但是A不能直接ssh到C。 现在展示利用ssh通道技术从A直接传输文件到C。 1. ssh -L1234:C:22 root@B input B's passWord 2. scp -P1234 filename root@localhost: input C's password

A : 192.168.20.171
B: 192.168.20.156  172.20.21.213
C: 172.20.66.218 210.75.217.55

--192.168.20.173上实现访问支付宝地址
screen
ssh -L443:110.75.146.31:443 root@192.168.20.156
Ctrl+a d
 还要修改本地的hosts,将域名指向127.0.0.1
修改173的 etc/hosts
127.0.0.1 mapi.alipay.com

Too many open files

Too many open files
ulimit -a 
ulimit -HSn 65536
ulimit -a 

Spring mvc @ResponseBody ajax调用出现如下错误:406 Not Acceptable

Spring mvc @ResponseBody  ajax调用出现如下错误:406 Not Acceptable
The resource identified by this request is only capable of generating responses with characteristics not acceptable according to the request "accept" headers ().

需要加入jackson依赖:
        <dependency>
            <groupId>org.codehaus.jackson</groupId>
            <artifactId>jackson-mapper-asl</artifactId>
            <version>1.7.1</version>
        </dependency>

linux Gbk 乱码

############################################
#/etc/sysconfig/i18n
#source /etc/sysconfig/i18n
#env
############################################
#######################
LANG="zh_CN.GB18030"
LANGUAGE="zh_CN.GB18030:zh_CN.GB2312:zh_CN"
SUPPORTED="zh_CN.GB18030:zh_CN:zh"
SYSFONT="lat0-sun16"
SYSFONTACM="8859-15"
######################
############################
#LANG="en_US.UTF-8"
#SUPPORTED="en_US.UTF-8:en_US:en"
#SYSFONT="latarcyrheb-sun16"
################################

linux svn 切换用户

linux svn 切换用户

1. 临时切换
在所有命令下强制加上--username 和--password选项。 
例如:svn up --username zhangsan --password 123456
2.永久切换

win7 64位+Oracle 11g 64位下使用PL/SQL Developer 的解决办法

1)安装Oracle 11g 64位
2)安装32位的Oracle客户端( instantclient-basic-win32-11.2.0.1.0)
下载 instantclient-basic-win32-11.2.0.1.0.zip (一定得是32位的,不要下错了版本,Oracle官网有下载),将其解压至Oracle安装目录的Product下(本机命名为:instantclient_11_2):D:\Oracle\app\YM\product\instantclient_11_2。
拷贝数据库安装根目录下的一个目录D:\Oracle\app\YM\product\11.2.0\dbhome_1\NETWORK到Oracle客户端目录下D:\Oracle\app\YM\product\instantclient_11_2(其实只需要 NETWORK\ADMIN\tnsnames.ora)
3)安装PL/SQL Developer
安装 PL/SQL Developer,在perference->Connection里面设置OCI Library和Oracle_Home,例如本机设置为:
Oracle Home :D:\Oracle\app\YM\product\instantclient_11_2
OCI Library : D:\Oracle\app\YM\product\instantclient_11_2\oci.dll
 
4) 设置环境变量(修改PATH和TNS_ADMIN环境变量)

对于NLS_LANG环境变量, 最好设置成和数据库端一致, 首先从数据库端查询字符集信息:
SQL> select userenv('language') nls_lang from dual;
NLS_LANG
----------------------------------------------------
SIMPLIFIED CHINESE_CHINA.ZHS16GBK

右击"我的电脑" - "属性" - "高级" - "环境变量" - "系统环境变量":
1>.选择"Path" - 点击"编辑", 把 "D:\Oracle\app\YM\product\instantclient_11_2;" 加入;
2>.点击"新建", 变量名设置为"TNS_ADMIN", 变量值设置为"D:\Oracle\app\YM\product\instantclient_11_2;", 点击"确定";
3>.点击"新建", 变量名设置为"NLS_LANG", 变量值设置为"SIMPLIFIED CHINESE_CHINA.ZHS16GBK", 点击"确定";
最后点击"确定"退出.

启动 PL/SQL Developer ,运行无问题。

码农的一天

13年上半年坚持了一阵写工作日报,后来也荒废了
忙得七荤八素的,都想不起来昨天干了些啥。
今天又苦逼得忙了一天,查库 开库 找原因 安排新功能,尿尿的没时间,码农的一天
想着整理整理13年积攒下来的一些东西

2014 再出发

还在加班.....
偷懒儿的时候翻看blogger,发现我关注的几个博客都几年没更新了,2年的....4年的。我的一年没更新了
0:16 回家的出租车上
过去的2013,忙碌 疲惫 麻木 机械,得过且过,新年新气象,再出发

2012年12月31日星期一

被逼搬家

升级后,最常用的搜索功能没有了,昨天终于忍无可忍搬了

2012年9月4日星期二

weblogic org.hibernate.QueryException: ClassNotFoundException: org.hibernate.hql.internal.ast.HqlToken

在WEB-INF目录下建一个weblogic.xml文件,文件中写入如下代码: 


<?xml version="1.0" encoding="UTF-8"?>    
  
<!DOCTYPE weblogic-web-app PUBLIC "-//BEA Systems, Inc.//DTD Web Application 8.1//EN" "http://www.bea.com/servers/wls810/dtd/weblogic810-web-jar.dtd">    
  
<weblogic-web-app>    
  
  <container-descriptor>    
  
    <prefer-web-inf-classes>true</prefer-web-inf-classes>    
  
  </container-descriptor>    
  
</weblogic-web-app>   

说明:prefer-web-inf-classes=true是WebLogic's classloader在有重名类时,优先加载Web应用中WEB-INF内的类
也可以
set PRE_CLASSPATH=D:\oracle\weblogic\wlserver_10.3\server\lib\antlr-2.7.7.jar
http://azurelover.blog.51cto.com/2990964/548988

cvc-complex-type.3.1: Value '2.0' of attribute 'version' of element 'entity-mappings' is not valid with respect to the corresponding attribute use. Attribute 'version' has a fixed value of '1.0'

Caused by: org.xml.sax.SAXException: zip:D:/oracle/weblogic/user_projects/domains/base_domain/servers/AdminServer/tmp/_WL_user/examsystem-showcase/eymnvq/war/WEB-INF/lib/_wl_cls_gen.jar!/META-INF/orm.xml [Location: Line: 3, C: 138]: org.xml.sax.SAXParseException: cvc-complex-type.3.1: Value '2.0' of attribute 'version' of element 'entity-mappings' is not valid with respect to the corresponding attribute use. Attribute 'version' has a fixed value of '1.0'.
        at org.apache.openjpa.lib.meta.XMLMetaDataParser.getException(XMLMetaDataParser.java:656)

 

将orm.xml
改成
<?xml version="1.0" encoding="UTF-8"?>
<entity-mappings version="1.0" xmlns="http://java.sun.com/xml/ns/persistence/orm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/ormhttp://java.sun.com/xml/ns/persistence/orm_1_0.xsd">
</entity-mappings>

java.lang.NoSuchMethodError: javax.persistence.spi.PersistenceUnitInfo.getSharedCacheMode()Ljavax/persistence/SharedCacheMode

Caused By: java.lang.NoSuchMethodError: javax.persistence.spi.PersistenceUnitInfo.getSharedCacheMode()Ljavax/persistence/SharedCacheMode;
at org.hibernate.ejb.util.LogHelper.logPersistenceUnitInfo(LogHelper.java:39)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:516)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73)
at weblogic.deployment.PersistenceUnitInfoImpl.createEntityManagerFactory(PersistenceUnitInfoImpl.java:352)
at weblogic.deployment.PersistenceUnitInfoImpl.createEntityManagerFactory(PersistenceUnitInfoImpl.java:332)

 

 

设置setDomainEnv
windows
@rem Enable JPA 2.0 functionality on WebLogic Server 
set PRE_CLASSPATH=D:\oracle\weblogic\modules\javax.persistence_1.1.0.0_2-0.jar;D:\oracle\weblogic\modules\com.oracle.jpa2support_1.0.0.0_2-1.jar

linux
PRE_CLASSPATH=/oracle/weblogic/modules/javax.persistence_1.0.0.0_2-0-0.jar;/oracle/weblogic/modules/com.oracle.jpa2support_1.0.0.0_2-0.jar
export PRE_CLASSPATH

2012年6月1日星期五

Hello JSF



基于一个已有的网络工程

拷贝JSF 和支持的jars包到WEB-INF/lib目录

jsf-impl.jar  

jsf-api.jar

jstl.jar  

standard.jar

配置web.xml以使用Faces Servlet

  <servlet>  

        <servlet-name>Faces Servlet</servlet-name>  

        <servlet-class>  

            javax.faces.webapp.FacesServlet  

        </servlet-class>  

        <load-on-startup>1</load-on-startup>  

    </servlet>  

  

    <servlet-mapping>  

        <servlet-name>Faces Servlet</servlet-name>  

        <url-pattern>*.faces</url-pattern>  

    </servlet-mapping>  

创建faces-config.xml


<?xml version="1.0"?>  

 <!DOCTYPE faces-config PUBLIC  

 "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"  

 "http://java.sun.com/dtd/web-facesconfig_1_0.dtd">  

  

 <faces-config>  

    <navigation-rule>  

        <from-view-id>/index.jsp</from-view-id>  

        <navigation-case>  

            <from-outcome>login</from-outcome>  

            <to-view-id>/welcome.jsp</to-view-id>  

        </navigation-case>  

    </navigation-rule>  

  

   

 </faces-config>

在JSP页面中增加 JSF taglib的引用


<%@taglib uri="http://java.sun.com/jsf/core" prefix="f" %>  

 <%@taglib uri="http://java.sun.com/jsf/html" prefix="h" %>  

 

创建后台bean


package com.capinfo.bean;


public class UserBean {


private String name;  

 

    public void setName(String name) {  

        this.name = name;  

    }  

  

    public String getName() {  

        return name;  

    }  

}



后台bean 在JSF controls中注册(faces-config.xml)

 <managed-bean>  

        <managed-bean-name>user</managed-bean-name>  

         <managed-bean-class>  

             com.capinfo.bean.UserBean  

         </managed-bean-class>  

        <managed-bean-scope>session</managed-bean-scope>  

    </managed-bean>  

增加JSF tags使之与后台bean交互

<f:view>  

        <h:form>  

            <h3>请输入您的名称</h3>  

            名称: <h:inputText value="#{user.name}"/><p>  

            <h:commandButton value="送出" action="login"/>  

        </h:form>  

    </f:view>  



基于一个已有的网络工程
拷贝JSF 和支持的jars包到WEB-INF/lib目录
jsf-impl.jar  
jsf-api.jar
jstl.jar  
standard.jar
配置web.xml以使用Faces Servlet
  <servlet>  
        <servlet-name>Faces Servlet</servlet-name>  
        <servlet-class>  
            javax.faces.webapp.FacesServlet  
        </servlet-class>  
        <load-on-startup>1</load-on-startup>  
    </servlet>  
  
    <servlet-mapping>  
        <servlet-name>Faces Servlet</servlet-name>  
        <url-pattern>*.faces</url-pattern>  
    </servlet-mapping>  
创建faces-config.xml

<?xml version="1.0"?>  
 <!DOCTYPE faces-config PUBLIC  
 "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"  
 "http://java.sun.com/dtd/web-facesconfig_1_0.dtd">  
  
 <faces-config>  
    <navigation-rule>  
        <from-view-id>/index.jsp</from-view-id>  
        <navigation-case>  
            <from-outcome>login</from-outcome>  
            <to-view-id>/welcome.jsp</to-view-id>  
        </navigation-case>  
    </navigation-rule>  
  
   
 </faces-config>
在JSP页面中增加 JSF taglib的引用

<%@taglib uri="http://java.sun.com/jsf/core" prefix="f" %>  
 <%@taglib uri="http://java.sun.com/jsf/html" prefix="h" %>  
 
创建后台bean

package com.capinfo.bean;

public class UserBean {

private String name;  
 
    public void setName(String name) {  
        this.name = name;  
    }  
  
    public String getName() {  
        return name;  
    }  
}


后台bean 在JSF controls中注册(faces-config.xml)
 <managed-bean>  
        <managed-bean-name>user</managed-bean-name>  
         <managed-bean-class>  
             com.capinfo.bean.UserBean  
         </managed-bean-class>  
        <managed-bean-scope>session</managed-bean-scope>  
    </managed-bean>  
增加JSF tags使之与后台bean交互
<f:view>  
        <h:form>  
            <h3>请输入您的名称</h3>  
            名称: <h:inputText value="#{user.name}"/><p>  
            <h:commandButton value="送出" action="login"/>  
        </h:form>  

CGLIB 代理类 效率

昨天看《Spring 3.x企业应用开发实战》

作者建议将<aop:config>中的proxy-target-class设置为true,默认是false.

也就是<aop:config proxy-target-class="true">

 

理由是:当为false时,spring使用java jdk的java.lang.reflect包中提供的方式来生成代理类

当为true时,spring使用CGLIB包中提供的方式来生成代理类

而代理类执行效率,CGLIB生成的代理类要比jdk生成的代理类高10倍

而生成代理类效率,jdk是CGLIB的8倍

 

所以在使用单例模式的bean ,建议使用CGLIB生成代理类

 

如果使用CGLIB生成代理类,必须引入CGLIB的jar包

 

至于作者怎么得到10倍 8倍的结论,想google一下,结果:


 

2012年5月22日星期二

让Map根据put的顺序排序

org.apache.commons.collections.map 
Class ListOrderedMap

java.lang.Object org.apache.commons.collections.map.AbstractMapDecoratororg.apache.commons.collections.map.ListOrderedMap

All Implemented Interfaces:
java.io.Serializable, java.util.Map, IterableMapOrderedMap

就这个类可以让我们的Map也能像List一样有序了

 

 

参考:http://blog.csdn.net/zxr85/article/details/6274051

IntelliJ IDEA粘贴多行代码时,总是自动缩进

IntelliJ IDEA粘贴多行代码时,总是自动缩进

 

settings->eidtor->smart keys -> reformat on paste  选择 NONE