(C#转JAVA)DES加密解密问题 。带入整8B加密数据, JAVA写的总是比C#写的多出来8B 1C

C#

private byte[] CSharpEncryptByte(byte[] InputByte, byte[] sKey)

{

   DESCryptoServiceProvider DES = new DESCryptoServiceProvider();

   DES.Padding = PaddingMode.Zeros;

   DES.Key = sKey;

   DES.IV = new byte[] { 0, 0, 0, 0, 0, 0, 0, 0 };

   ICryptoTransform desencrypt = DES.CreateEncryptor();

   byte[] result = desencrypt.TransformFinalBlock(InputByte, 0, InputByte.Length);

   return result;

}

JAVA

public static byte[] JavaEncryptByte(byte[] InputByte, byte[] bKey)
throws Exception
{
byte[] ivdata = new byte[]{0, 0, 0, 0, 0, 0, 0, 0};
IvParameterSpec spec = new IvParameterSpec(ivdata);
SecretKeySpec keySpec = new SecretKeySpec(bKey, "DES");
Cipher cipherex = Cipher.getInstance("DES/CBC/ZeroBytePadding");
cipherex.init(Cipher.ENCRYPT_MODE, keySpec, spec);
byte[] encdata = cipherex.doFinal(InputByte, 0, InputByte.length);
return encdata;
}

1个回答

试试看ECB模式,DES/ECB/ZeroBytePadding

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
readUTF()使用报 java.io.EOFException异常

今天在编程的时候,用到了DataInPutStream类的readUTF()方法时报了个异常,查了好多资料也不能解决,求大神指点啊.高分悬赏. ``` package IO流; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; public class DataTest { /** * 数据输入输出流 * */ public static void main(String[] args) throws IOException { //向指定文件中写入数据 //打开文件输出流 FileOutputStream fos=new FileOutputStream("G://word.txt"); //将此输出流链接到指定基础输出流DataOutPutStream DataOutputStream dos=new DataOutputStream(fos); //写入数据: dos.writeBytes("我是大禹!");//用此方法写入的数据用记事本打开是乱码 dos.writeChars("我治水!");//用此方法写入的数据用记事本打开是乱码 dos.writeUTF("你智障吗?"); //关闭流 fos.close(); //从文件中读取数据 //首先打开文件输入流 FileInputStream fis=new FileInputStream("G://word.txt"); //将此输入流连接到基本数据输入流DataInPutStream DataInputStream dis=new DataInputStream(fis); //开始读取数据啦 // String s=dis.readUTF(); System.out.println(dis.readUTF()); dis.close(); } } ``` 异常信息: Exception in thread "main" java.io.EOFException at java.io.DataInputStream.readFully(DataInputStream.java:180) at java.io.DataInputStream.readUTF(DataInputStream.java:592) at java.io.DataInputStream.readUTF(DataInputStream.java:547) at IO流.DataTest.main(DataTest.java:35)

java.lang.OutOfMemoryError: PermGen space

org.springframework.web.util.NestedServletException: Handler processing failed; nested exception is java.lang.OutOfMemoryError: PermGen space at org.springframework.web.servlet.DispatcherServlet.doDispatch(Dispatch erServlet.java:839) at org.springframework.web.servlet.DispatcherServlet.doService(Dispatche rServlet.java:719) at org.springframework.web.servlet.FrameworkServlet.processRequest(Frame workServlet.java:644) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServl et.java:549) at javax.servlet.http.HttpServlet.service(HttpServlet.java:621) at javax.servlet.http.HttpServlet.service(HttpServlet.java:728) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl icationFilterChain.java:305) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF ilterChain.java:210) at com.vshine.wyj.web.filter.SecurityFilter.doFilter(SecurityFilter.java :104) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl icationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF ilterChain.java:210) at com.vshine.wyj.web.filter.EncodingFilter.doFilter(EncodingFilter.java :32) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl icationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF ilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV alve.java:222) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV alve.java:123) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authentica torBase.java:502) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j ava:171) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j ava:99) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java: 953) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal ve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav a:408) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp 11Processor.java:1023) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process( AbstractProtocol.java:589) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoin t.java:312) 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.OutOfMemoryError: PermGen space at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.access$100(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.generateCode(Ty peDeclaration.java:521) at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.generateCode(Ty peDeclaration.java:620) at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.gene rateCode(CompilationUnitDeclaration.java:360) at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:781) at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:470) at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java :458) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:378) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:353) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:340) at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext .java:646) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper .java:357) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:3 90) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334) at javax.servlet.http.HttpServlet.service(HttpServlet.java:728) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl icationFilterChain.java:305) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF ilterChain.java:210) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDisp atcher.java:749) at org.apache.catalina.core.ApplicationDispatcher.processRequest(Applica tionDispatcher.java:487) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationD ispatcher.java:412) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDis patcher.java:339) at org.springframework.web.servlet.view.InternalResourceView.renderMerge dOutputModel(InternalResourceView.java:238) 服务器的已经运行一段时间的项目最近开始报这个内存溢出的异常,求解!

JAV求代码,实现连接数据库,并执行写在XML中的SQL

最好详细一点,新手小白。 就是按照需求,以后修改SQL都再配置文件中修改而不修改代码。

驱动程序无法使用安全套接字层(SSL)加密与 SQL Server 建立安全连接。

