警告:找不到合适的证书 – 继续没有客户端身份validation

团队在尝试使用HTTPS完成相互握手时遇到以下问题 main, READ: TLSv1.2 Handshake, length = 30 *** CertificateRequest Cert Types: RSA, DSS, ECDSA Supported Signature Algorithms: SHA1withRSA, SHA1withDSA, SHA1withECDSA, SHA256withRSA, Unknown (hash:0x4, signature:0x2), SHA256withECDSA, SHA384withRSA, Unknown (hash:0x5, signature:0x2), SHA384withECDSA Cert Authorities: main, READ: TLSv1.2 Handshake, length = 4 *** ServerHelloDone Warning: no suitable certificate found – continuing without client authentication *** Certificate chain […]

Google Admin Directory API返回400个错误请求

我正在尝试使用Google Admin SDK的Java客户端,特别是Directory API。 它基于GoogleCredentials的使用,就像Google Drive API一样。 但是,与Google云端硬盘驱动器不同的是,我收到了400条错误的目录请求错误。 我按如下方式设置API: Directory directory = new Directory.Builder(TRANSPORT, FACTORY, credential).build(); Directory.Users.List list = directory.users().list(); Users users = list.execute(); 最后一个execute()生成列在post底部的错误和堆栈跟踪。 我正在使用以下范围来授权自己。 我也可以使用Drive API。 https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/drive https://www.googleapis.com/auth/admin.directory.user 访问Drive API就像魅力一样。 我可以毫无问题地请求文件。 但是,如果我对Directory API执行简单操作,则会收到下面列出的错误和堆栈跟踪。 我应该提一下,Drive API和Directory API都指的是我是管理员的Google Apps域名。 我还在Google API控制台中启用了这两个API。 对于其他人,我无法弄清楚我做错了什么,我想知道是否有其他人看到类似的东西或者有通过Java客户端访问这个API的经验。 谢谢, 拉尔夫 [ERROR] com.google.api.client.googleapis.json.GoogleJsonResponseException: 400 OK [ERROR] { [ERROR] “code” : […]

64位Java适用于小型独立应用程序

是否值得在64位Java上迁移小型独立Java应用程序(最大:100-200MB堆)。 有什么特别的优点; 我的观察是,它只是增加了应用程序的内存占用。 请发表您的经验/意见。

Arrays.asList给出UnsupportedOperationException

无法使用add或remove等方法修改Arrays.asList返回的List 。 但是如果将它传递给Collections.sort方法,它可以对数组进行排序而没有任何问题(我预计会有exception)。 这似乎是一种非常不一致的行为。 那么什么是List上允许的操作,由asList方法返回? List list = Arrays.asList(5,7, 10 , 8,9); list.remove(2);//Exception Collections.sort(list);//Ok, No Exception Sort… System.out.println(list); 我在文档中找不到任何线索。 编辑:是的我可以理解为什么它不支持remove或add 。 但那么它如何支持排序呢?

JPanel背景图片

这是我的代码,它确实找到了图像,这不是我的关注,我关心的是如何使该图像成为面板的背景。 我正在尝试使用图形,但我不工作,任何想法? 请?? try { java.net.URL imgURL = MAINWINDOW.class.getResource(imagen); Image imgFondo = javax.imageio.ImageIO.read(imgURL); if (imgFondo != null) { Graphics grafica=null; grafica.drawImage(imgFondo, 0, 0, this); panel.paintComponents(grafica); } else { System.err.println(“Couldn’t find file: ” + imagen); } } catch…

Tomcat – 了解CredentialHandler

我需要在我的最新项目中使用Container Managed Security and Authentication。 我有一些关于如何配置凭据处理程序的疑问。 首先, CredentialHandler声明会如何? 有人可以使用声明的algorithm属性提供NestedCredentialHandler的示例声明。 我需要知道,因为Realms中的Digest属性已被弃用。 我没有在网上找到任何例子,我完全感到困惑。 MessageDigestCredentialHandler和SecretKeyCredentialHandler之间的区别是哪一个更安全? SecretKeyCredentialHandler在文档中 仅指定了一个算法 ,即PBKDF2WithHmacSHA1 。 还有哪些其他算法?

