弹簧配置
<bean id="jmsQueueConnectionFactory" class="org.apache.qpid.client.AMQConnectionFactory">
<constructor-arg index="0"
value="amqp://guest:guest@localhost/test?brokerlist='tcp://localhost:5672'" />
</bean>
<bean id="cachingConnectionFactory" class="org.springframework.jms.connection.CachingConnectionFactory">
<property name="targetConnectionFactory" ref="jmsQueueConnectionFactory" />
<property name="sessionCacheSize" value="1" />
<property name="reconnectOnException" value="true" />
</bean>
<bean id="myDestination" class="org.apache.qpid.client.AMQAnyDestination">
<constructor-arg index="0" value="ADDR:myqueue; {create: always}" />
</bean>
<bean id="myServiceBean" class="com.test.MyService" />
<bean id="myContainer"
class="org.springframework.jms.listener.DefaultMessageListenerContainer">
<property name="connectionFactory" ref="cachingConnectionFactory" />
<property name="exceptionListener" ref="cachingConnectionFactory" />
<property name="messageListener" ref="myServiceBean" />
<property name="concurrentConsumers" value="1" />
<property name="autoStartup" value="true" />
<property name="destination" ref="myDestination" />
<property name="recoveryInterval" value="10000" />
</bean>
Run Code Online (Sandbox Code Playgroud)
MyService.java
public class MyService implements MessageListener {
public void …Run Code Online (Sandbox Code Playgroud) 我正在使用Flex/Bison/C++来评估表达式这是一个示例bison文件
string res;
yy_scan_string(expression.c_str());
yyparse();
cout<<"Result:"<<res<<"\n";
....
expr: expr PLUS expr {
$$=evaluate("+",$1,$3);
res=$$;
}
|expr MINUS expr {
$$=evaluate("-",$1,$3);
res=$$;
}
Run Code Online (Sandbox Code Playgroud)
而不是使用变量res并将值存储在每个动作中,是否有一种标准(如yylval)方式来访问yyparse()之后的最终结果?
我们升级了我们的项目,主要是 springboot 1.4.3,java 7 到 java 8。
之后,在应用程序启动过程中,需要超过 8 分钟才能通过 'Initializing ExecutorService 'taskScheduler' '
我们也有活动依赖
下面是日志
2017-01-24 14:56:15 INFO o.activiti.engine.impl.ProcessEngineImpl:82 - ProcessEngine default created
2017-01-24 14:56:15 INFO o.a.e.i.a.DefaultAsyncJobExecutor:86 - Starting up the default async job executor [org.activiti.engine.impl.asyncexecutor.DefaultAsyncJobExecutor].
2017-01-24 14:56:15 INFO o.a.e.i.a.DefaultAsyncJobExecutor:121 - Creating thread pool queue of size 100
2017-01-24 14:56:15 INFO o.a.e.i.a.DefaultAsyncJobExecutor:126 - Creating executor service with corePoolSize 2, maxPoolSize 10 and keepAliveTime 5000
2017-01-24 14:56:15 INFO o.a.e.i.a.AcquireTimerJobsRunnable:45 - {} starting to acquire async jobs due
2017-01-24 14:56:16 INFO …Run Code Online (Sandbox Code Playgroud) 如何处理primefaces文件下载的错误
<p:fileDownload value="#{testBean.file}" />
Run Code Online (Sandbox Code Playgroud)
测试Bean.java
public StreamedContent getFile() {
if(selectedReport ==null){
FacesContext.getCurrentInstance().addMessage(.."Please select a file");
return null;//What to do here
}
InputStream inps = ReportGenerator.getPDF(selectedReport);
return new DefaultStreamedContent(inps, "application/pdf", "report.pdf");
}
Run Code Online (Sandbox Code Playgroud) 我正在使用 JSF 2、myfaces、hibernate-validator-4.1.0.Final.jar。
我使用 hibernate-validator 来验证表单中输入的值。
public class Client {
@Persistent
@Pattern(regexp = "|.+@.+\\.[a-z]+", message = "Email format is invalid.")
private String email;
//getter
}
Run Code Online (Sandbox Code Playgroud)
我正在开发批量上传模块,我在其中解析 csv 数据并创建数据库记录。
...
try{
Client cl=new Client();
cl.setEmail("from_csv_data");
}catch( //validation failed
Run Code Online (Sandbox Code Playgroud)
我如何在这里重用相同的验证器?
SEVERE: Received 'java.lang.NoSuchMethodError' when invoking action listener '#{clientBean.bulkUpload}' for component 'j_idt86'
Run Code Online (Sandbox Code Playgroud)
2011 年 1 月 28 日上午 8:35:39 javax.faces.event.MethodExpressionActionListener processAction
严重:java.lang.NoSuchMethodError:javax.persistence.Persistence.getPersistenceUtil()Ljavax/persistence/PersistenceUtil; 在 org.hibernate.validator.engine.resolver.JPATraversableResolver.isReachable(JPATraversableResolver.java:62)
我试过这个解决方案链接
我有 hibernate-jpa-2.0-api-1.0.0.Final.jar,hibernate-validator-4.1.0.Final.jar
我需要任何其他 jar 来完成这项工作吗?
有没有办法配置(xml)tomcat(6.x)来生成唯一的SessionId.(不扩展ManagerBase/StandardManager).
可能重复:
浮点精度
double a=0.000001,b=50000;
b=a*b;
System.out.println("double:"+b); // -> double:0.049999999999999996
float a=0.000001f,b=50000;
b=a*b;
System.out.println("float"+b); // -> float0.05
Run Code Online (Sandbox Code Playgroud)
我在代码的大部分时间里使用了double,今天我发现了这个问题.我该怎么处理?
语境:
double []refValues= {100,75,50,25,15,5,1};
double bInMilliGram=b*1000;
double pickedVal=0;
for(double ref:refValues)
if(ref<=bInMilliGram) {
pickedVal=ref;
break;
}
System.out.println("bInMilliGram:"+bInMilliGram+", pickedVal:"+pickedVal);
Run Code Online (Sandbox Code Playgroud)
o/p: - > bInMilliGram:49.99999999999999,pickedVal:25.0
@Entity
@Table
public class Book {
@Id @GeneratedValue @Column private Long bookId;
@Column private String name;
@OneToMany(cascade=CascadeType.ALL,fetch=FetchType.EAGER)
@JoinColumn(name="bookId")
private List<Chapter> chapters=new ArrayList<Chapter>();
.....
@Entity
@Table
public class Chapter {
@Id @Column @GeneratedValue
private Long cid;
@Column private String name;
@Column private Long bookId;
....
Run Code Online (Sandbox Code Playgroud)
我应该在Chapter.bookId中使用什么注释来引用Book.bookId,这样chapter.bookid将在插入新书时获取Book.bookId的生成值.
Book bk=new Book();
bk.setName("b1");
Chapter ch=new Chapter();
ch.setName("b1c1");
bk.getChapters().add(ch);
Run Code Online (Sandbox Code Playgroud)
我得到这个错误Hibernate:插入Book(名称)值(?)Hibernate:插入章节(bookId,name)值(?,?)19:56:59,094 ERROR JDBCExceptionReporter:234 - 列'bookId'不能为null
java ×4
jsf-2 ×2
bison ×1
c++ ×1
flex-lexer ×1
hibernate ×1
java-8 ×1
primefaces ×1
qpid ×1
spring ×1
spring-boot ×1
tomcat ×1