TChart inside LinearLayout generates "width and height must be > 0" - xamarin.android

I have just started using Steema TChart on Mono for Android. I tried this simple code and it works fine:
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
var tChart1 = new Steema.TeeChart.TChart(this);
var bar1 = new Steema.TeeChart.Styles.Bar();
tChart1.Series.Add(bar1);
bar1.Add(3, "Pears", Color.Red);
bar1.Add(4, "Apples", Color.Blue);
bar1.Add(2, "Oranges", Color.Green);
var theme = new Steema.TeeChart.Themes.BlackIsBackTheme(tChart1.Chart);
theme.Apply();
SetContentView(tChart1);
}
...but as soon as I try adding the chart into another view, like a LinearLayout I get the error "width and height must be > 0". Does anyone know how to solve this?
Here is the code that I tried (it works just fine if I only have the LinearLayout and the Button):
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
var tChart1 = new Steema.TeeChart.TChart(this);
var bar1 = new Steema.TeeChart.Styles.Bar();
tChart1.Series.Add(bar1);
bar1.Add(3, "Pears", Color.Red);
bar1.Add(4, "Apples", Color.Blue);
bar1.Add(2, "Oranges", Color.Green);
var theme = new Steema.TeeChart.Themes.BlackIsBackTheme(tChart1.Chart);
theme.Apply();
var container = new LinearLayout(this);
container.Orientation = Orientation.Vertical;
var b = new Button(this);
b.Text = "Test";
container.AddView(b);
container.AddView(tChart1);
SetContentView(container);
}
And here is the CallStack:
08-29 19:39:52.489 I/MonoDroid(24907): java.lang.IllegalArgumentException: width and height must be > 0
08-29 19:39:52.489 I/MonoDroid(24907): at android.graphics.Bitmap.createBitmap(Bitmap.java:603)
08-29 19:39:52.489 I/MonoDroid(24907): at android.graphics.Bitmap.createBitmap(Bitmap.java:585)
08-29 19:39:52.489 I/MonoDroid(24907): at steema.teechart.TChart.n_onDraw(Native Method)
08-29 19:39:52.489 I/MonoDroid(24907): at steema.teechart.TChart.onDraw(TChart.java:55)
08-29 19:39:52.489 I/MonoDroid(24907): at android.view.View.draw(View.java:11025)
08-29 19:39:52.489 I/MonoDroid(24907): at android.widget.FrameLayout.draw(FrameLayout.java:450)
08-29 19:39:52.489 I/MonoDroid(24907): at android.view.ViewGroup.drawChild(ViewGroup.java:2887)
08-29 19:39:52.489 I/MonoDroid(24907): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
08-29 19:39:52.489 I/MonoDroid(24907): at android.view.ViewGroup.drawChild(ViewGroup.java:2885)
08-29 19:39:52.489 I/MonoDroid(24907): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
08-29 19:39:52.489 I/MonoDroid(24907): at android.view.ViewGroup.drawChild(ViewGroup.java:2885)
08-29 19:39:52.489 I/MonoDroid(24907): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
08-29 19:39:52.489 I/MonoDroid(24907): at android.view.ViewGroup.drawChild(ViewGroup.java:2885)
08-29 19:39:52.489 I/MonoDroid(24907): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
08-29 19:39:52.489 I/MonoDroid(24907): at android.view.View.draw(View.java:11028)
08-29 19:39:52.489 I/MonoDroid(24907): at android.widget.FrameLayout.draw(FrameLayout.java:450)
08-29 19:39:52.489 I/MonoDroid(24907): at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:2274)
08-29 19:39:52.489 I/MonoDroid(24907): at android.view.ViewRootImpl.draw(ViewRootImpl.java:2041)
08-29 19:39:52.489 I/MonoDroid(24907): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1647)
08-29 19:39:52.489 I/MonoDroid(24907): at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2459)
08-29 19:39:52.489 I/MonoDroid(24907): at android.os.Handler.dispatchMessage(Handler.java:99)
08-29 19:39:52.489 I/MonoDroid(24907): at android.os.Looper.loop(Looper.java:137)
08-29 19:39:52.489 I/MonoDroid(24907): at android.app.ActivityThread.main(ActivityThread.java:4514)
08-29 19:39:52.489 I/MonoDroid(24907): at java.lang.reflect.Method.invokeNative(Native Method)
08-29 19:39:52.489 I/MonoDroid(24907): at java.lang.reflect.Method.invoke(Method.java:511)
08-29 19:39:52.489 I/MonoDroid(24907): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
08-29 19:39:52.489 I/MonoDroid(24907): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
08-29 19:39:52.489 I/MonoDroid(24907): at dalvik.system.NativeStart.main(Native Method)

This is because you need to provide LayoutParams when adding the chart to your View, for example:
container.AddView(tChart1, new ViewGroup.LayoutParams(300, 400));
or:
container.AddView(tChart1, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent));

Related

Spring Cloud Contract - Stub Runner for messaging by using AmqpInboundChannelAdapterSpec