警告: TDSChannel ( ConnectionID:1 TransactionID:0x0000000000000000) SSL handshake failed: java.lang.RuntimeException: Could not generate DH keypair com.microsoft.sqlserver.jdbc.SQLServerException: 驱动程序无法使用安全套接字层(SSL)加密与 SQL Server 建立安全连接。错误: java.lang.RuntimeException: Could not generate DH keypair。 at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(Unknown Source) at com.microsoft.sqlserver.jdbc.TDSChannel.throwSSLConnectionFailed(Unknown Source) at com.microsoft.sqlserver.jdbc.TDSChannel.enableSSL(Unknown Source) at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(Unknown Source) at com.microsoft.sqlserver.jdbc.SQLServerConnection.loginWithoutFailover(Unknown Source) at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(Unknown Source) at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(Unknown Source) at java.sql.DriverManager.getConnection(DriverManager.java:582) at java.sql.DriverManager.getConnection(DriverManager.java:185) 一直都用JDK1.8+sqljdbc都能运行,最近几天突然不能运行了

html转word,保留样式和表格格式及图片,求demo

我试过两种办法: 1.通过把整个Html传到后台通过POI来解析生成 问题:表格没有,图片无法显示,还需要把doc手动改为docx 2.前台通过wordexport.js实现导出word 问题: 表格样式很难看,看JS源码无法找到更改的地方,无法保存到服务器 求:解决以下问题 不管是前台后台解决都可以 1.保留html原有样式 2.生成表格的样式 最好可以调 或者给一些参考样式 3.图片能正常显示 4:word文件能保存到服务器

Java音频播放,只播放本地音乐

