转换json与gson错误预期BEGIN_OBJECT但是BEGIN_ARRAY在第1行第2列路径$

[{“user_id”:”5633795″,”username”:”_Vorago_”,”count300″:”203483″,”count100″:”16021″,”count50″:”1517″,”playcount”:”1634″,”ranked_score”:”179618425″,”total_score”:”1394180836″,”pp_rank”:”34054″,”level”:”59.6052″,”pp_raw”:”1723.43″,”accuracy”:”96.77945709228516″,”count_rank_ss”:”1″,”count_rank_s”:”19″,”count_rank_a”:”17″,”country”:”US”,”events”:[]}] 我正在尝试使用GSON转换上面的JSON,但遇到了错误。 package com.grapefruitcode.osu; import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.URL; import com.google.gson.Gson; public class Main { static String ApiKey = “”; public static void main(String[]Args) throws Exception{ String json = readUrl(“”); System.out.println(json); Gson gson = new Gson(); User user = gson.fromJson(json, User.class); System.out.println(); } private static String readUrl(String urlString) throws Exception { BufferedReader reader = […]

系统中发现了selenium元素,但在Jenkins中找不到

我和我的团队最近开始使用Selenium Web Driver和JUnit开发自动化脚本。 我正面临一个问题,而我完全没有关于如何继续的想法。 任何建议都会有用。 问题出在这里:我有一个页面,我在表单中上传两个excel,然后按提交按钮确认上传。 上传完成后,它会使用数据填充数据库,下一页确认每个Excel的行数。 我正在尝试获取确认上传的元素,这是一种“标签”类型。 所有这些都可以在我的电脑上成功地在本地工作(Windows 7,firefox webdriver)。 上传我的代码时,当jenkins构建/执行它时,我得到一个“未找到元素”,测试失败。 由于我无法直观访问jenkins运行的内容,因此我使用getPageSource()替换了元素确认(在jenkins上失败getPageSource() 。 getPageSource()返回我希望看到的页面,我想要找到的元素(本地和jenkins)。 关于可能发生的事情的任何想法? 笔记: 有两个10sec thread.sleep。 一个在上传每个Excel时,一个在点击提交后,以确保加载下一页并成功提交excel。 我尝试使用xpath定位元素。 事实上,我使用了Firefox中的Firebug和Chrome中的Web开发人员给我的xpath。 只是为了确保xpath没有任何问题。 两个xpath都在我的本地机器上成功定位元素,但在jenkins上失败。 执行测试(本地和Jenkins)我可以看到数据库填充它应该。 请原谅我缺乏代码,但我可以分享的内容受到限制。

Eclipse无法创建Java虚拟机

我正在使用eclipse来开发Android应用程序,它总是很顺利,但今天它给出了问题。 当我尝试打开eclipse时,它向我显示此消息”Failed to create the java virtual machine. Error occurred during initialization of VM. Could not reserve enough space for object heap” 这是我的eclipse.ini -startup plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar –launcher.library plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.200.v20120913-144807 -product com.android.ide.eclipse.adt.package.product –launcher.XXMaxPermSize 256M -showsplash com.android.ide.eclipse.adt.package.product –launcher.XXMaxPermSize 256m –launcher.defaultAction openFile -vmargs -Dosgi.requiredJavaVersion=1.8 -Xms1336m -Xmx1336m -Declipse.buildId=v22.3.0-887826 -XX:MaxPermSize=512M 我试图改变”256m” “512m” “256m” ,但它仍然不起作用。 我试图重新启动但没有。 我试图更改-XX:MaxPermSize=512M值,但没有。

Java代码生成

我正在寻找漂亮的(java)代码生成引擎。 我找到了cglib,但文档记录很差,我不太确定它是否可以生成实际的java类(文件)和动态类。 如果我错了,也许有人知道有一个例子的链接。 罗马

Spring中的@Configurable注释的XML等价物

是否有@Configurable注释的XML等价物? 例如对于bean: 如何判断SalesDocument应该是@Configurable?

JFreeChart:如何更改XYPlot前景色?

使用setBackgroundPaint()更改JFreeChart XYPlot背景颜色,但似乎没有相应的setForegroundPaint() 。 XYPlot plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(Color.BLACK); 前景色(图)如何变化?

java.lang.IllegalArgumentException:protocol = http host = null

对于这个链接http://bits.blogs.nytimes.com/2014/09/02/uber-banned-across-germany-by-frankfurt-court/?partner=rss&emc=rss此代码不起作用,但如果我以另一个为例: https : //www.google.com一切正常: URL url = new URL(“http://bits.blogs.nytimes.com/2014/09/02/uber-banned-across-germany-by-frankfurt-court/?partner=rss&emc=rss”); URLConnection uc; uc = url.openConnection(); uc.setRequestProperty(“User-Agent”, “Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_7; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.205 Safari/534.16”); uc.addRequestProperty(“referer”, “http://www.facebook.com”); uc.connect(); this.input = uc.getInputStream(); 我得到这个例外: java.lang.IllegalArgumentException: protocol = http host = null at sun.net.spi.DefaultProxySelector.select(DefaultProxySelector.java:170) at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:926) at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:850) at sun.net.www.protocol.http.HttpURLConnection.followRedirect(HttpURLConnection.java:2398) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1557) at […]

谷歌地图 – Android应用程序无法加载 – 空对象引用

我目前正在尝试使用google Maps集成开发Android应用。 目前我很难找到错误,因为代码来自谷歌网站本身,除了它是一个SupportMapFragment。 如果您知道使用SupportMapFragment的实际教程也会很棒。 实际,因为我认为.getMap()是折旧的。 如果我应该发布整个代码,请告诉我(我是stackoverflow中的新手) 如果尝试使用此代码: import android.content.Context; import android.location.Criteria; import android.location.Location; import android.location.LocationManager; import android.os.Bundle; import android.support.v4.app.FragmentManager; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.OnMapReadyCallback; import com.google.android.gms.maps.SupportMapFragment; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.MarkerOptions; public class MapsFragment extends SupportMapFragment implements OnMapReadyCallback { 其中一个函数是: @Override public void onResume() { FragmentManager fragmentManager = getActivity().getSupportFragmentManager(); […]

generics:确保参数类型相同

我有以下方法: protected void setValue(final S oldValue, final S newValue) { // Do something } 我想确保两个参数属于同一类型。 如果在尝试传递两种不同类型的参数时出现编译器错误,那将会很酷。 上述方式显然不正确。 我可以放入一个String和一个Integer ,因为它们都是从Object扩展而来的。 我的想要甚至可能吗? 或者是唯一的方法来确保两个参数都是相同的类型,以检查方法内部并抛出IllegalArgumentException ?

没有可用于当前线程的实际事务的EntityManager – 无法可靠地处理“刷新”调用

一些背景信息:我正在尝试将一个大项目从Hibernate 3.6.8迁移到5.2.5(包括JPA升级2.0到2.1),Spring 3.2.3到4.3.5并且面临严重问题。 到目前为止,Spring和Hibernate的配置还没有改变,并且在旧版本上运行良好,但是我自己无法解决升级问题。 我得到的例外是: 2017-01-16 10:15:25,635 ERROR [[ACTIVE] ExecuteThread: ’15’ for queue: ‘weblogic.kernel.Default (self-tuning)’] org.myproject.common.messaging.BaseMDB: Code: (11702) Source: (Common) Exception caught – Exception org.springframework.dao.InvalidDataAccessApiUsageException in org.myproject.core.processing.message.MessageReceiverImpl caught org.springframework.dao.InvalidDataAccessApiUsageException: No EntityManager with actual transaction available for current thread – cannot reliably process ‘flush’ call; nested exception is javax.persistence.TransactionRequiredException: No EntityManager with actual transaction available for […]