I tried to integrate Spring Cloud Contract Verifier Stub Runner’s messaging module with Spring AMQP. I created SimpleMessageListenerContainer with MessageListener and it works fine.
But I have another approach. I use a AMQP support for Spring Integration with Inbound Channel Adapter to receive a message from a queue.
Is it possible to use Spring Cloud Contract Verifier Stub Runner’s messaging module for AmqpInboundChannelAdapter?
CONTRACT
Contract.make {
description 'insert new message'
label 'test.queue.insert'
input {
triggeredBy('insertMessage()')
}
outputMessage {
sentTo 'test.exchange'
headers {
header('contentType': 'application/json')
header('__TypeId__': 'sk.bulalak.messaging.demospringcloudcontractmessaging.Person')
}
body('''{"firstName": "Janko", "lastName": "Hrasko"}''')
}
}
APPLICATION
#SpringBootApplication
#EnableIntegration
public class DemoSpringCloudContractMessagingApplication {
private Log logger = LogFactory.getLog(getClass());
public static void main(String[] args) {
SpringApplication.run(DemoSpringCloudContractMessagingApplication.class, args);
}
#Bean
public Queue testQueue() {
return QueueBuilder.durable("test.queue").build();
}
#Bean
public Exchange testExchange() {
return ExchangeBuilder
.topicExchange("test.exchange")
.durable(true)
.build();
}
#Bean
public Binding testBinding() {
return BindingBuilder
.bind(testQueue())
.to(testExchange())
.with("#")
.noargs();
}
#Bean
public MessageConverter messageConverter(ObjectMapper objectMapper) {
return new Jackson2JsonMessageConverter(objectMapper);
}
#Bean
public IntegrationFlow amqpInbound(ConnectionFactory connectionFactory, MessageConverter messageConverter) {
return IntegrationFlows.from(Amqp.inboundAdapter(connectionFactory, testQueue()).messageConverter(messageConverter))
.handle(p -> logger.info(p.getPayload()))
.get();
}
}
TEST
#RunWith(SpringRunner.class)
#SpringBootTest
#AutoConfigureStubRunner(ids = "org.example:test-service")
public class DemoSpringCloudContractMessagingApplicationTests {
#Autowired
private StubTrigger stubTrigger;
#Test
public void contextLoads() {
boolean result = stubTrigger.trigger("test.queue.insert");
assertTrue(result);
}
}
EXCEPTION
java.lang.ClassCastException: org.springframework.integration.amqp.inbound.AmqpInboundChannelAdapter$Listener cannot be cast to org.springframework.amqp.core.MessageListener
at org.springframework.cloud.contract.verifier.messaging.amqp.SpringAmqpStubMessages.send(SpringAmqpStubMessages.java:100)
at org.springframework.cloud.contract.verifier.messaging.amqp.SpringAmqpStubMessages.send(SpringAmqpStubMessages.java:89)
at org.springframework.cloud.contract.stubrunner.StubRunnerExecutor.sendMessage(StubRunnerExecutor.java:235)
at org.springframework.cloud.contract.stubrunner.StubRunnerExecutor.triggerForDsls(StubRunnerExecutor.java:192)
at org.springframework.cloud.contract.stubrunner.StubRunnerExecutor.trigger(StubRunnerExecutor.java:178)
at org.springframework.cloud.contract.stubrunner.StubRunner.trigger(StubRunner.java:146)
at org.springframework.cloud.contract.stubrunner.BatchStubRunner.trigger(BatchStubRunner.java:131)
at sk.bulalak.messaging.demospringcloudcontractmessaging.DemoSpringCloudContractMessagingApplicationTests.contextLoads(DemoSpringCloudContractMessagingApplicationTests.java:24)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.springframework.test.context.junit4.statements.RunBeforeTestExecutionCallbacks.evaluate(RunBeforeTestExecutionCallbacks.java:73)
at org.springframework.test.context.junit4.statements.RunAfterTestExecutionCallbacks.evaluate(RunAfterTestExecutionCallbacks.java:83)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:251)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Disable the AMQP stub runner support stubrunner.amqp.enabled=false and just use the Spring INtegration one.
Custom route:
<beans:beans xmlns="http://www.springframework.org/schema/integration"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration.xsd">
<!-- REQUIRED FOR TESTING -->
<bridge input-channel="output"
output-channel="outputTest"/>
<channel id="outputTest">
<queue/>
</channel>
</beans:beans>
and run the test with that context
#ContextConfiguration(classes = Config, loader = SpringBootContextLoader)
#ImportResource("classpath*:integration-context.xml")
#AutoConfigureStubRunner
class IntegrationStubRunnerSpec extends Specification {

Variable cannot be resolved error in struts2

My requirement is am trying to populate pid(projectid) from project table and name from userdetails table as an drop down for a form.Am new to struts framework. Could someone please throw us some light on this issue please.
Here is the code:
sprintform.jsp:
<%# page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%# taglib prefix="s" uri="/struts-tags"%>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<link href="css/jquery.ui.datepicker.css" rel="stylesheet"
type="text/css" />
<script src="js/jquery-1.7.1.min.js" type="text/javascript"></script>
<script src="js/jquery-ui-1.8.17.custom.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function(){$('.dateTxt').datepicker({
dateFormat : 'yy-mm-dd'
}); });
</script>
</head>
<body>
<h1 style="color: green">Sprint</h1>
<s:form action="sprintInsert" namespace="/" method="post"
name="sprintForm" theme="xhtml">
<s:textfield name="title:" size="40" maxlength="40" required="true"
label="Title" />
<p>
Begin Date: <input id="one" class="dateTxt" type="text"
name="begindate" />
</p>
<p>
End Date: <input id="two" class="dateTxt" type="text" name="enddate" />
</p>
<s:select label="ProjectId" headerKey="-1"
headerValue="Select Project Id" list="projectidList" name="pid" />
<%-- <s:select label="Owner" headerKey="-1"
headerValue="Select Sprint Owner" list="sprintownerList"
name="sprintowner" /> --%>
<tr>
<td>State:</td>
<td><select name="state">
<option value="">Choose a state..</option>
<option value="A">Active</option>
<option value="F">Future</option>
<option value="C">Close</option>
</select></td>
</tr>
<s:textfield name="targetestimatedpoints" size="40" maxlength="40"
required="true" label="Target Estimate pts:" />
<s:textfield name="totalestimatedpoints" size="40" maxlength="40"
required="true" label="Total Estimate pts:" />
<s:textfield name="totaldefaultestimatedhours" size="40"
maxlength="40" required="true" label="Total Detail Estimate Hrs: " />
<s:textfield name="todohours:" size="40" maxlength="40"
required="true" label="Total To Do Hrs:" />
<s:textfield name="description: :" size="40" maxlength="40"
required="true" label="Description: " />
<tr align="right">
<td><div align="center">
<input type="submit" value="save">
</div>
<td align="center"><input type="reset" value="Reset"></td>
</tr>
</s:form>
<s:if test="hasActionErrors()">
<div id="fieldErrors">
<s:actionerror />
</div>
</s:if>
</body>
</html>
SprintAction.java:
package com.bits.sprintanalyzer.action;
import java.util.List;
import org.apache.log4j.Logger;
import com.bits.sprintanalyzer.ResourceException;
import com.bits.sprintanalyzer.dao.SprintDAO;
import com.opensymphony.xwork2.ActionSupport;
public class SprintAction extends ActionSupport {
private static final Logger LOG = Logger.getLogger(SprintAction.class);
/**
*
*/
private static final long serialVersionUID = -6257623073537028210L;
private String title;
private String begindate;
private String enddate;
private String pid;
private String sprintowner;
private String state;
private int targetestimatedpoints;
private int totalestimatedpoints;
private int totaldefaultestimatedhours;
private int todohours;
private String description;
public String getPid() {
return pid;
}
public void setPid(String pid) {
this.pid = pid;
}
public String getSprintowner() {
return sprintowner;
}
public void setSprintowner(String sprintowner) {
this.sprintowner = sprintowner;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public int getTargetestimatedpoints() {
return targetestimatedpoints;
}
public void setTargetestimatedpoints(int targetestimatedpoints) {
this.targetestimatedpoints = targetestimatedpoints;
}
public int getTotalestimatedpoints() {
return totalestimatedpoints;
}
public void setTotalestimatedpoints(int totalestimatedpoints) {
this.totalestimatedpoints = totalestimatedpoints;
}
public int getTotaldefaultestimatedhours() {
return totaldefaultestimatedhours;
}
public void setTotaldefaultestimatedhours(int totaldefaultestimatedhours) {
this.totaldefaultestimatedhours = totaldefaultestimatedhours;
}
public int getTodohours() {
return todohours;
}
public void setTodohours(int todohours) {
this.todohours = todohours;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String display() throws Exception {
return INPUT;
}
public String getBegindate() {
return begindate;
}
public void setBegindate(String begindate) {
this.begindate = begindate;
}
public String getEnddate() {
return enddate;
}
public void setEnddate(String enddate) {
this.enddate = enddate;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public List<String> getpidList() throws ResourceException {
return SprintDAO.getpidList();
}
public List<String> getOwnerList() throws ResourceException {
return SprintDAO.getOwnerList();
}
#Override
public void validate() {
}
#Override
public String execute() throws Exception {
LOG.info("title" + title);
LOG.info("begindate" + begindate);
LOG.info("enddate" + enddate);
LOG.info("pid" + pid);
LOG.info("sprintowner" + sprintowner);
LOG.info("state" + state);
LOG.info("targetestimatedpoints" + targetestimatedpoints);
LOG.info("totalestimatedpoints" + totalestimatedpoints);
LOG.info("totaldefaultestimatedhours" + totaldefaultestimatedhours);
LOG.info("todohours" + todohours);
LOG.info("description" + description);
// ProjectDAO.insert(projectname,description,scrummaster,productowner,begindate,enddate);
int i = SprintDAO.save(this);
if (i > 0) {
return "success";
}
return "error";
}
}
SprintDAO:
package com.bits.sprintanalyzer.dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import com.bits.sprintanalyzer.ResourceException;
import com.bits.sprintanalyzer.action.SprintAction;
import com.bits.sprintanalyzer.util.ConnectionUtil;
public class SprintDAO {
private static final String PROJECTQUERY = "select pid from project";
private static final String USERQUERY = "select name from userdetail";
public static List<String> getpidList() throws ResourceException{
List<String> projectidList = new ArrayList<String>();
// this should be populated from DB
try (Connection con = ConnectionUtil.INSTANCE.getConnection();
PreparedStatement st = con.prepareStatement(PROJECTQUERY)){
ResultSet rs =st.executeQuery();
while(rs.next()){
projectidList.add(rs.getString(1));
}
return projectidList;
}
catch (SQLException | ResourceException e) {
throw new ResourceException("Failed to validate project id", e);
}
}
public static List<String> getOwnerList() throws ResourceException{
List<String> sprintownerList = new ArrayList<String>();
// this should be populated from DB
try (Connection con = ConnectionUtil.INSTANCE.getConnection();
PreparedStatement st = con.prepareStatement(USERQUERY)){
ResultSet rs =st.executeQuery();
while(rs.next()){
sprintownerList.add(rs.getString(1));
}
return sprintownerList;
}
catch (SQLException | ResourceException e) {
throw new ResourceException("Failed to validate productowner", e);
}
}
//insert into database
public static int save(SprintAction SA) throws Exception{
int status=0;
try{
Connection con = ConnectionUtil.INSTANCE.getConnection();
PreparedStatement ps = con.prepareStatement("insert into sprint(pid,title,begindate,enddate,owner,state,targetestimatedpoints,totalestimatedpoints,totaldefaultestimatedhours,todohours,description) values(?,?,?,?,?,?,?,?,?,?,?)");
ps.setString(1, SA.getPid());
ps.setString(2, SA.getTitle());
ps.setString(3, SA.getBegindate());
ps.setString(4, SA.getEnddate());
ps.setString(5, SA.getSprintowner());
ps.setString(6, SA.getState());
ps.setInt(7, SA.getTargetestimatedpoints());
ps.setInt(8, SA.getTotalestimatedpoints());
ps.setInt(9, SA.getTotaldefaultestimatedhours());
ps.setInt(10, SA.getTodohours());
ps.setString(11, SA.getDescription());
status=ps.executeUpdate();
}catch(Exception e){
e.printStackTrace();}
return status;
}
}
struts.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.1.7//EN"
"/WEB-INF/classes/struts-2.1.7.dtd">
<struts>
<!--
You could also set the constants in the struts.properties file
placed in the same directory as struts.xml
-->
<constant name="struts.devMode" value="true" />
<package name="sprintanalyzer" extends="struts-default" namespace="/">
<!--
If no class attribute is specified the framework will assume success and
render the result index.jsp
If no name value for the result node is specified the success value is the default
-->
<action name="">
<result>/jsp/login.jsp</result>
</action>
<!--
If the URL is hello.action then call the execute method of class HelloWorldAction.
If the result returned by the execute method is success render the HelloWorld.jsp
-->
<action name="login" class="com.bits.sprintanalyzer.action.LoginAction"
method="execute">
<result name="success">/jsp/sprintanalyzer.jsp</result>
<result name="input">/jsp/login.jsp</result>
</action>
<action name="projectform" class="com.bits.sprintanalyzer.action.ProjectAction"
method="display">
<result name="input">/jsp/projectform.jsp</result>
</action>
<action name="projectInsert" class="com.bits.sprintanalyzer.action.ProjectAction"
method="execute">
<result name="success">/jsp/sprintanalyzer.jsp</result>
</action>
<action name="sprintform" class="com.bits.sprintanalyzer.action.SprintAction"
method="display">
<result name="input">/jsp/sprintform.jsp</result>
</action>
<action name="sprintInsert" class="com.bits.sprintanalyzer.action.SprintAction"
method="execute">
<result name="success">/jsp/sprintanalyzer.jsp</result>
</action>
</package>
</struts>
Issue is coming from both projectidlist and sprintownerList. Please advise accordingly.
Please find below stacktrace:
2016-10-01T18:23:38.916+0530|Info: 2016-10-01 18:23:38,916 WARN org.apache.struts2.util.TextProviderHelper.warn:45 - The first TextProvider in the ValueStack (com.opensymphony.xwork2.ActionSupport) could not locate the message resource with key 'Login'
2016-10-01T18:23:38.917+0530|Info: 2016-10-01 18:23:38,917 WARN org.apache.struts2.util.TextProviderHelper.warn:45 - The default value expression 'Login' was evaluated and did not match a property. The literal value 'Login' will be used.
2016-10-01T18:23:38.925+0530|Info: 2016-10-01 18:23:38,924 WARN org.apache.struts2.util.TextProviderHelper.warn:45 - The first TextProvider in the ValueStack (com.opensymphony.xwork2.ActionSupport) could not locate the message resource with key 'Login'
2016-10-01T18:23:38.925+0530|Info: 2016-10-01 18:23:38,925 WARN org.apache.struts2.util.TextProviderHelper.warn:45 - The default value expression 'Login' was evaluated and did not match a property. The literal value 'Login' will be used.
2016-10-01T18:23:57.121+0530|Info: 2016-10-01 18:23:57,120 WARN org.apache.struts2.util.TextProviderHelper.warn:45 - The first TextProvider in the ValueStack (com.opensymphony.xwork2.ActionSupport) could not locate the message resource with key 'Login'
2016-10-01T18:23:57.121+0530|Info: 2016-10-01 18:23:57,121 WARN org.apache.struts2.util.TextProviderHelper.warn:45 - The default value expression 'Login' was evaluated and did not match a property. The literal value 'Login' will be used.
2016-10-01T18:23:57.128+0530|Info: 2016-10-01 18:23:57,128 WARN org.apache.struts2.util.TextProviderHelper.warn:45 - The first TextProvider in the ValueStack (com.opensymphony.xwork2.ActionSupport) could not locate the message resource with key 'Login'
2016-10-01T18:23:57.129+0530|Info: 2016-10-01 18:23:57,128 WARN org.apache.struts2.util.TextProviderHelper.warn:45 - The default value expression 'Login' was evaluated and did not match a property. The literal value 'Login' will be used.
2016-10-01T18:24:03.841+0530|Severe: Sat Oct 01 18:24:03 IST 2016 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
2016-10-01T18:24:04.022+0530|Info: 2016-10-01 18:24:04,021 WARN org.apache.struts2.util.TextProviderHelper.warn:45 - The first TextProvider in the ValueStack (com.bits.sprintanalyzer.action.LoginAction) could not locate the message resource with key 'welcome to Sprint Analyzer Tool'
2016-10-01T18:24:04.022+0530|Info: 2016-10-01 18:24:04,022 WARN org.apache.struts2.util.TextProviderHelper.warn:45 - The default value expression 'welcome to Sprint Analyzer Tool' was evaluated and did not match a property. The literal value 'welcome to Sprint Analyzer Tool' will be used.
2016-10-01T18:24:06.835+0530|Warning: Servlet.service() for servlet jsp threw exception
tag 'select', field 'list', name 'pid': The requested list key 'projectidList' could not be resolved as a collection/array/map/enumeration/iterator type. Example: people or people.{name} - [unknown location]
at org.apache.struts2.components.Component.fieldError(Component.java:237)
at org.apache.struts2.components.Component.findValue(Component.java:358)
at org.apache.struts2.components.ListUIBean.evaluateExtraParams(ListUIBean.java:80)
at org.apache.struts2.components.Select.evaluateExtraParams(Select.java:105)
at org.apache.struts2.components.UIBean.evaluateParams(UIBean.java:856)
at org.apache.struts2.components.UIBean.end(UIBean.java:510)
at org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:42)
at org.apache.jsp.jsp.sprintform_jsp._jspx_meth_s_select_0(sprintform_jsp.java:236)
at org.apache.jsp.jsp.sprintform_jsp._jspx_meth_s_form_0(sprintform_jsp.java:144)
at org.apache.jsp.jsp.sprintform_jsp._jspService(sprintform_jsp.java:88)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:111)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:411)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:473)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:377)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:875)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:739)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:575)
at org.apache.catalina.core.ApplicationDispatcher.doDispatch(ApplicationDispatcher.java:546)
at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:428)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:378)
at org.apache.struts2.dispatcher.ServletDispatcherResult.doExecute(ServletDispatcherResult.java:154)
at org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:186)
at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:362)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:266)
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(FileUploadInterceptorcom.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:256)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:316)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:416)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:283)
at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:206)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:180)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:283)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:200)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:132)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:111)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:536)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:591)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:571)
at java.lang.Thread.run(Thread.java:745)
2016-10-01T18:24:06.844+0530|Warning: Servlet.service() for servlet jsp threw exception
tag 'select', field 'list', name 'pid': The requested list key 'projectidList' could not be resolved as a collection/array/map/enumeration/iterator type. Example: people or people.{name} - [unknown location]
at org.apache.struts2.components.Component.fieldError(Component.java:237)
at org.apache.struts2.components.Component.findValue(Component.java:358)
at org.apache.struts2.components.ListUIBean.evaluateExtraParams(ListUIBean.java:80)
at org.apache.struts2.components.Select.evaluateExtraParams(Select.java:105)
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:739)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:575)
at org.apache.catalina.core.ApplicationDispatcher.doDispatch(ApplicationDispatcher.java:546)
at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:428)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:378)
at org.apache.struts2.dispatcher.ServletDispatcherResult.doExecute(ServletDispatcherResult.java:154)
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
Here is the login code:
package com.bits.sprintanalyzer.action;
import org.apache.log4j.Logger;
import com.bits.sprintanalyzer.ResourceException;
import com.bits.sprintanalyzer.dao.LoginDAO;
import com.opensymphony.xwork2.ActionSupport;
public class LoginAction extends ActionSupport{
private static final Logger LOG = Logger.getLogger(LoginAction.class);
/**
*
*/
private static final long serialVersionUID = 6877145894906143530L;
private String username;
private String password;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
#Override
public void validate(){
if (username==null || username.length()==0 || password ==null || password.length() ==0 )
addActionError(getText("User name or Password cannot be null"));
}
#Override
public String execute() throws Exception {
try{
if( LoginDAO.isValidUser(username, password) ){
return SUCCESS;
}
else
{
addActionError(getText("Invalid Username or Password"));
}
}catch(ResourceException e){
LOG.error("Failed to valid User", e);
addActionError(getText("Something Went wrong with DBConnection"));
}
return INPUT;
}
}
Latest stacktrace after changing connection string:
2016-10-01T18:55:04.396+0530|Warning: Servlet.service() for servlet jsp threw exception
tag 'select', field 'list', name 'pid': The requested list key 'projectidList' could not be resolved as a collection/array/map/enumeration/iterator type. Example: people or people.{name} - [unknown location]
at org.apache.struts2.components.Component.fieldError(Component.java:237)
at org.apache.struts2.components.Component.findValue(Component.java:358)
at org.apache.struts2.components.ListUIBean.evaluateExtraParams(ListUIBean.java:80)
at org.apache.struts2.components.Select.evaluateExtraParams(Select.java:105)
at org.apache.struts2.components.UIBean.evaluateParams(UIBean.java:856)
at org.apache.struts2.components.UIBean.end(UIBean.java:510)
at org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:42)
at va:111)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
1) You have MySQL connection exception as below:
Establishing SSL connection without server's identity verification is not recommended.
According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set.
To resolve this use the connection string like below:(change the db name to your existing db name)
jdbc:mysql://localhost:3306/dbname?autoReconnect=true&useSSL=false
This needs to be sorted first, that's why the values of the variables are not been rendered
2) In the Latest trace the requested list key 'projectidList' could not be resolved as a collection/array/map/enumeration/iterator type.
This error occurs when you try to access a list/collection which haven't been created.
Try to initialize the collection objects List<String> projectidList at class level.
when particular action is triggered at that time, JSP page is not knowing the the type of field, in this case, when you write List<String> projectidList = new ArrayList<String>(); instead of this, change it to ArrayList projectidList = new ArrayList();.
Make sure that you access list after the action class is instantiated i.e. corresponding action is called.
If you want to directly access it before calling action make it static and access it inside jsp.

