我只是在做一个GET请求,但是我收到了这个错误:
java.lang.RuntimeException:无法启动活动ComponentInfo {com.example.yomac_000.chargingpoint/com.example.yomac_000.chargingpoint.AllStores}:java.lang.IllegalArgumentException:无法为java.util.List创建转换器
这是因为这行代码:
Call<List<Store>> call = subpriseAPI.listStores(response);
Run Code Online (Sandbox Code Playgroud)
所以我试过这行代码来看看它是什么类型的:
System.out.println(subpriseAPI.listStores(response).getClass().toString());
Run Code Online (Sandbox Code Playgroud)
但后来我得到了同样的错误,所以它不会让我知道它是什么类型.在下面你可以看到我的代码.
StoreService.java:
public class StoreService {
public static final String BASE_URL = "http://getairport.com/subprise/";
Retrofit retrofit = new Retrofit.Builder()
.baseUrl(BASE_URL)
.build();
SubpriseAPI subpriseAPI = retrofit.create(SubpriseAPI.class);
String response = "";
public List<Store> getSubprises() {
Call<List<Store>> call = subpriseAPI.listStores(response);
try {
List<Store> listStores = call.execute().body();
System.out.println("liststore "+ listStores.iterator().next());
return listStores;
} catch (IOException e) {
// handle errors
}
return null;
}
}
Run Code Online (Sandbox Code Playgroud)
SubpriseAPI.java:
public interface SubpriseAPI {
@GET("api/locations/get")
Call<List<Store>> listStores(@Path("store") String store); …Run Code Online (Sandbox Code Playgroud) 我正试图git fetch upstream master从另一个用户的存储库获取最新的提交.但不幸的是,这不起作用.我也试过了git fetch upstream.
工作是什么git pull upstream master,但我不想一直使用它,因为它将始终自动执行合并.
这是我执行时得到的输出git fetch upstream master:
git fetch upstream master
From https://github.com/jchun/nodeSite
* branch master -> FETCH_HEAD
Run Code Online (Sandbox Code Playgroud)
这是我的遥控器:
git remote -v
origin git@github.com:superzaky/nodeSite.git (fetch)
origin git@github.com:superzaky/nodeSite.git (push)
upstream https://github.com/jchun/nodeSite.git (fetch)
upstream https://github.com/jchun/nodeSite.git (push)
Run Code Online (Sandbox Code Playgroud) 如何在Thymeleaf中显示包含HTML标记的字符串?
所以这段代码:
<div th:each="content : ${cmsContent}">
<div class="panel-body" sec:authorize="hasRole('ROLE_ADMIN')">
<div th:switch="${content.reference}">
<div th:case="'home.admin'">
<p th:text="${content.text}"></p>
</div>
</div>
</div>
//More code....
Run Code Online (Sandbox Code Playgroud)
在这段代码中,${content.text}它在浏览器上生成了这个:
<p>test</p>
Run Code Online (Sandbox Code Playgroud)
但我想在浏览器上显示:
测试
我收到以下错误: Uncaught TypeError: result.subscribe is not a function
这是错误的屏幕截图:
但我确实试图捕捉错误.您可以在下面看到我的代码.
login.component.ts:
import { Component } from '@angular/core';
import { UserService } from '../../services/user.service';
import { User } from '../../models/user';
import {ToasterContainerComponent, ToasterService, ToasterConfig} from 'angular2-toaster/angular2-toaster';
@Component({
moduleId: module.id,
selector: 'login',
directives: [ToasterContainerComponent],
templateUrl: 'login.component.html',
providers: [UserService, ToasterService]
})
export class LoginComponent {
user: User = new User();
loginRes: String;
private toasterService: ToasterService;
public toasterconfig: ToasterConfig = new ToasterConfig({
showCloseButton: true,
tapToDismiss: false,
timeout: 0
});
constructor(private _userService: UserService, toasterService: ToasterService) …Run Code Online (Sandbox Code Playgroud) 当我点击登录链接时,我会转到/login. 看起来像这个截图链接:
请注意在Session not found发出请求后给予我的 Angular 2 应用程序的响应。检查用户是否登录。这一切都很好。
但是当我刷新页面时,我收到以下错误Cannot GET /login链接到屏幕截图:
为了修复该错误,我在 Express 应用程序中添加了以下内容:
//We use this to avoid the error: Cannot GET /login
//but if we use this, then we can't receive a session on the Angular 2 app..
app.route('/*').get(function(req, res) {
return res.sendFile(path.join(__dirname, 'public/index.html'));
});
Run Code Online (Sandbox Code Playgroud)
现在我可以刷新页面而不会出现错误Cannot GET /login。但现在的问题是我收到以下错误:Unexpected token < in JSON at position 0当我的 Angular 2 应用程序想要检查用户是否登录时。这也是它的屏幕截图:
相反,我应该将错误作为响应 Session not found。但不幸的是,这并没有发生。
这是我的 Express 应用程序的代码:
应用程序.js:
var …Run Code Online (Sandbox Code Playgroud) 当我在 JUnit(版本 4.12)中运行我的测试来下订单时,我收到以下错误:
Local Exception Stack:
Exception [EclipseLink-30005] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.PersistenceUnitLoadingException
Exception Description: An exception was thrown while searching for persistence archives with ClassLoader: sun.misc.Launcher$AppClassLoader@2c7b84de
Internal Exception: javax.persistence.PersistenceException: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Predeployment of PersistenceUnit [snel-transport-test] failed.
Internal Exception: Exception [EclipseLink-7250] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.ValidationException
Exception Description: [class nl.cimsolutions.snel_transport.models.OrderLine] uses a non-entity [class nl.cimsolutions.snel_transport.models.Product] as target entity in the relationship attribute [field product].
at org.eclipse.persistence.exceptions.PersistenceUnitLoadingException.exceptionSearchingForPersistenceResources(PersistenceUnitLoadingException.java:127)
at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactoryImpl(PersistenceProvider.java:107)
at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:177) …Run Code Online (Sandbox Code Playgroud) java ×3
angular ×2
android ×1
eclipselink ×1
express ×1
git ×1
html ×1
http ×1
http-post ×1
jakarta-ee ×1
javascript ×1
jpa ×1
junit ×1
node.js ×1
request ×1
retrofit ×1
spring ×1
thymeleaf ×1
typescript ×1
url-routing ×1