This configuration works fine, but inbound-channel-adapter which is supposed to poll every 15 secs is running continously. Does anyone have an idea what I'm doning wrong?
<si:channel id="msgChannel" />
<si:inbound-channel-adapter ref="jdbcInputAdapter"
method="fetchData" channel="msgChannel">
<si:poller>
<si:interval-trigger interval="15000" />
</si:poller>
</si:inbound-channel-adapter>
<si:outbound-channel-adapter ref="shouter" method="shout" channel="msgChannel"/>
Hi all,
Using the Synth LaF, I am unable to set a JLabel's FOREGROUND color for the DISABLED state. has anybody succeeded in doing this? Here is my label's style definition in my LaF.xml file.
<style id="whiteLabelStyle">
<opaque value="false"/>
<font name="Bitstream Vera Sans" size="16" />
<state>
<color type="FOREGROUND" value="WHITE"/>
</state>
<state value="DISABLED">
<color type="FOREGROUND" value="BLACK"/>
</state>
</style>
<bind style="whiteLabelStyle" type="name" key="WhiteOrbitLabel"/>
Please not that all the other styles defined in my LaF.xml file are rendered properly in my application including my label's WHITE normal state color (it just never goes to black when I do lbl.setEnabled(false)
Also, going through the Synth code, I have found the following comment in SynthStyle.getColor
if ((context.getComponentState() & SynthConstants.DISABLED) != 0) {
//This component is disabled, so return the disabled color.
//In some cases this means ignoring the color specified by the
//developer on the component. In other cases it means using a
//specified disabledTextColor, such as on JTextComponents.
//For example, JLabel doesn't specify a disabled color that the
//developer can set, yet it should have a disabled color to the
//text when the label is disabled. This code allows for that.
if (c instanceof JTextComponent) {
JTextComponent txt = (JTextComponent)c;
Color disabledColor = txt.getDisabledTextColor();
if (disabledColor == null || disabledColor instanceof UIResource) {
return getColorForState(context, type);
}
} else if (c instanceof JLabel
&& (type == ColorType.FOREGROUND || type == ColorType.TEXT_FOREGROUND)){
return getColorForState(context, type);
}
But I could not figure out how to set a disabled color for a JLabel
Thanks for your help!
I have written a small web servlet to run under Tomcat, using Eclipse Helios. In its old, non-source-controlled location, everything was fine, but now I need to add this to our source control system. Moving the old files out of the way, creating a new workspace, setting up the server connection and copying and importing the existing projects into the new workspace all worked fine once I figured out how to do it, but I can't get the servlet to build. Instead, I get a whole bunch of cannot be resolved to a type errors talking about various servlet class types; HttpServlet, HttpServletRequest, ServletException, etc. Another error that is almost certainly related is The import javax.servlet cannot be resolved.
I am obviously missing something very basic, but I'm new to this (and not having the terminology really down pat probably doesn't help me Google for an answer). Any suggestions as to what I might be missing would be greatly appreciated.
I'm trying to understand the fine art of tuning Tomcat memory settings. In this quest I have the following three questions:
Which memory related JVM startup parameters are worth setting when running Tomcat? Why?
What are useful rule-of-thumbs when fine-tuning the memory settings for a Tomcat installation?
How do you monitor the memory consumption of your live Tomcat installation?
How to make use of jndi in a stand-alone (non-managed) application?
App and Tomcat6 are on the same machine.
Can we get something through jndi lookup when the server is running,
but when the app is not running under this tomcat server?
I am writing a tomcat app, and have a need to do authentication within the URL like this:
https://user:[email protected]
Except for the life of me i'm not sure how to set it up or able to find the docs to read up on it, clearly my google skills need work.
Can anyone tell me where i should be looking for this kind of info or where to start?
Cheers
Andy
I'm trying to cache lazy loaded collections with ehcache/hibernate in a Spring project. When I execute a session.get(Parent.class, 123) and browse through the children multiple times a query is executed every time to fetch the children. The parent is only queried the first time and then resolved from the cache.
Probably I'm missing something, but I can't find the solution. Please see the relevant code below.
I'm using Spring (3.2.4.RELEASE) Hibernate(4.2.1.Final) and ehcache(2.6.6)
The parent class:
@Entity
@Table(name = "PARENT")
@Cacheable
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE, include = "all")
public class ServiceSubscriptionGroup implements Serializable {
/** The Id. */
@Id
@Column(name = "ID")
private int id;
@OneToMany(fetch = FetchType.LAZY, mappedBy = "parent")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
private List<Child> children;
public List<Child> getChildren() {
return children;
}
public void setChildren(List<Child> children) {
this.children = children;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Parent that = (Parent) o;
if (id != that.id) return false;
return true;
}
@Override
public int hashCode() {
return id;
}
}
The child class:
@Entity
@Table(name = "CHILD")
@Cacheable
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE, include = "all")
public class Child {
@Id
@Column(name = "ID")
private int id;
@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
@JoinColumn(name = "PARENT_ID")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
private Parent parent;
public int getId() {
return id;
}
public void setId(final int id) {
this.id = id;
}
private Parent getParent(){
return parent;
}
private void setParent(Parent parent) {
this.parent = parent;
}
@Override
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
final Child that = (Child) o;
return id == that.id;
}
@Override
public int hashCode() {
return id;
}
}
The application context:
<bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="annotatedClasses">
<list>
<value>Parent</value>
<value>Child</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.SQLServer2008Dialect</prop>
<prop key="hibernate.hbm2ddl.auto">validate</prop>
<prop key="hibernate.ejb.naming_strategy">org.hibernate.cfg.ImprovedNamingStrategy</prop>
<prop key="hibernate.connection.charSet">UTF-8</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">true</prop>
<prop key="hibernate.use_sql_comments">true</prop>
<!-- cache settings ehcache-->
<prop key="hibernate.cache.use_second_level_cache">true</prop>
<prop key="hibernate.cache.use_query_cache">true</prop>
<prop key="hibernate.cache.region.factory_class"> org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory</prop>
<prop key="hibernate.generate_statistics">true</prop>
<prop key="hibernate.cache.use_structured_entries">true</prop>
<prop key="hibernate.cache.use_query_cache">true</prop>
<prop key="hibernate.transaction.factory_class"> org.hibernate.engine.transaction.internal.jta.JtaTransactionFactory</prop>
<prop key="hibernate.transaction.jta.platform"> org.hibernate.service.jta.platform.internal.JBossStandAloneJtaPlatform</prop>
</props>
</property>
</bean>
The testcase I'm running:
@Test
public void testGetParentFromCache() {
for (int i = 0; i <3 ; i++ ) {
getEntity();
}
}
private void getEntity() {
Session sess = sessionFactory.openSession()
sess.setCacheMode(CacheMode.NORMAL);
Transaction t = sess.beginTransaction();
Parent p = (Parent) s.get(Parent.class, 123);
Assert.assertNotNull(p);
Assert.assertNotNull(p.getChildren().size());
t.commit();
sess.flush();
sess.clear();
sess.close();
}
In the logging I can see that the first time 2 queries are executed getting the parent and getting the children. Furthermore the logging shows that the child entities as well as the collection are stored in the 2nd level cache. However when reading the collection a query is executed to fetch the children on second and third attempt.
According to Tomcat docs:
The maximum size in bytes of the POST
which will be handled by the container
FORM URL parameter parsing. The limit
can be disabled by setting this
attribute to a value less than or
equal to 0. If not specified, this
attribute is set to 2097152 (2
megabytes).
But what's "the container FORM URL parameter parsing"? Any ideas what is the purpose of "maxPostSize"?
Thanks in advance.
i am new to the whole OSGi stuff and my task is to create an OSGi Bundle out from an exisitng maven project.
To get started i decided to pick the smallest part and starting with it:
Here is the pom.xml
project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>cross</artifactId>
<groupId>net.sf.maltcms</groupId>
<version>1.2.12-SNAPSHOT</version>
</parent>
<artifactId>cross-main</artifactId>
<packaging>jar</packaging>
<name>cross-main</name>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>cross-annotations</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>cross-event</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>cross-tools</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>cross-exception</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>cross-main-api</artifactId>
<version>${project.version}</version>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>3.0.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-asm</artifactId>
<version>3.0.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>3.0.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>3.0.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>3.0.6.RELEASE</version>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
<version>3.0.6.RELEASE</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.1</version>
</dependency>
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache-core</artifactId>
<version>2.4.6</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>cross-math</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.db4o</groupId>
<artifactId>db4o-all</artifactId>
<version>8.0.249</version>
</dependency>
<dependency>
<groupId>net.sf.mpaxs</groupId>
<artifactId>mpaxs-spi</artifactId>
<version>1.6.10</version>
</dependency>
<dependency>
<groupId>net.sf.mpaxs</groupId>
<artifactId>mpaxs-server</artifactId>
<version>1.6.10</version>
</dependency>
</dependencies>
I did some research and found the Apache Bundle Plugin for maven and changed the pom to this
<packaging>bundle</packaging>
and added
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
mvn clean install went fine and i got a jar file containing the manifest, but of course the bundle could not be resolved
BundleException: The bundle "cross-main_1.2.12.SNAPSHOT [30]" could not be resolved. Reason: Missing Constraint: Import-Package: com.db4o; version="[8.0.0,9.0.0)
To make a long story short: What are the possibiliteis to migrate a maven application into an OSGi Bundle?
Espacially how to manage the dependencys
I am building a simple web applications with 3 layers - DAO, Service, MVC. When in my Controller I want to delete menu group and it contains menus I am getting ConstraintViolationException.
Where should I handle this exception? In DAO, Service, or in Controller? Currently I am handling the exception in Controller.
My code below.
DAO method for deleting menu groups:
@Override
public void delete(E e){
if (e == null){
throw new DaoException("Entity can't be null.");
}
getCurrentSession().delete(e);
}
Service method for deleting menu groups:
@Override
@Transactional(readOnly = false)
public void delete(MenuGroupEntity menuGroupEntity) {
menuGroupDao.delete(menuGroupEntity);
}
Controller method for deleting menu groups in Controller:
@RequestMapping(value = "/{menuGroupId}/delete", method = RequestMethod.GET)
public ModelAndView delete(@PathVariable Long menuGroupId, RedirectAttributes redirectAttributes){
MenuGroupEntity menuGroupEntity = menuGroupService.find(menuGroupId);
if (menuGroupEntity != null){
try {
menuGroupService.delete(menuGroupEntity);
redirectAttributes.addFlashAttribute("flashMessage", "admin.menu-group-deleted");
redirectAttributes.addFlashAttribute("flashMessageType", "success");
} catch (Exception e){
redirectAttributes.addFlashAttribute("flashMessage", "admin.menu-group-could-not-be-deleted");
redirectAttributes.addFlashAttribute("flashMessageType", "danger");
}
}
return new ModelAndView("redirect:/admin/menu-group");
}
I've been trying to find information on this, but due to the immaturity of the Spring Integration framework I haven't had much luck.
Here is my desired work flow:
New files are placed in an 'Incoming' directory
Files are picked up using a file:inbound-channel-adapter
The file content is streamed, N lines at a time, to a 'Stage 1' channel, which parses the line into an intermediary (shared) representation.
This parsed line is routed to multiple 'Stage 2' channels.
Each 'Stage 2' channel does its own processing on the N available lines to convert them to a final representation. This channel must have a queue which ensures no Stage 2 channel is overwhelmed in the event that one channel processes significantly slower than the others.
The final representation of the N lines is written to a file. There will be as many output files as there were routing destinations in step 4.
*'N' above stands for any reasonable number of lines to read at a time, from [1, whatever I can fit into memory reasonably], but is guaranteed to always be less than the number of lines in the full file.
How can I accomplish streaming (steps 3, 4, 5) in Spring Integration? It's fairly easy to do without streaming the files, but my files are large enough that I cannot read the entire file into memory.
As a side note, I have a working implementation of this work flow without Spring Integration, but since we're using Spring Integration in other places in our project, I'd like to try it here to see how it performs and how the resulting code compares for length and clarity.
I have a SVG document that I exported from Visio 2003 that would like to edit. This file has an action where you click a button it will navigate to a new screen. What I would like to do is have the navigation be based off of a data point rather than having to click the button.
As an example I have a dynamic point data being brought into the SVG file and when that value changes from 0 to 1, I want this screen to automatically navigate to another screen. Below is the code I for clicking the button.
<title content="structured text">Sheet.1107</title>
<desc content="structured text">Button 1</desc>
<v:custProps>
<v:cp v:ask="false" v:langID="1033" v:invis="false" v:cal="0" v:val="VT4(Test Graphic 2)" v:type="0" v:prompt="" v:nameU="ObjRef" v:sortKey="" v:lbl="" v:format=""/>
<v:cp v:ask="false" v:langID="1033" v:invis="false" v:cal="0" v:val="VT4(SF-S)" v:type="0" v:prompt="" v:nameU="DataPt" v:sortKey="" v:lbl="" v:format=""/>
</v:custProps>
<v:userDefs>
<v:ud v:prompt="" v:nameU="NAVIGATE" v:val="VT4(NAVIGATE Test Graphic 2,'',)"/>
</v:userDefs>
<v:textBlock v:margins="rect(4,4,4,4)"/>
<v:textRect width="125.01" height="35" cx="62.5" cy="517.5"/>
<rect x="0" width="125" y="500" height="35" class="st3"/>
<text x="40.15" y="521.1" v:langID="1033" class="st4"><v:paragraph v:horizAlign="1"/><v:tabList/>Button 1</text> <jci:action type="click" count="1">if(evt.button == 0) nav('Test Graphic 2','','');</jci:action></g></a>
In the above code I am bringing in the data value from SF-S. Once that value is equal to 1 I want this screen to automatically navigate to Test Graphic 2.
I don't have any experience with coding so I am hoping someone here will be able to help me.
Thanks,
DMyers
The opposite of this question: http://stackoverflow.com/questions/138099/how-do-i-add-a-type-to-gwts-serialization-policy-whitelist
GWT is adding undesired types to the serialization policy and bloating my JS. How do I trim my GWT whitelist by hand? Or should I at all?
For example, if I put the interface List on a GWT RPC service class, GWT has to generate Javascript that handles ArrayList, LinkedList, Stack, Vector, ... even though my team knows we're only ever going to return an ArrayList. I could just make the method's return type ArrayList, but I like relying on an interface rather than a specific implementation. After all, maybe one day we will switch it up and return e.g. a LinkedList. In that case, I'd like to force the GWT serialization policy to compile for only ArrayList and LinkedList. No Stacks or Vectors.
These implicit restrictions have one huge downside I can think of: a new member of the team starts returning Vectors, which will be a runtime error. So besides the question in the title, what is your experience designing around this?
I created a dialog box like this:
String response =
JOptionPane.showInputDialog(null,"message","title",JOptionPane.PLAIN_MESSAGE);
I'd like to keep it always on top of all windows.
Do you have any idea?
Thanks!
After a new user submits a 'New account' form, I want to manually log that user in so they don't have to login on the subsequent page.
The normal form login page going through the spring security interceptor works just fine.
In the new-account-form controller I am creating a UsernamePasswordAuthenticationToken and setting it in the SecurityContext manually:
SecurityContextHolder.getContext().setAuthentication(authentication);
On that same page I later check that the user is logged in with:
SecurityContextHolder.getContext().getAuthentication().getAuthorities();
This returns the authorities I set earlier in the authentication. All is well.
But when this same code is called on the very next page I load, the authentication token is just UserAnonymous.
I'm not clear why it did not keep the authentication I set on the previous request. Any thoughts?
Could it have to do with session ID's not being set up correctly?
Is there something that is possibly overwriting my authentication somehow?
Perhaps I just need another step to save the authentication?
Or is there something I need to do to declare the authentication across the whole session rather than a single request somehow?
Just looking for some thoughts that might help me see what's happening here.
Imagine the UI passes back an XMl node as such:
<properties>
<type> Source </type>
<name> Blooper </name>
<delay>
<type> Deterministic </type>
<parameters>
<param> 4 </param>
</parameters>
<delay>
<batch>
<type> Erlang </type>
<parameters>
<param> 4 </param>
<param> 6 </param>
</parameters>
<batch>
And behind the scene what it is asking that you instantiate a class as such:
new Source("blooper", new Exp(4), new Erlang(4,6);
The problem lies in the fact that you don't know what class you will need to processing, and you will be sent a list of these class definitions with instructions on how they can be linked to each other.
I've heard that using a BeanFactoryPostProcessor might be helpful, or a property editor/convertor. However I am at a loss as to how best to use them to solve my problem.
Any help you can provide will be much appreciated.
I used Server side code for HIDE a DIV. but when i click button tool for another event but DIV is always open. I use ASP.net c# code.
how i solve this problem
thanks
Hey
This is a bit of a weird request but I am trying to set some jvmargs in the log4j.properties file. At present I use ant to for example set some args....
jvmarg value="-Dmail.smtp.socketFactory.port=465"
... but it would be great to group a few of these logging relevant arguments into the .properties file. Does anyone know how to do this?
Thanks in advance!
Is there any specific protocol for handling exceptions in public methods? Consider this eg.
public int someMethod()
{
try{
code that might throw an exception
}
catch(Exception e)
{
log the exception
}
}
Say that this method might throw an ArrayIndexOutOfBoundsException. So, is it correct to handle this Exception in the method itself (as in the example) or throw it and assume that the calling method will handle the Exception?
I just tried the Apache Wicket "Hello, world" application and I noticed that in the rendered HTML output, Wicket is exposing it's internal attributes.
This is what the rendered HTML looks like in the 'view source' of the browser:
<html>
<body>
<span wicket:id="message" id="message">Hello World!</span>
</body>
</html>
How do I get rid of the wicket:id="message" attribute in the rendered HTML output?
I'm writing some code like :
PostMethod p = new PostMethod(someurl);
...
NameValuePair[] data = {
new NameValuePair("name1", "somevalue1"),
new NameValuePair("var[3][1]", "10")
};
try {
hc.executeMethod(p);
}
...
And that's what I get, when I look at my post in Wireshark:
POST /someurl HTTP/1.1
...
type=var&ship%5B3%5D%5B1%5D=10
%5B means [, %5D- ]
So the problem is how I can get square brackets in my post?
We are currently planning to launch a couple of internal web projects in the future. Our company's dev teams are mostly experienced in J2EE and have worked with it for years. Today, we have the choice of launching a couple of our projects on .net. I have checked out a couple of sources on the net, and it seems like the "J2EE vs ASP.net" combat brings out as much discord as the overseen "Apple vs Microsoft" or "Free Eclipse vs Visual Studio"...
Nevertheless, I have been somewhat quite impressed with ASP.net's abilities to create great things with huge simplicity (for ex. asp.net ajax's demos). No more tons of xmls to play with, no more tons of frameworks to configure (we usually use the famous combo struts/spring/hibernate)... It just seemed to me that ASP.net had some good advantages over J2EE, but then again, I may speak by ignorance.
What I want to know is this : What are the real advantages of using J2EE over ASP.net? Is there anything that cannot be done in ASP.net that can be done in J2EE? Once the frameworks are all in place and configured, is it faster to develop apps in J2EE than it is in .net? Are the applications generally easier to maintain in J2EE than in ASP.net? Is it worth it for some developpers to leave their J2EE knowledge on the side and move on to ASP.net if it does exactly the same thing?
Hello guys, this is my first post and im still a beginner in the programming world so bare with me. I just created an array with 100 initialized values and i want to print out 10 elements on each line
so it would be somthing like this
0 1 2 3 4 5 6 7 8 9
10 11 12 13 14 15 16
...26
this is the code i used and i managed to do it for the first 10 elements but i couldnt figure out how to do it for the rest
public static void main(String[] args) {
int[] numbers = { 0,1,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17};
int i, count = 0;
for (i = 0; i < numbers.length; i++) {
System.out.print(numbers[i] + " ");
count++;
if (count == 9)
for (i = 9; i < numbers.length; i++)
System.out.println(numbers[i] + " ");
}
}
thanks!
I want to change the values on one ComboFieldEditor depending on another ComboFieldEditor in an eclipse plugin. E.g. if the user changes the package, different classes need to be populated in the second ComboFieldEditor. The ComboFieldEditor class does not seem to to have a way to change the items on the fly.