package com.rjxy.Music1_1; import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import javazoom.jl.decoder.JavaLayerException; import javazoom.jl.player.Player; public class Music1 implements Runnable{ String path = "D:/java/青柠.wav"; File file = null; BufferedInputStream is = null; //mian()方法 public static void main(String args[]) { Music1 music = new Music1(); Thread thread = new Thread(music); thread.start(); } //重写run() public void run() { try { file = new File(path); is = new BufferedInputStream(new FileInputStream(file)); System.out.println(file.getName()+" 加载成功!"); } catch (FileNotFoundException e) { System.out.println(file.getName()+" 加载失败!"); e.printStackTrace(); } try { new Player(is); System.out.println("palyer创建成功!"); } catch (JavaLayerException e) { System.out.println("player创建失败!"); e.printStackTrace(); } try { Thread.sleep(64000); System.out.println("Thread休眠!"); } catch (InterruptedException e) { System.out.println("Thread休眠失败!"); e.printStackTrace(); } } } 为什么编译运行都不报错,但是为什么没有声音? 求大佬帮忙

JAV类的静态变量在项目启动时初始化,在项目启动后怎么通过接口修改

@RequestMapping("/refreshCacheData.do") public String refreshCacheData() { BasicDataDao basicDataDao = new BasicDataDao(); basicDataDao.load(); return "Refresh cache data success!"; } 通过这个接口去重新调用load()方法,貌似不行。 下面是类的定义: @Repository public class BasicDataDao extends BaseDaoImpl { /** 同步的所有人员信息 */ static List<TSysStaff> users; /** 按code和登录名缓存的人员map数据 */ static Map<Object, TSysStaff> usersMap; /** 同步的所有人员归属部门信息 */ static List<TSysStaffOrg> usersOrg; /** 按人员code缓存的人员归属部门map数据 */ static Map<Object, TSysStaffOrg> usersOrgMap; /** 同步的所有部门机构信息 */ static List<TSysOrg> depts; /** 按code缓存的组织部门信息 */ static Map<Object, TSysOrg> deptsMap; /** 同步的所有SAP过来的日历信息 */ static List<TSysCalendar> calendars; /** 同步的所有cost center的数据 */ static List<TSysCostcenter> costCenters; /** 按code缓存的cost center信息 */ static Map<Object, TSysCostcenter> costcenterMap; /** 同步的所有wbs的数据 */ static List<TSysWbs> wbss; /** 按code缓存的wbs信息 */ static Map<Object, TSysWbs> wbsMap; /** 同步的所有国家的数据 */ static List<TSysCountry> countries; /** 按code缓存的国家信息 */ static Map<Object, TSysCountry> countryMap; /** 同步的所有币种信息 */ static List<TSysCurrency> currencies; /** 按code缓存的币种信息 */ static Map<Object, TSysCurrency> currenciesMap; /** 同步的所有省份信息 */ static List<TSysProvince> provinces; /** 按code缓存的省份信息 */ static Map<Object, TSysProvince> provinceMap; /** 查询用户的SQL */ @Value("${basicdata.sql.users}") private String usersSql; /** 查询用户归属部门的SQL */ @Value("${basicdata.sql.users.org}") private String usersOrgSql; /** 查询部门的SQL */ @Value("${basicdata.sql.depts}") private String deptsSql; /** 查询日历的SQL */ @Value("${basicdata.sql.calendars}") private String calendarsSql; /** 查询cost center的SQL */ @Value("${basicdata.sql.costCenter}") private String costCenterSql; /** 查询wbs的SQL */ @Value("${basicdata.sql.wbs}") private String wbsSql; /** 查询国家的SQL */ @Value("${basicdata.sql.country}") private String countrySql; /** 查询省份的SQL */ @Value("${basicdata.sql.province}") private String provinceSql; /** 查询币种的SQL */ @Value("${basicdata.sql.currencies}") private String currenciesSql; /** 读取所有需要缓存到本地的基础数据 */ @PostConstruct public void load() { users = this.query(usersSql, TSysStaff.class); usersMap = this.listToMap(users, "pkId", "staffCode", "staffEnName", "staffDisName"); usersOrg = this.query(usersOrgSql, TSysStaffOrg.class); usersOrgMap = this.listToMap(usersOrg, "pkId", "staffCode"); calendars = this.query(calendarsSql, TSysCalendar.class); costCenters = this.query(costCenterSql, TSysCostcenter.class); costcenterMap = this.listToMap(costCenters, "pkId", "costcenterCode"); wbss = this.query(wbsSql, TSysWbs.class); wbsMap = this.listToMap(wbss, "pkId", "wbsCode"); countries = this.query(countrySql, TSysCountry.class); countryMap = this.listToMap(countries, "pkId", "countryCode"); provinces = this.query(provinceSql, TSysProvince.class); provinceMap = this.listToMap(provinces, "pkId", "provinceCode"); depts = this.query(deptsSql, TSysOrg.class); deptsMap = this.listToMap(depts, "pkId", "orgCode"); currencies = this.query(currenciesSql, TSysCurrency.class); currenciesMap = this.listToMap(currencies, "pkId", "currencyCode"); } /** * 根据sql读取实体对象entityClass的列表,这个方法有可能不通过web访问,所以opensession. * * @param sql 查询SQL * @param entityClass 实体类 * @param args 查询参数 * @return */ @SuppressWarnings("unchecked") public <T> List<T> query(final String sql, final Class<T> entityClass, final Object... args) { return getHibernateTemplate().execute(new HibernateCallback<List<T>>() { @Override public List<T> doInHibernate(Session session) throws HibernateException { SQLQuery query = session.createSQLQuery(sql); query.setResultTransformer(ColumnsToBeanResultTransformer.columnsToBean(entityClass)); if (args != null && args.length > 0) { for (int i = 0, l = args.length; i < l; i++) { query.setParameter(i, args[i]); } } List<T> list = query.list(); return list; } }); } /** * 将实体列表转换为map,key为每个实体对象的propertyNames属性的值 * * @param list 实体对象列表 * @param propertyNames 作为map的key的属性名.每个对象会使用其对应的属性名作为map的key * @return */ public <T> Map<Object, T> listToMap(List<T> list, String... propertyNames) { Map<Object, T> map = new LinkedHashMap<Object, T>(); for (T e : list) { for (String propertyName : propertyNames) { map.put(BeanHelper.getPropertyValue(e, propertyName), e); } } return map; } /** * 所有人员数据. * * @return 所有员工基础数据 */ public static List<TSysStaff> getUsers() { return users; } /** * 根据人员代码或登录名读取人员数据 * * @param code 人员代码或登录名 * @return 代码或登录名为code的人员 */ public static TSysStaff getUser(String code) { return usersMap.get(code); } /** * 根据人员代码或登录名读取人员数据 * * @param disName 人员显示名字 * @return 显示名字为disName的人员 */ public static TSysStaff getUserByDisName(String disName) { return usersMap.get(disName); } //模糊查询 public static List<TSysStaff> getUserLikeSearchWithDisName(String disName) { List<TSysStaff> tSysStaffs = new ArrayList<>(); for(TSysStaff tSysStaff : users){ if(!StringUtils.isEmpty(tSysStaff.getStaffDisName()) && tSysStaff.getStaffDisName().contains(disName)){ tSysStaffs.add(tSysStaff); } } return tSysStaffs; } /** * 根据人员代码读取人员归属机构数据 * * @param code 人员代码 * @return 人员归属机构数据 */ public static TSysStaffOrg getUserOrg(String code) { return usersOrgMap.get(code); } /** * 根据人员代码读取人员归属机构数据 * * @param code 人员代码 * @return 人员归属机构数据 */ public static List<TSysCalendar> getTSysCalendar() { return calendars; } /** * 所有组织部门数据 * * @return 所有组织部门数据 */ public static List<TSysOrg> getDepts() { return depts; } /** * 根据部门代码读取数据 * * @param code 部门代码 * @return 代码为code的部门 */ public static TSysOrg getDept(String code) { return deptsMap.get(code); } /** * 所有cost center数据 * * @return 所有cost center数据 */ public static List<TSysCostcenter> getTSysCostcenters() { return costCenters; } /** * 根据cost center代码读取数据 * * @param code cost center代码 * @return 代码为code的cost center */ public static TSysCostcenter getTSysCostcenter(String code) { return costcenterMap.get(code); } /** * 所有WBS数据 * * @return 所有WBS数据 */ public static List<TSysWbs> getTSysWbss() { return wbss; } /** * 根据wbs代码读取数据 * * @param code wbs代码 * @return 代码为code的wbs */ public static TSysWbs getTSysWbs(String code) { return wbsMap.get(code); } /** * 所有国家数据 * * @return 所有国家数据 */ public static List<TSysCountry> getTSysCountries() { return countries; } /** * 根据国家代码读取数据 * * @param code 国家代码 * @return 代码为code的国家 */ public static TSysCountry getTSysCountry(String code) { return countryMap.get(code); } /** * 所有省份数据 * * @return 所有省份数据 */ public static List<TSysProvince> getTSysProvinces() { return provinces; } /** * 根据省份代码读取数据 * * @param code 省份代码 * @return 代码为code的省份 */ public static TSysProvince getTSysProvince(String code) { return provinceMap.get(code); } /** * 所有币种数据 * * @return 所有组织部门数据 */ public static List<TSysCurrency> getCurrencies() { return currencies; } /** * 根据币种代码得到币种数据 * * @param code 币种代码 * @return 代码为code的币种数据 */ public static TSysCurrency getCurrency(String code) { return currenciesMap.get(code); } 但是通过schedule却可以调用成功: <bean id="refreshDBCache" class="com.*.common.dao.BasicDataDao"></bean> <task:scheduled-tasks> <task:scheduled ref="refreshDBCache" method="load" cron="0 0 0,12 * * ?" /> </task:scheduled-tasks>

我在使用System.load(path);报了一个异常java.lang.UnsatisfiedLinkError

我在使用System.load(path);报了一个异常java.lang.UnsatisfiedLinkError: Can't load library:+ path path 为D:/Program Files/Apache Software Foundation/Tomca 6.0/webapps/o3shoe/WEB-INF/SentinelKeysJDK.dll,[color=red]但是该目录下又存在这个[/color]SentinelKeysJDK.dll文件

关于java.lang.OutOfMemoryError: PermGen space的问题

昨天在测试做一个审批流程过程中突然报了java.lang.OutOfMemoryError: PermGen space的错误。![图片说明](https://img-ask.csdn.net/upload/201708/23/1503476599_700481.png)![图片说明](https://img-ask.csdn.net/upload/201708/23/1503476607_47576.png)![图片说明](https://img-ask.csdn.net/upload/201708/23/1503476613_777099.png)![图片说明](https://img-ask.csdn.net/upload/201708/23/1503476621_918731.png) 上面是错误日志截图 我本机的测试环境跑了近一年了,都没出这样的问题。 其中at com.wondersgroup.cim.innerManager.action.InnerManagerAction.itemChangeAuditPass(InnerManagerAction.java:2635)这做的是一个常规的数据库更新操作, at com.wondersgroup.cim.common.utils.SendMessageUtil.doLogin(SendMessageUtil.java:57) at com.wondersgroup.cim.common.utils.SendMessageUtil.sendMessage(SendMessageUtil.java:28)这做的是一个调用web service操作。 另外我没有额外配置PermSize和MaxPermSize,都是默认值。 这个问题到底是怎么产生的,不应该是JVM内存问题啊,如果是内存溢出,那么这个问题是会经常出现,但我就昨天出现了一次,在怎么也还原不出这个错误了, 请问各位大神,这是怎么个情况

java.lang.NullPointerException?空指向异常是与数据库有关吗?

java.lang.NullPointerException com.wgh.tools.ConnDB.executeQuery(ConnDB.java:56) com.wgh.dao.DiaryDao.queryDiary(DiaryDao.java:28) com.wgh.servlet.DiaryServlet.listAllDiary(DiaryServlet.java:249) com.wgh.servlet.DiaryServlet.doPost(DiaryServlet.java:52) com.wgh.servlet.DiaryServlet.doGet(DiaryServlet.java:66) javax.servlet.http.HttpServlet.service(HttpServlet.java:624) javax.servlet.http.HttpServlet.service(HttpServlet.java:731) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) com.wgh.filter.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:24) 空指向异常,这个是与数据库有关吗?怎么解决,请高手帮忙解答,感激不尽。

java.lang.IllegalArgumentException

java.lang.IllegalArgumentException: Cannot convert value of type [com.citics.monitor.f9.service.F009Service] to required type [com.citics.monitor.f8.service.F008Service] for property 'service': no matching editors or conversion strategy found at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:219) at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:138) at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:386) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1288) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1249) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireBeanProperties(AbstractAutowireCapableBeanFactory.java:329) at com.opensymphony.xwork2.spring.SpringObjectFactory.autoWireBean(SpringObjectFactory.java:167) at com.opensymphony.xwork2.spring.SpringObjectFactory.buildBean(SpringObjectFactory.java:154) at com.opensymphony.xwork2.spring.SpringObjectFactory.buildBean(SpringObjectFactory.java:128) at com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:143) at com.opensymphony.xwork2.ObjectFactory.buildAction(ObjectFactory.java:113) at com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:275) at com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:365) at com.opensymphony.xwork2.DefaultActionInvocation.access$000(DefaultActionInvocation.java:38) at com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:83) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) at com.opensymphony.xwork2.DefaultActionInvocation.<init>(DefaultActionInvocation.java:74) at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:189) at org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:41) at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:494) at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:422) at com.citics.pif.commons.web.FilterDispatcher.doFilter(FilterDispatcher.java:55) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:265) at org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:107) at org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:72) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275) at org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:110) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275) at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275) at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:231) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275) at com.citics.ceap.security.sso.CeapSSOTAMFilter.doFilter(CeapSSOTAMFilter.java:38) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275) at org.acegisecurity.ui.logout.LogoutFilter.doFilter(LogoutFilter.java:106) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275) at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:288) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275) at org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:149) at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:96) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run(Thread.java:619)