Entity is not an instance of a persistable class NEO4J 4.0.0

Spring data neo4j 4.0.0 Release
In spring mvc project i am trying to save a node by repository.save() method i am getting error.
#NodeEntity
public class Category
{
#GraphId
public Long id;
public String categoryName;
public Category()
{
}
public Category( Long id, String categoryName )
{
this.id = id;
this.categoryName = categoryName;
}
}
#Configuration
#EnableNeo4jRepositories("org.neo4j.example.northwind.repository")
#EnableTransactionManagement
public class AppContext extends Neo4jConfiguration
{
public static final String NEO4J_HOST = "http://localhost:";
public static final int NEO4J_PORT = 7474;
#Override
public SessionFactory getSessionFactory() {
System.setProperty("username", "neo4j");
System.setProperty("password","12345");
return new SessionFactory("org.neo4j.example.northwind.model");
}
#Bean
#Override
public Neo4jServer neo4jServer() {
return new RemoteServer(NEO4J_HOST + NEO4J_PORT);
}
#Bean
#Override
//#Scope(value = "session", proxyMode = ScopedProxyMode.TARGET_CLASS)
public Session getSession() throws Exception {
return super.getSession();
}
}
Here is the stacktrace
[org.neo4j.ogm.session.Neo4jSession] (default task-5) org.neo4j.example.northwind.model.Category is not an instance of a persistable class
07:25:55,724 INFO [stdout] (default task-5) org.neo4j.example.northwind.model.Category#54c0a7da
07:25:56,064 ERROR [io.undertow.request] (default task-5) UT005023: Exception handling request to /test: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.neo4j.ogm.session.result.ResultProcessingException: Failed to execute request:
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:973)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:86)
at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58)
at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:72)
at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:282)
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:261)
at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:80)
at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:172)
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:199)
at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:774)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.neo4j.ogm.session.result.ResultProcessingException: Failed to execute request:
at org.neo4j.ogm.session.transaction.TransactionManager.executeRequest(TransactionManager.java:128)
at org.neo4j.ogm.session.transaction.TransactionManager.commit(TransactionManager.java:86)
at org.neo4j.ogm.session.transaction.LongTransaction.commit(LongTransaction.java:37)
at org.springframework.data.neo4j.transaction.Neo4jTransactionManager.commit(Neo4jTransactionManager.java:49)
at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:521)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:291)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:644)
at org.neo4j.example.northwind.controller.IndexController$$EnhancerBySpringCGLIB$$c48f93ec.cat(<generated>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:215)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:749)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:690)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:83)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:945)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:876)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)
... 31 more
Caused by: org.apache.http.client.HttpResponseException: Not Found
at org.neo4j.ogm.session.transaction.TransactionManager.executeRequest(TransactionManager.java:106)
... 53 more
You should extend Neo4jConfiguration to your config file and override below method:
#Override
public SessionFactory getSessionFactory() {
return new SessionFactory("com.neo.entity.neo");
}
Note, com.neo.entity.neo is package name of entity.
I suggest you to provide credentials thru RemoteServer object
public Neo4jServer neo4jServer() {
return new RemoteServer(NEO4J_HOST + NEO4J_PORT, "neo4j", "12345");
}
Adding just #EntityScan to my configurtion and specifying the packages to scan worked for me.
I am using Spring Boot 1.4.0 along with Neo4j 2.0.4.

