lyyb2001

只是为方便自己找记录而已
posts - 54, comments - 27, trackbacks - 0, articles - 5
  BlogJava :: 首页 :: 新随笔 :: 联系 ::  :: 管理

2016年12月8日

try{

JaxWsProxyFactoryBean factoryBean = new JaxWsProxyFactoryBean();

factoryBean.getInInterceptors().add(new LoggingInInterceptor());

factoryBean.getOutInterceptors().add(new LoggingOutInterceptor());

factoryBean.setServiceClass(AutoPackServiceIntf.class);

factoryBean.setAddress("http://10.241.0.105:17000/TEST");

AutoPackServiceIntf factory = (AutoPackServiceIntf) factoryBean.create();

Client client = ClientProxy.getClient(factory);

HTTPConduit conduit = (HTTPConduit) client.getConduit();

HTTPClientPolicy policy = new HTTPClientPolicy();

policy.setConnectionTimeout(30000); //连接超时时间

policy.setReceiveTimeout(120000); //请求超时时间.

conduit.setClient(policy);

System.out.println(factory.getFirstUnitCramp("1"));

}catch(WebServiceException ex){

long l2 = System.currentTimeMillis();

System.out.println((l2-l1)+"ms");

System.out.println("连接异常");

}

posted @ 2016-12-08 14:19 skycity 阅读(86) | 评论 (0)编辑 收藏

2016年11月3日

通过Application

ApplicationContext classPathXmlApplicationContext = new ClassPathXmlApplicationContext();

     classPath = classPathXmlApplicationContext.getResource("classpath:config.properties").getFile().getPath();

        if(classPath.indexOf("WEB-INF")>0){

            classPath = classPath.substring(0,classPath.indexOf("WEB-INF")+7)+"/classes/"+xmlFile;

        }

 

posted @ 2016-11-03 18:17 skycity 阅读(39) | 评论 (0)编辑 收藏

2016年3月22日

@import url(http://www.blogjava.net/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css); @import url(http://www.blogjava.net/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css); @import url(http://www.blogjava.net/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css); @import url(http://www.blogjava.net/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css); @import url(http://www.blogjava.net/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);

Map<Integer,Map<String,List<DocLotDetail>>> amp                            docLotDetailLists.parallelStream().collect(Collectors.groupingBy(DocLotDetail::getGroupOrder,Collectors.groupingBy(DocLotDetail::getBaseValueName)));





amp.forEach((key,value)->{

        System.out.println(key);

         value.forEach((key2,value2)->{

            System.out.println(key2);

        });

});

最终返回的结果

2

随机光盘

3

资料袋附件

4

资料盒附件

5

包装辅料

8

前工序物料






@import url(http://www.blogjava.net/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);

posted @ 2016-03-22 16:14 skycity 阅读(1373) | 评论 (0)编辑 收藏

2016年3月4日

cxf webservice客户端程序在eclipse里面运行的好好的,但是一旦用mvn assembly:assembly将依赖和主代码打成一个可运行的jar时,调用就会出现如下错误:


Exception in thread "main" org.apache.cxf.service.factory.ServiceConstructionException: Could not resolve a binding for null

at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createBindingInfo(AbstractWSDLBasedEndpointFactory.java:352)

at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpointInfo(AbstractWSDLBasedEndpointFactory.java:259)

at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:144)

at org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:91)

at org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:157)

at org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.java:142)

at com.nabf.start.NABFClient.main(NABFClient.java:30)

Caused by: org.apache.cxf.BusException: No binding factory for namespace http://schemas.xmlsoap.org/soap/ registered.

at org.apache.cxf.bus.managers.BindingFactoryManagerImpl.getBindingFactory(BindingFactoryManagerImpl.java:93)

at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createBindingInfo(AbstractWSDLBasedEndpointFactory.java:339)

... 6 more

而用mV clean package dependency:copy-dependencies -DoutputDirectory=target/lib启动的时候加载lib包下所有的文件也不会出现错误

解决办法:在pom.xml的build中添加如下,然后执行mV clean package,打出来的包就含有依赖包,且问题解决。原因?

                            <plugin>

<groupId>org.apache.maven.plugins</groupId>

<artifactId>maven-shade-plugin</artifactId>

<version>1.6</version>

<configuration>

<archive>

<manifest>

<addClasspath>true</addClasspath>

<mainClass>com.nabf.start.NABFClient</mainClass>

</manifest>

</archive>

</configuration>

<executions>

<execution>

<phase>package</phase>

<goals>

<goal>shade</goal>

</goals>

<configuration>

<transformers>

<transformer

implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">

<resource>META-INF/cxf/bus-extensions.txt</resource>