用cmd命令执行java程序后,无响应,无报错

如图,回车执行后,无响应,简单问题,新手诚心提问,望不吝赐教。 ![图片说明](https://img-ask.csdn.net/upload/201508/24/1440387031_710814.png)

刚开始学java,问一道关于javafx的问题

我运行了课本后面的关于按钮的程序,代码是直接从老师给的代码拷到我自己的工程里面的,但是运行一直报错,在老师给的那个book工程里面运行就不会报错, 下面是代码 ![图片说明]图片说明(http://img.a![图片说明](https://img-ask.csdn.net/upload/201712/07/1512636988_6551.png)sk.csdn.net/upload/201712/07/1512636945_589510.png) 下面是提示报错 Exception in Application start method java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:389) at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at sun.launcher.LauncherHelper$FXHelper.main(Unknown Source) Caused by: java.lang.RuntimeException: Exception in Application start method at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:917) at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$155(LauncherImpl.java:182) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.IllegalArgumentException: Invalid URL: Invalid URL or resource not found at javafx.scene.image.Image.validateUrl(Image.java:1118) at javafx.scene.image.Image.(Image.java:620) at javafx.scene.image.ImageView.(ImageView.java:166) at ButtonDemo.getPane(ButtonDemo.java:18) at ButtonDemo.start(ButtonDemo.java:41) at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$162(LauncherImpl.java:863) at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(PlatformImpl.java:326) at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295) at java.security.AccessController.doPrivileged(Native Method) at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294) at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95) at com.sun.glass.ui.win.WinApplication._runLoop(Native Method) at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191) ... 1 more Caused by: java.lang.IllegalArgumentException: Invalid URL or resource not found at javafx.scene.image.Image.validateUrl(Image.java:1110) ... 13 more Exception running application ButtonDemo 我想问一下这个是不是因为我的工程里面缺少了什么配置啊?请大神指点

MyBatis Generator 运行问题,怎么报类型转换错误,求大神帮组

java.sql.SQLException: java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.lang.Long at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1074) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:988) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:974) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:919) at com.mysql.jdbc.ConnectionImpl.buildCollationMapping(ConnectionImpl.ja va:1041) at com.mysql.jdbc.ConnectionImpl.initializePropsFromServer(ConnectionImp l.java:3481) at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2 445) at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2215) at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:813) at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Sou rce) at java.lang.reflect.Constructor.newInstance(Unknown Source) at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:399) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java :334) at org.mybatis.generator.internal.db.ConnectionFactory.getConnection(Con nectionFactory.java:68) at org.mybatis.generator.config.Context.getConnection(Context.java:526) at org.mybatis.generator.config.Context.introspectTables(Context.java:43 6) at org.mybatis.generator.api.MyBatisGenerator.generate(MyBatisGenerator. java:222) at org.mybatis.generator.api.ShellRunner.main(ShellRunner.java:117) Caused by: java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.lang.Long at com.mysql.jdbc.ConnectionImpl.buildCollationMapping(ConnectionImpl.ja va:992) ... 17 more D:\generator>java -jar mybatis-generator-core-1.3.2.jar -configfile generator.xm l -overwrite java.sql.SQLException: java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.lang.Long at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1074) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:988) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:974) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:919) at com.mysql.jdbc.ConnectionImpl.buildCollationMapping(ConnectionImpl.ja va:1041) at com.mysql.jdbc.ConnectionImpl.initializePropsFromServer(ConnectionImp l.java:3481) at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2 445) at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2215) at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:813) at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Sou rce) at java.lang.reflect.Constructor.newInstance(Unknown Source) at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:399) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java :334) at org.mybatis.generator.internal.db.ConnectionFactory.getConnection(Con nectionFactory.java:68) at org.mybatis.generator.config.Context.getConnection(Context.java:526) at org.mybatis.generator.config.Context.introspectTables(Context.java:43 6) at org.mybatis.generator.api.MyBatisGenerator.generate(MyBatisGenerator. java:222) at org.mybatis.generator.api.ShellRunner.main(ShellRunner.java:117) Caused by: java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.lang.Long at com.mysql.jdbc.ConnectionImpl.buildCollationMapping(ConnectionImpl.ja va:992) ... 17 more <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd"> <generatorConfiguration> <classPathEntry location="D:\generator\mysql-connector-java-5.1.21.jar" /> <context id="DB2Tables" targetRuntime="MyBatis3"> <commentGenerator> <property name="suppressAllComments" value="true" /> </commentGenerator> <jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://localhost/test" userId="root" password="root"> </jdbcConnection> <javaTypeResolver > <property name="forceBigDecimals" value="false" /> </javaTypeResolver> <javaModelGenerator targetPackage="com.dto" targetProject="D:\generator\src"> <property name="enableSubPackages" value="true" /> <property name="trimStrings" value="true" /> </javaModelGenerator> <sqlMapGenerator targetPackage="com.mapping" targetProject="D:\generator\src"> <property name="enableSubPackages" value="true" /> </sqlMapGenerator> <javaClientGenerator type="XMLMAPPER" targetPackage="com.dao" targetProject="D:\generator\src"> <property name="enableSubPackages" value="true" /> </javaClientGenerator> <table tableName="user" domainObjectName="User" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false" /> </context> </generatorConfiguration>