为什么JasperViewer只适用于localhost?

我只是想知道为什么JasperViewer只适用于localhost。 当我将项目部署到服务器时,客户端无法再查看报告。 String reportDir = getServletContext().getRealPath(“WEB-INF/classes/com/proj/reports”); String fileName = reportDir + “\\” + request.getParameter(“reportName”) + “.jasper”; File outReportDir = new File(“C:/REPORTS_FOLDER”); outReportDir.mkdir(); long millis = System.currentTimeMillis(); String outFileName = outReportDir + “\\” + request.getParameter(“reportName”) + “_” + millis + “.pdf”; HashMap parameters = new HashMap(); parameters.put(“P_BOOKING_MONTH”, request.getParameter(“selMonth”)); parameters.put(“P_BOOKING_YR”, request.getParameter(“selYear”)); try { Connection conn = ConnectionUtil.getConnection(); […]

java中十进制数的总和

我在java(JDK 1.4)中管理十进制数的问题。 我有两个双数字第一和第二 (作为格式化字符串的输出)。 我在第一个和第二个之间做了一个总和,我收到一个带有更多十进制数字的数字! final double first=198.4;//value extract by unmodifiable format method final double second=44701.2;//value extract by unmodifiable format method final double firstDifference= first+second; //I receive 44899.598 instead of 44899.6 final double calculatedDifference=44900.1; // comparison value for the flow final double error=firstDifference-calculatedDifference;// I receive -0.50390605 instead 0.5 if(Math.abs(error)<=0.5d)){ //I must enter in this branch […]

线程安全设置变量(Java)?

给出以下代码: public class FooBar { public static volatile ConcurrentHashMap myConfigData = new ConcurrentHashMap(); } public class UpdaterThread implements Runnable { run { //Query the Data from the DB and Update the FooBar config Data FooBar.myConfigData = ConfigDataDAO.getLatestConfigFromDB(); } } Thread-Class将定期更新myConfigData Member变量(每5分钟通过一个Executor)。 myConfigData的设置是在“外部”线程threadafe(primefaces)中,还是我必须将每个Read和Write操作同步到myConfigData变量? 编辑:问题不是ConcurrentHashMap是线程安全的(它是根据javadoc)而是在myConfigData Member变量中设置ConcurrentHashMap本身。 这个变量可能被几个线程“一次”读取和写入,所以问题是设置是否是primefaces的。 我认为这可以推广为“Java引用变量的设置是否为primefaces?”。 (我也使它变得不稳定。这是一个不同的问题,与primefaces性无关 – 我的问题 – 而是“其他线程中的可见性”和之前发生的关系。)

Tomcat 8 – LDAP:NameNotFoundException错误代码32,剩余名称为空字符串

尝试将应用程序从WebLogic 12.2.1迁移到Tomcat 8.5.4 ,Weblogic下的内容是作为LDAP连接的外部JNDI提供程序的条目已迁移到Tomcat下的新Resource 。 遵循Stack Overflow的这个建议 ,自定义LdapContextFactory已被打包为Tomcat lib文件夹下的新jar文件。 在Tomcat server.xml文件中,已配置以下GlobalNamingResources/Resource : 通过嵌入在Eclipse中的Apache Directory Studio / LDAP Browser等LDAP浏览器浏览LDAP目录时,上述连接可正常工作。 自定义com.sample.custom.LdapContextFactory非常简单: public class LdapContextFactory implements ObjectFactory { public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable environment) throws Exception { Hashtable env = new Hashtable(); Reference reference = (Reference) obj; Enumeration references = reference.getAll(); while (references.hasMoreElements()) { […]