Initializing data in a gorm data model

I have the following domain layer:
Product:
#Resource(uri='/product')
class BasicProduct {
String title
String description
Double price
Date dateCreated
Date lastUpdated
static hasMany = [tag : Tag]
static constraints = {
title(blank: false, unique: true)
description(blank: false)
price(blank: false)//, inList: [5.0,15.0,25.0,50.0,100.0])
}
static mapping = {
autoTimestamp true
}
}
Tags:
#Resource(uri='/tag')
class Tag {
String title
static belongsTo = [basicProduct: BasicProduct]
Date dateCreated
Date lastUpdated
static constraints = {
title(blank: false, unique: true)
}
static mapping = {
autoTimestamp true
}
}
In my Bootstrap.groovy I have the following :
class BootStrap {
def init = { servletContext ->
new BasicProduct(title: "Product1", description:"blblblblbalablablalbalbablablablablblabalalbllba", price:5.0).save(failOnError: true)
new BasicProduct(title: "Product2", description:"blblblblbalablablalbalbablablablablblabalalbllba", price:75.0).save(failOnError: true)
new BasicProduct(title: "Product3", description:"blblblblbalablablalbalbablablablablblabalalbllba", price:50.0).save(failOnError: true)
new Tag(basic_product_id: 1 ,title: "analysis").save(failOnError: true)
println "initializing data..."
}
However I get an exception:
|Running Grails application
context.GrailsContextLoader Error initializing the application: Validation Error(s) occurred during save():
- Field error in object 'com.testapp.Product.Tag' on field 'basicProduct': rejected value [null]; codes [com.testapp.Product.Tag.basicProduct.nullable.error.com.testapp.Product.Tag.basicProduct,com.testapp.Product.Tag.basicProduct.nullable.error.basicProduct,com.testapp.Product.Tag.basicProduct.nullable.error.com.testapp.Product.BasicProduct,com.testapp.Product.Tag.basicProduct.nullable.error,tag.basicProduct.nullable.error.com.testapp.Product.Tag.basicProduct,tag.basicProduct.nullable.error.basicProduct,tag.basicProduct.nullable.error.com.testapp.Product.BasicProduct,tag.basicProduct.nullable.error,com.testapp.Product.Tag.basicProduct.nullable.com.testapp.Product.Tag.basicProduct,com.testapp.Product.Tag.basicProduct.nullable.basicProduct,com.testapp.Product.Tag.basicProduct.nullable.com.testapp.Product.BasicProduct,com.testapp.Product.Tag.basicProduct.nullable,tag.basicProduct.nullable.com.testapp.Product.Tag.basicProduct,tag.basicProduct.nullable.basicProduct,tag.basicProduct.nullable.com.testapp.Product.BasicProduct,tag.basicProduct.nullable,nullable.com.testapp.Product.Tag.basicProduct,nullable.basicProduct,nullable.com.testapp.Product.BasicProduct,nullable]; arguments [basicProduct,class com.testapp.Product.Tag]; default message [Die Eigenschaft [{0}] des Typs [{1}] darf nicht null sein]
grails.validation.ValidationException: Validation Error(s) occurred during save():
- Field error in object 'com.testapp.Product.Tag' on field 'basicProduct': rejected value [null]; codes [com.testapp.Product.Tag.basicProduct.nullable.error.com.testapp.Product.Tag.basicProduct,com.testapp.Product.Tag.basicProduct.nullable.error.basicProduct,com.testapp.Product.Tag.basicProduct.nullable.error.com.testapp.Product.BasicProduct,com.testapp.Product.Tag.basicProduct.nullable.error,tag.basicProduct.nullable.error.com.testapp.Product.Tag.basicProduct,tag.basicProduct.nullable.error.basicProduct,tag.basicProduct.nullable.error.com.testapp.Product.BasicProduct,tag.basicProduct.nullable.error,com.testapp.Product.Tag.basicProduct.nullable.com.testapp.Product.Tag.basicProduct,com.testapp.Product.Tag.basicProduct.nullable.basicProduct,com.testapp.Product.Tag.basicProduct.nullable.com.testapp.Product.BasicProduct,com.testapp.Product.Tag.basicProduct.nullable,tag.basicProduct.nullable.com.testapp.Product.Tag.basicProduct,tag.basicProduct.nullable.basicProduct,tag.basicProduct.nullable.com.testapp.Product.BasicProduct,tag.basicProduct.nullable,nullable.com.testapp.Product.Tag.basicProduct,nullable.basicProduct,nullable.com.testapp.Product.BasicProduct,nullable]; arguments [basicProduct,class com.testapp.Product.Tag]; default message [Die Eigenschaft [{0}] des Typs [{1}] darf nicht null sein]
at BootStrap$_closure1.doCall(BootStrap.groovy:20)
at grails.util.Environment.evaluateEnvironmentSpecificBlock(Environment.java:308)
at grails.util.Environment.executeForEnvironment(Environment.java:301)
at grails.util.Environment.executeForCurrentEnvironment(Environment.java:277)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Error |
Forked Grails VM exited with error
Any recommendation how to add a Tag for every product into my table?
I appreciate your answer!
Instead of using
new Tag(basic_product_id: 1...
Try doing something along the lines of
BasicProduct basicProduct1 = new BasicProduct(title: "Product1", ...
...
new Tag(basicProduct: basicProduct1...

Deltaspikes #WindowScoped working with TomEE?

I'm struggeling how to get Deltaspikes #WindowScoped working with TomEE (did try 1.5.2, 1.5.3-SNAPSHOT and 1.6.0-SNAPSHOT)
Its a very minimal war, with deltaspike 0.4 core+jsf dependencies.
Now, i did create a HelloWorldBean like this:
#Named("HW")
#WindowScoped
public class HelloWorldBean implements PassivationCapable,Serializable{
private static final long serialVersionUID = 1L;
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
#PostConstruct
public void test() {
System.out.println("Bean did get constructed");
}
....
}
There's an empty beans.xml, empty faces-config.xml and a very minimal web.xml.
on a very simple page i have.
<h:form>
<h:inputText value="#{HW.name}"></h:inputText>
<h:commandButton value="Welcome Me" actionListener="#{HW.printIt}"></h:commandButton>
</h:form>
The page works fine, a windowId is added to the request and when i refresh the page i see that the bean is not instanciated (i.e. test() gets only called once).
But as soon i press the commandButton i get an ContextNotActiveException exception:
org.apache.myfaces.view.facelets.el.ContextAwareELException: javax.el.ELException: Error reading 'name' on type de.glauche.beans.HelloWorldBean$$OwbNormalScopeProxy0
at org.apache.myfaces.view.facelets.el.ContextAwareTagValueExpression.getValue(ContextAwareTagValueExpression.java:104)
at javax.faces.component._DeltaStateHelper.eval(_DeltaStateHelper.java:249)
at javax.faces.component.UIOutput.getValue(UIOutput.java:67)
at javax.faces.component.UIInput.getValue(UIInput.java:151)
at javax.faces.component.UIInput.validate(UIInput.java:618)
at javax.faces.component.UIInput.processValidators(UIInput.java:274)
at javax.faces.component.UIForm.processValidators(UIForm.java:213)
at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1427)
at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1427)
at javax.faces.component.UIViewRoot._processValidatorsDefault(UIViewRoot.java:1456)
at javax.faces.component.UIViewRoot.access$500(UIViewRoot.java:74)
at javax.faces.component.UIViewRoot$ProcessValidatorPhaseProcessor.process(UIViewRoot.java:1563)
at javax.faces.component.UIViewRoot._process(UIViewRoot.java:1412)
at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:812)
at org.apache.myfaces.lifecycle.ProcessValidationsExecutor.execute(ProcessValidationsExecutor.java:38)
at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:170)
at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
at org.apache.deltaspike.jsf.impl.listener.request.DeltaSpikeLifecycleWrapper.execute(DeltaSpikeLifecycleWrapper.java:75)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.tomee.catalina.OpenEJBValve.invoke(OpenEJBValve.java:45)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: javax.el.ELException: Error reading 'name' on type de.glauche.beans.HelloWorldBean$$OwbNormalScopeProxy0
at javax.el.BeanELResolver.getValue(BeanELResolver.java:68)
at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:58)
at org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:179)
at org.apache.el.parser.AstValue.getValue(AstValue.java:183)
at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:185)
at org.apache.webbeans.el22.WrappedValueExpression.getValue(WrappedValueExpression.java:70)
at org.apache.myfaces.view.facelets.el.ContextAwareTagValueExpression.getValue(ContextAwareTagValueExpression.java:96)
... 35 more
Caused by: javax.enterprise.context.ContextNotActiveException: WebBeans context with scope type annotation #WindowScoped does not exist within current thread
at org.apache.webbeans.container.BeanManagerImpl.getContext(BeanManagerImpl.java:299)
at org.apache.webbeans.intercept.NormalScopedBeanInterceptorHandler.getContextualInstance(NormalScopedBeanInterceptorHandler.java:88)
at org.apache.webbeans.intercept.NormalScopedBeanInterceptorHandler.get(NormalScopedBeanInterceptorHandler.java:70)
at de.glauche.beans.HelloWorldBean$$OwbNormalScopeProxy0.getName(de/glauche/beans/HelloWorldBean.java)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at javax.el.BeanELResolver.getValue(BeanELResolver.java:64)
... 41 more
Am i missing something obvious? Or is it a bug in DeltaSpike? (or TomEE?)
This Exception indicates that the windowId is not set in the WindowContext. Did you add the proper DeltaSpike tag into your fragment?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:ds="http://deltaspike.apache.org/jsf">
<h:head></h:head>
<h:body>
<ds:windowId/>
...
The ds:windowId part is important.
You can debug into DeltaSpikeLifecycleWrapper#execute to see if the windowId gets detected properly.

Resources