</transformer>

</transformers>

</configuration>

</execution>

</executions>

</plugin> 




@import url(http://www.blogjava.net/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);

posted @ 2016-03-04 15:02 skycity 阅读(473) | 评论 (0)编辑 收藏

2015年6月11日

@import url(http://www.blogjava.net/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);

MessageFormat.format(str,str1,str2,str3)

用于替换str中{0},{1},{2}这样的结构

String.format(str,str1,str2,str3)

用于匹配str中%s的结构

posted @ 2015-06-11 16:10 skycity 阅读(72) | 评论 (0)编辑 收藏

2015年3月27日

package com.skycity.framework.utility;
import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;

import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;

import com.skycity.framework.Constant;

public class EncryptUtil {
    // 加密字符串
    public static String encryptMode(String keybyte, String src) {
        try { // 生成密钥
            SecretKey deskey = new SecretKeySpec(new BASE64Decoder().decodeBuffer(keybyte), Constant.ALGORITHM); // 加密
            Cipher c1 = Cipher.getInstance(Constant.ALGORITHM);
            c1.init(Cipher.ENCRYPT_MODE, deskey);
            byte[] result = c1.doFinal(src.getBytes());
            return new BASE64Encoder().encode(result);
        } catch (java.security.NoSuchAlgorithmException e1) {
            e1.printStackTrace();
        } catch (javax.crypto.NoSuchPaddingException e2) {
            e2.printStackTrace();
        } catch (java.lang.Exception e3) {
            e3.printStackTrace();
        }
        return null;
    }
 
    // 解密字符串
    public static String decryptMode(String keybyte, String encryStr) {
        try { // 生成密钥
            SecretKey deskey = new SecretKeySpec(new BASE64Decoder().decodeBuffer(keybyte), Constant.ALGORITHM); // 解密
            Cipher c1 = Cipher.getInstance(Constant.ALGORITHM);
            c1.init(Cipher.DECRYPT_MODE, deskey);
            byte[] result = c1.doFinal(new BASE64Decoder().decodeBuffer(encryStr));
            return new String(result);
        } catch (java.security.NoSuchAlgorithmException e1) {
            e1.printStackTrace();
        } catch (javax.crypto.NoSuchPaddingException e2) {
            e2.printStackTrace();
        } catch (java.lang.Exception e3) {
            e3.printStackTrace();
        }
        return null;
    }
    //创建一个密钥
    public static byte[] createSecretKey() {
KeyGenerator keygen = null;
try {
keygen = KeyGenerator.getInstance(Constant.ALGORITHM);
SecretKey deskey = keygen.generateKey();
return deskey.getEncoded();
} catch (Exception e) {
LogUtil.error("NoSuchAlgorithmException!");
}
return null;
}
    
    public static void main(String[] args){ 
        final byte[] keyBytes = createSecretKey();    
        String key= new BASE64Encoder().encode(keyBytes);
        String szSrc = "admin";
        System.out.println("加密前的字符串:" + szSrc);
        String password = encryptMode(key,szSrc);
        System.out.println("加密后的字符串:" + password);
String result = decryptMode(key, password);
        System.out.println("解密后的字符串:" + result);
    }
}

数据库表中有一个字段用于保存Key,一个字段用于保存password,更改密码的时候,重新生成一个KEY,然后生成一个PASSWORD,匹配保存到数据库中。
当登陆时,用数据库保存的KEY和password进行解密,然后与登陆时输入的password进行比较,如果相等,则成功。
算法支持AES,DES,DESede,Blowfish等算法

posted @ 2015-03-27 10:50 skycity 阅读(61) | 评论 (0)编辑 收藏

@import url(http://www.blogjava.net/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);

public static String readString = "Print([QDT],[Read([SQLServer#10.176.1.178#Mas2006],[select top 1 print_model + '.jasper' as reportname from tbl_mas_print_stru where Machine_No='SS110521Z8'],['@@Lang'])],[Read([SQLServer#10.176.1.178#Mas2006],[select  Machine_No, Check_Code, Model_Packing, Start_Date, Material_Name, Material_No, IIPC_part_code, Material_Qty, Print_Order, Machine_Product_No, print_model, SoftWareName, SoftWare_No, SoftWareQty from dbo.tbl_mas_print_stru where Machine_No='SS110521Z8'],['@@Lang'])])";


public static void splitScriptWithMethod(String script) {

// check if args

String subMethodReg = "";

if(script.indexOf("Read([") !=script.lastIndexOf("Read([")){

subMethodReg = "(.+)\\(\\[(.+)\\],\\[(.+\\(\\[.+\\]\\))\\],\\[(.+\\(\\[.+\\]\\))\\]";

}else{

subMethodReg = "(.+)\\(\\[(.+)\\],\\[(.+)\\],\\[(.+\\(\\[.+\\]\\))\\]";

}

Pattern p = Pattern.compile(subMethodReg);

Matcher matcher = p.matcher(readString);

while (matcher.find()) {

for (int i = 1; i <= matcher.groupCount(); i++) {  

            System.out.println("grp " + i + " :" + matcher.group(i));  

        } 

}

}



grp 1 :Print

grp 2 :QDT

grp 3 :Read([SQLServer#10.176.1.178#Mas2006],[select top 1 print_model + '.jasper' as reportname from tbl_mas_print_stru where Machine_No='SS110521Z8'],['@@Lang'])

grp 4 :Read([SQLServer#10.176.1.178#Mas2006],[select  Machine_No, Check_Code, Model_Packing, Start_Date, Material_Name, Material_No, IIPC_part_code, Material_Qty, Print_Order, Machine_Product_No, print_model, SoftWareName, SoftWare_No, SoftWareQty from dbo.tbl_mas_print_stru where Machine_No='SS110521Z8'],['@@Lang'])


其中,用于匹配(.+)\\(\\[(.+)\\],\\[(.+\\(\\[.+\\]\\))\\],\\[(.+\\(\\[.+\\]\\))\\],print([],[Read([],[],[])],[Read([],[],[])])这样的结构
而(.+)\\(\\[(.+)\\],\\[(.+)\\],\\[(.+\\(\\[.+\\]\\))\\],用于匹配print([],[],[Read([],[],[])]这样的结构

posted @ 2015-03-27 10:41 skycity 阅读(67) | 评论 (0)编辑 收藏

@import url(http://www.blogjava.net/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css); @import url(http://www.blogjava.net/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css); 在/Library/LaunchDaemons下
新建svn.sh,内容如下

/usr/bin/svnserve -d -r /Users/YingBo/svn/repository


chmod +x svn.sh


新建com.skycity.svn.plist,内容如下

<?xml version="1.0" encoding="UTF-8"?>  

<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">

<plist version="1.0">

  <dict>

    <key>KeepAlive</key>

    <true/>

    <key>Label</key>

    <string>com.skycity.svn</string>

    <key>ProgramArguments</key>

    <array>

    <string>/Library/LaunchDaemons/svn.sh</string>

    </array>

  </dict>

</plist>


设置开机自动启动

 sudo launchctl load -w /Library/LaunchDaemons/com.skycity.svn.plist


设置开机不自动启动

 sudo launchctl unload -w /Library/LaunchDaemons/com.skycity.svn.plist

posted @ 2015-03-27 10:36 skycity 阅读(76) | 评论 (0)编辑 收藏

2015年3月20日

查看当前java版本
$ java -version

java version "1.8.0_25"

Java(TM) SE Runtime Environment (build 1.8.0_25-b17)

Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)

$ which java
/usr/bin/java

$ ls -l /usr/bin/java

lrwxr-xr-x  1 root  wheel  74 12 26 10:24 /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java


ls -l /System/Library/Frameworks/JavaVM.framework/Versions/

total 64

lrwxr-xr-x  1 root  wheel   10 12 26 10:24 1.4 -> CurrentJDK

lrwxr-xr-x  1 root  wheel   10 12 26 10:24 1.4.2 -> CurrentJDK

lrwxr-xr-x  1 root  wheel   10 12 26 10:24 1.5 -> CurrentJDK

lrwxr-xr-x  1 root  wheel   10 12 26 10:24 1.5.0 -> CurrentJDK

lrwxr-xr-x  1 root  wheel   10 12 26 10:24 1.6 -> CurrentJDK

lrwxr-xr-x  1 root  wheel   10 12 26 10:24 1.6.0 -> CurrentJDK

drwxr-xr-x  8 root  wheel  272 12 26 14:10 A

lrwxr-xr-x  1 root  wheel    1 12 26 10:24 Current -> A

lrwxr-xr-x  1 root  wheel   59 12 26 10:24 CurrentJDK -> /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents


由此可知,当前java所对应的文件是/System/Library/Frameworks/JavaVm.Framework/Vesions/A/Commons/java

 /System/Library/Frameworks/JavaVM.framework/Versions/下的jdk 1.4-1.6的版本,全部指向/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents

posted @ 2015-03-20 10:24 skycity 阅读(158) | 评论 (0)编辑 收藏

yum remove ibus* yum remove scim* yum install fcitx fcitx-table fcitx-table-chinese fcitx-pinyin

posted @ 2015-03-20 09:42 skycity 阅读(36) | 评论 (0)编辑 收藏