java.util.Date的一个bug还是因为什么别的其他原因?

我始终无法用java.util.Date类来描述19900415这个日子 执行如下代码得到的却是1990-04-15 01:00:00,这个是不是夏时制的问题?怎么解决呢? SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd HH:mm:ss"); Date d =sdf.parse("1990-04-15 00:00:00"); String s =sdf.format(d); System.out.println(s); 我使用的jdk版本是1.6_13

大型Java项目如何实现不停机维护的?求大神解答

一直很好奇,大型Java项目如何实现不停机维护的?比如支付宝的后台? 还有个疑问就是比如说某个方法执行的时间比较长比如说需要耗时10s,如果某个用户在访问某台服务器的时候,当这个方法执行到5s的时候,这个服务器要进行更新,那这个方法没有走完服务就停掉了,如何处理的这种问题?

坐等求救,java用ssh的时候,Gson解析json有外键的时候报错

解析json是用的gson,实体类涉及到三张表三个类,之间的关系是: C表的一个字段是外键,为A表的主键 C表的另一个字段是外键,为B表的主键 转json的时候报如下异常,该怎么做,请具体一点. 这是多对多的关系吧? java.lang.UnsupportedOperationException: Attempted to serialize java.lang.Class: org.hibernate.proxy.HibernateProxy. Forgot to register a type adapter? at com.google.gson.internal.bind.TypeAdapters$1.write(TypeAdapters.java:67) at com.google.gson.internal.bind.TypeAdapters$1.write(TypeAdapters.java:61) at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:68) at com.google.gson.internal.bind.ArrayTypeAdapter.write(ArrayTypeAdapter.java:93) at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:68) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.write(ReflectiveTypeAdapterFactory.java:89) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:195) at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:68) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.write(ReflectiveTypeAdapterFactory.java:89) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:195) at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:68) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.write(ReflectiveTypeAdapterFactory.java:89) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:195) at com.google.gson.internal.bind.ObjectTypeAdapter.write(ObjectTypeAdapter.java:107) at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:68) at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.write(CollectionTypeAdapterFactory.java:96) at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.write(CollectionTypeAdapterFactory.java:60) at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:68) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.write(ReflectiveTypeAdapterFactory.java:89) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:195) at com.google.gson.Gson.toJson(Gson.java:593) at com.google.gson.Gson.toJson(Gson.java:572) at com.google.gson.Gson.toJson(Gson.java:527) at com.chebeiyuan.utils.GsonUtil.objectToString(GsonUtil.java:29) at com.chebeiyuan.action.BaseAction.setResultJson(BaseAction.java:136) at com.chebeiyuan.action.BaseAction.setSuccessJson(BaseAction.java:149) at com.chebeiyuan.action.CarTypeAction.getUserCarList(CarTypeAction.java:51) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:441) at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:280) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:243) at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:165) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:252) at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:179) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:235) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:89) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:130) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:138) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:165) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:179) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52) at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:488) at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77) at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454) at java.lang.Thread.run(Thread.java:619)

java连接sqlserver数据库库出错,不知如何解决,求大神

我按网上给的一些解决办法尝试都没成功 TCP/IP已经启用,并且ip1和10的地址被设定为127.0.0.1,all端口设定为1433 ms-dos中输入telnet 127.0.0.1 1433,则出现了一个名为telnet 127.0.0.1 新的控制台,运行后错错误如下:另外,因为工作方面的原因最近经常要用java连接sql server,中间出现错误但是却不理解,有没有那本书是专门讲解这些错误的意义的 com.microsoft.sqlserver.jdbc.SQLServerException: 用户 'sa' 登录失败。 ClientConnectionId:cd23a148-7cb6-4bc9-86de-e10675fe5d1b at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:216) at com.microsoft.sqlserver.jdbc.TDSTokenHandler.onEOF(tdsparser.java:254) at com.microsoft.sqlserver.jdbc.TDSParser.parse(tdsparser.java:84) at com.microsoft.sqlserver.jdbc.SQLServerConnection.sendLogon(SQLServerConnection.java:2908) at com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(SQLServerConnection.java:2234) at com.microsoft.sqlserver.jdbc.SQLServerConnection.access$000(SQLServerConnection.java:41) at com.microsoft.sqlserver.jdbc.SQLServerConnection$LogonCommand.doExecute(SQLServerConnection.java:2220) at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:5696) at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1715) at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1326) at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:991) at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:827) at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1012) at java.sql.DriverManager.getConnection(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at zidingyi.GetConnectionSqlServer.getConnectionSqlServer(GetConnectionSqlServer.java:24) at zidingyi.Try.main(Try.java:8) 我的代码如下 ``` public class GetConnectionSqlServer { public void getConnectionSqlServer() { String driverName = "com.microsoft.jdbc.sqlserver.SQLServerDriver"; String dbURL = "jdbc:sqlserver://MIAO-PC\\MIAO\\\\SQLEXPRESS:1433;databasename=stmodel"; // 1433是端口,"USCSecondhandMarketDB"是数据库名称 String userName = "sa"; // 用户名 String userPwd = "sa"; // 密码 Connection dbConn = null; try { Class.forName(driverName).newInstance(); System.out.println("驱动加载成功"); } catch (Exception ex) { System.out.println("驱动加载失败"); ex.printStackTrace(); } try { dbConn = DriverManager.getConnection(dbURL, userName, userPwd); System.out.println("成功连接数据库!"); } catch (Exception e) { System.out.println("地址端口数据库用户名密码出错"); e.printStackTrace(); } finally { try { if (dbConn != null) dbConn.close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } ```

这个java代码有什么问题吗,怎么报了那么多错

``` package Package1; import java.sql.*; import java.awt.BorderLayout; import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import javax.swing.JTextField; import javax.swing.JLabel; import javax.swing.JPasswordField; import javax.swing.JButton; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import javax.swing.JTextArea; public class Register extends JFrame{ private JPanel contentPane; private JTextField textField; private JTextField textField_2; private JPasswordField passwordField; private JTextField textField_1; private JTextField textField_3; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { Register frame = new Register(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the frame. */ public Register() throws Exception{ super("注册界面"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 526, 432); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); textField = new JTextField(); textField.setBounds(151, 33, 223, 24); contentPane.add(textField); textField.setColumns(10); JLabel label = new JLabel("用户名:"); label.setBounds(32, 36, 72, 18); contentPane.add(label); JLabel label_1 = new JLabel("\u5BC6 \u7801\uFF1A"); label_1.setBounds(32, 88, 72, 18); contentPane.add(label_1); JLabel label_2 = new JLabel("\u59D3 \u540D\uFF1A"); label_2.setBounds(32, 138, 72, 18); contentPane.add(label_2); textField_2 = new JTextField(); textField_2.setColumns(10); textField_2.setBounds(151, 135, 223, 24); contentPane.add(textField_2); passwordField = new JPasswordField(); passwordField.setBounds(151, 85, 223, 24); contentPane.add(passwordField); JLabel label_3 = new JLabel("\u5B66 \u53F7\uFF1A"); label_3.setBounds(32, 187, 72, 18); contentPane.add(label_3); textField_1 = new JTextField(); textField_1.setColumns(10); textField_1.setBounds(151, 184, 223, 24); contentPane.add(textField_1); JLabel label_4 = new JLabel("\u8054\u7CFB\u65B9\u5F0F\uFF1A"); label_4.setBounds(32, 239, 83, 18); contentPane.add(label_4); textField_3 = new JTextField(); textField_3.setColumns(10); textField_3.setBounds(151, 236, 223, 24); contentPane.add(textField_3); JTextArea textArea = new JTextArea(); textArea.setEditable(false); textArea.setBounds(32, 300, 113, 24); contentPane.add(textArea); JButton button = new JButton("\u5B8C\u6210\u6CE8\u518C"); button.setBounds(185, 298, 113, 27); contentPane.add(button); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { String passwords;//密码 String usernames;//用户名 String names;//姓名 String ids;//学号 String phones;//联系方式 char[] pswd=passwordField.getPassword(); passwords=String.valueOf(pswd); usernames=textField.getText(); names=textField_2.getText(); ids=textField_1.getText(); phones=textField_3.getText(); try { Connection1 contosql = null; try { contosql = new Connection1();//连接数据库 } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } if(passwords.equals("")||usernames.equals("")||names.equals("")||ids.equals("")||phones.equals("")) {//五个选项任意一个为空的话 textArea.setText("请填写完整!"); } else { PreparedStatement psql=contosql.con.prepareStatement("insert into userinfo(username,password,name,id,phone)"+"value(?,?,?,?,?)"); psql.setString(1, usernames); psql.setString(2, passwords); psql.setString(3, names); psql.setString(4,ids); psql.setString(5, phones); psql.executeUpdate(); textArea.setText("注册成功!"); psql.close(); } contosql.con.close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); } } ```

jav怎么设置环境,我加设置页游

我用jav怎么设置呢????请告诉我好几个人也有这个问题,你们呢我不知道再说吧!gg

在中国程序员是青春饭吗?

今年,我也32了 ,为了不给大家误导,咨询了猎头、圈内好友,以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助,记得帮我点赞哦。 目录: 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时,拿着傲人的工资,想着好好干,以为我们的人生是这样的: 等真到了那一天,你会发现,你的人生很可能是这样的: ...

程序员请照顾好自己,周末病魔差点一套带走我。

程序员在一个周末的时间,得了重病,差点当场去世,还好及时挽救回来了。

和黑客斗争的 6 天!

互联网公司工作,很难避免不和黑客们打交道,我呆过的两家互联网公司,几乎每月每天每分钟都有黑客在公司网站上扫描。有的是寻找 Sql 注入的缺口,有的是寻找线上服务器可能存在的漏洞,大部分都...

搜狗输入法也在挑战国人的智商!

故事总是一个接着一个到来...上周写完《鲁大师已经彻底沦为一款垃圾流氓软件!》这篇文章之后,鲁大师的市场工作人员就找到了我,希望把这篇文章删除掉。经过一番沟通我先把这篇文章从公号中删除了...

总结了 150 余个神奇网站,你不来瞅瞅吗?

原博客再更新,可能就没了,之后将持续更新本篇博客。

副业收入是我做程序媛的3倍,工作外的B面人生是怎样的?

提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...

MySQL数据库面试题(2020最新版)

文章目录数据库基础知识为什么要使用数据库什么是SQL?什么是MySQL?数据库三大范式是什么mysql有关权限的表都有哪几个MySQL的binlog有有几种录入格式?分别有什么区别?数据类型mysql有哪些数据类型引擎MySQL存储引擎MyISAM与InnoDB区别MyISAM索引与InnoDB索引的区别?InnoDB引擎的4大特性存储引擎选择索引什么是索引?索引有哪些优缺点?索引使用场景(重点)...

如果你是老板,你会不会踢了这样的员工?

有个好朋友ZS,是技术总监,昨天问我:“有一个老下属,跟了我很多年,做事勤勤恳恳,主动性也很好。但随着公司的发展,他的进步速度,跟不上团队的步伐了,有点...

我入职阿里后,才知道原来简历这么写

私下里,有不少读者问我:“二哥,如何才能写出一份专业的技术简历呢?我总感觉自己写的简历太烂了,所以投了无数份,都石沉大海了。”说实话,我自己好多年没有写过简历了,但我认识的一个同行,他在阿里,给我说了一些他当年写简历的方法论,我感觉太牛逼了,实在是忍不住,就分享了出来,希望能够帮助到你。 01、简历的本质 作为简历的撰写者,你必须要搞清楚一点,简历的本质是什么,它就是为了来销售你的价值主张的。往深...

优雅的替换if-else语句

场景 日常开发,if-else语句写的不少吧??当逻辑分支非常多的时候,if-else套了一层又一层,虽然业务功能倒是实现了,但是看起来是真的很不优雅,尤其是对于我这种有强迫症的程序"猿",看到这么多if-else,脑袋瓜子就嗡嗡的,总想着解锁新姿势:干掉过多的if-else!!!本文将介绍三板斧手段: 优先判断条件,条件不满足的,逻辑及时中断返回; 采用策略模式+工厂模式; 结合注解,锦...

离职半年了,老东家又发 offer,回不回?

有小伙伴问松哥这个问题,他在上海某公司,在离职了几个月后,前公司的领导联系到他,希望他能够返聘回去,他很纠结要不要回去? 俗话说好马不吃回头草,但是这个小伙伴既然感到纠结了,我觉得至少说明了两个问题:1.曾经的公司还不错;2.现在的日子也不是很如意。否则应该就不会纠结了。 老实说,松哥之前也有过类似的经历,今天就来和小伙伴们聊聊回头草到底吃不吃。 首先一个基本观点,就是离职了也没必要和老东家弄的苦...

2020阿里全球数学大赛:3万名高手、4道题、2天2夜未交卷

阿里巴巴全球数学竞赛( Alibaba Global Mathematics Competition)由马云发起,由中国科学技术协会、阿里巴巴基金会、阿里巴巴达摩院共同举办。大赛不设报名门槛,全世界爱好数学的人都可参与,不论是否出身数学专业、是否投身数学研究。 2020年阿里巴巴达摩院邀请北京大学、剑桥大学、浙江大学等高校的顶尖数学教师组建了出题组。中科院院士、美国艺术与科学院院士、北京国际数学...

男生更看重女生的身材脸蛋,还是思想?

往往,我们看不进去大段大段的逻辑。深刻的哲理,往往短而精悍,一阵见血。问:产品经理挺漂亮的,有点心动,但不知道合不合得来。男生更看重女生的身材脸蛋,还是...

程序员为什么千万不要瞎努力?

本文作者用对比非常鲜明的两个开发团队的故事,讲解了敏捷开发之道 —— 如果你的团队缺乏统一标准的环境,那么即使勤劳努力,不仅会极其耗时而且成果甚微,使用...

为什么程序员做外包会被瞧不起?

二哥,有个事想询问下您的意见,您觉得应届生值得去外包吗?公司虽然挺大的,中xx,但待遇感觉挺低,马上要报到,挺纠结的。

当HR压你价,说你只值7K,你该怎么回答?

当HR压你价,说你只值7K时,你可以流畅地回答,记住,是流畅,不能犹豫。 礼貌地说:“7K是吗?了解了。嗯~其实我对贵司的面试官印象很好。只不过,现在我的手头上已经有一份11K的offer。来面试,主要也是自己对贵司挺有兴趣的,所以过来看看……”(未完) 这段话主要是陪HR互诈的同时,从公司兴趣,公司职员印象上,都给予对方正面的肯定,既能提升HR的好感度,又能让谈判气氛融洽,为后面的发挥留足空间。...

面试:第十六章:Java中级开发(16k)

HashMap底层实现原理,红黑树,B+树,B树的结构原理 Spring的AOP和IOC是什么?它们常见的使用场景有哪些?Spring事务,事务的属性,传播行为,数据库隔离级别 Spring和SpringMVC,MyBatis以及SpringBoot的注解分别有哪些?SpringMVC的工作原理,SpringBoot框架的优点,MyBatis框架的优点 SpringCould组件有哪些,他们...

面试阿里p7,被按在地上摩擦,鬼知道我经历了什么?

面试阿里p7被问到的问题(当时我只知道第一个):@Conditional是做什么的?@Conditional多个条件是什么逻辑关系?条件判断在什么时候执...

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?

最近面试了一个31岁8年经验的程序猿,让我有点感慨,大龄程序猿该何去何从。

大三实习生,字节跳动面经分享,已拿Offer

说实话,自己的算法,我一个不会,太难了吧

程序员垃圾简历长什么样?

已经连续五年参加大厂校招、社招的技术面试工作,简历看的不下于万份 这篇文章会用实例告诉你,什么是差的程序员简历! 疫情快要结束了,各个公司也都开始春招了,作为即将红遍大江南北的新晋UP主,那当然要为小伙伴们做点事(手动狗头)。 就在公众号里公开征简历,义务帮大家看,并一一点评。《启舰:春招在即,义务帮大家看看简历吧》 一石激起千层浪,三天收到两百多封简历。 花光了两个星期的所有空闲时...

《Oracle Java SE编程自学与面试指南》最佳学习路线图2020年最新版(进大厂必备)

正确选择比瞎努力更重要!

《Oracle Java SE编程自学与面试指南》最佳学习路线图(2020最新版)

正确选择比瞎努力更重要!

都前后端分离了,咱就别做页面跳转了!统统 JSON 交互

文章目录1. 无状态登录1.1 什么是有状态1.2 什么是无状态1.3 如何实现无状态1.4 各自优缺点2. 登录交互2.1 前后端分离的数据交互2.2 登录成功2.3 登录失败3. 未认证处理方案4. 注销登录 这是本系列的第四篇,有小伙伴找不到之前文章,松哥给大家列一个索引出来: 挖一个大坑,Spring Security 开搞! 松哥手把手带你入门 Spring Security,别再问密...

字节跳动面试官竟然问了我JDBC?

轻松等回家通知

面试官:你连SSO都不懂,就别来面试了

大厂竟然要考我SSO,卧槽。

阿里面试官让我用Zk(Zookeeper)实现分布式锁

他可能没想到,我当场手写出来了

终于,月薪过5万了!

来看几个问题想不想月薪超过5万?想不想进入公司架构组?想不想成为项目组的负责人?想不想成为spring的高手,超越99%的对手?那么本文内容是你必须要掌握的。本文主要详解bean的生命...

自从喜欢上了B站这12个UP主,我越来越觉得自己是个废柴了!

不怕告诉你,我自从喜欢上了这12个UP主,哔哩哔哩成为了我手机上最耗电的软件,几乎每天都会看,可是吧,看的越多,我就越觉得自己是个废柴,唉,老天不公啊,不信你看看…… 间接性踌躇满志,持续性混吃等死,都是因为你们……但是,自己的学习力在慢慢变强,这是不容忽视的,推荐给你们! 都说B站是个宝,可是有人不会挖啊,没事,今天咱挖好的送你一箩筐,首先啊,我在B站上最喜欢看这个家伙的视频了,为啥 ,咱撇...

代码注释如此沙雕,会玩还是你们程序员!

某站后端代码被“开源”,同时刷遍全网的,还有代码里的那些神注释。 我们这才知道,原来程序员个个都是段子手;这么多年来,我们也走过了他们的无数套路… 首先,产品经理,是永远永远吐槽不完的!网友的评论也非常扎心,说看这些代码就像在阅读程序员的日记,每一页都写满了对产品经理的恨。 然后,也要发出直击灵魂的质问:你是尊贵的付费大会员吗? 这不禁让人想起之前某音乐app的穷逼Vip,果然,穷逼在哪里都是...

立即提问
相关内容推荐