Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!

Robin Sharma

Ranch Hand
+ Follow
since Aug 24, 2005
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Robin Sharma

One of the patterns I'm sick to death of is the Template pattern. There are way too many in-house, home-grown frameworks in the Java web application space that excessively use this pattern. I mean it's so hard to follow the logic around because you keep jumping between sub-classes and super classes. Which methods do I override, and when etc... And to top it all, most of these frameworks are poorly documented, which makes it doubly hard to understand them, especially for the new guys on the team. I think there are good examples of its usage also (Spring) but they come with excellent documentation. Although, the fact that it requires heavy documentation to simply start using it should be a sign that it could be done better.

It makes me wonder what are some of the other ways of designing through which these problems can be avoided.

Just chiming in...

Christophe Verré wrote:Mmmm... Sorry. It worked here with Groovy Version: 1.7.0 JVM: 1.5.0_07, WinXP.
Can you also try :


Nope, I still get the same error.

Christophe Verré wrote:Just in case, can you also try "groovy -v" and make sure you're using version 1.7 ?


Chris, I am running Groovy 1.7.0 with JDK 1.5 b14 on Win XP Pro 2002 SP3.
11 years ago

Christophe Verré wrote:




Still not working
11 years ago
Howdy,

I'm not able to pass a custom delimiter to the autosplit Groovy command line switch. I've tried the following but they all result in errors:


Only the default usage works:


Environment details:
Groovy: 1.7.0
JVM: 1.5.0_14
OS: Win XP Pro 2002 SP3

What could be the problem here?

Thanks,
-DW
11 years ago
Hi,
I have a query regarding the usage of document.getElementById() in FF. I was running the below code and document.getElementById() was returning a null in FF(version 3.5.7), but was working fine in IE

<input type="hidden" name="ProductName" id = "ProductName" >
<xsl:attribute name="value">
<xsl:value-of select="//Header/Terms/AdviceTrack" />
</xsl:attribute>
</input>
<input type="text" id="text1" value="abc"/>
<script language="JavaScript" type="text/javascript">

getElem(document,"ProductName");

<xsl:comment>

function getElem(doc,id) {
if (doc.getElementById) {
return doc.getElementById(id);-------> This was returning a null on FF.
} else if (doc.all) {
return doc.all[id];
} else if (doc.layers) {
return doc.layers[id];
}else{
return null; // this is not happening
}
}
</xsl:comment>
</script>

Now i removed the 'name' attribute and it seems to be working fine on both the browsers:)
I wanted to know the reason behind this strange behaviour of FF? and
Why was it returning a null before?
Ahh, figured this out. The following system properties need to be set, so that the "logging.properties" file can be picked up.

Assuming that the tomcat is located under an Eclipse project, add the following under the "Arguments" tab of its launch configuration:

-Dcatalina.base="${project_loc}\<apache-tomcat-5.5.23_loc>"
-Dcatalina.home="${project_loc}\<apache-tomcat-5.5.23_loc>"
-Djava.util.logging.config.file="${project_loc}\<apache-tomcat-5.5.23_loc>\conf\logging.properties"
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager

Cheers!
13 years ago
Hmm, it seems that if I launch Tomcat (v 5.5 this time), from within Eclipse, it doesn't honor the above log setting.
But, if I launch the same tomcat directly from its bin directory, it works as expected!

Could anyone provide an insight into this???

Here's the eclipse launch configuration for the above:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/apache-tomcat-5.5.23/apache-tomcat-5.5.23/bin/bootstrap.jar"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
<booleanAttribute key="org.eclipse.jdt.debug.ui.INCLUDE_EXTERNAL_JARS" value="true"/>
<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.6.0_07" path="1" type="4"/> "/>
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.defaultClasspath"> <memento exportedEntriesOnly="false" project="apache-tomcat-5.5.23"/> </runtimeClasspathEntry> "/>
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.variableClasspathEntry"> <memento path="3" variableString="${env_var:JAVA_HOME}\lib\tools.jar"/> </runtimeClasspathEntry> "/>
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
<stringAttribute key="org.eclipse.debug.core.source_locator_id" value="org.eclipse.jdt.launching.sourceLocator.JavaSourceLookupDirector"/>
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.apache.catalina.startup.Bootstrap"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="start"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="apache-tomcat-5.5.23"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx1024m"/>
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:apache-tomcat-5.5.23/apache-tomcat-5.5.23/bin}"/>
</launchConfiguration>


Thanks.
13 years ago
Never mind, i got the answer. You just need to add this at the end of the file:

# com.foo.bar -> the concerned package.
com.foo.bar.level = WARNING
13 years ago
Carrying on from the earlier post, my Tomcat 6/conf/logging.properties file has the following entries for the catalina.log file and the console:

1catalina.org.apache.juli.FileHandler.level = INFO
1catalina.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
1catalina.org.apache.juli.FileHandler.prefix = catalina.

AND

java.util.logging.ConsoleHandler.level = INFO
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter

Now, is there a way to configure these to ignore any log messages belonging to a particular package, say, com.sun.xml?

Thanks.
13 years ago
Howdy,

I'm currently using Tomcat 6.0.18. Now, I have a JPA-enabled web app deployed in it. In this app, there are typical CRUD operations on some JPA entities. Now, according to the JPA spec, whenever a getSingleResult() is performed, if no records are found, a javax.persistence.NoResultException is thrown. This is clogging up my Tomcat log files although it doesn't provide any crucial information.

So, is there a way in the conf/logging.properties file to ignore logging this particular exception?

Thanks.
13 years ago
Howdy!

I'm playing around with the ScheduledExecutorService scheduler. In the code i first init the scheduler with a fixed thread pool size and then pass it a simple task which keeps refreshing a shared list with new data, periodically. At random, the task might throw a runtime exception, in which case the scheduler should start a new thread, but i don't see it doing that. So, how do i simulate this scenario? I'm running this code on a single CPU m/c, using JDK 1.5.



I just get the following log messages and then nothing happens:

[18:41:45,150] Using a pool size of: 1
[18:41:45,160] Original list... [33, 39, 4, 82, 22]
[18:41:45,160] Starting scheduler...
[18:41:45,160] Setting shutdown hook to cleanup thread pools...
[18:41:49,156] pool-1-thread-1 > Refreshing list with new data: [25, 42, 73, 17, 17]
[18:41:49,166] pool-1-thread-1 > zzzZZZ, gotta sleep before updating...
[18:41:51,169] Oops, gotta throw an exception


Thanks.

Tim Holloway wrote:I don't understand. Regardless of whether a session bean is JSF-managed or managed via regular J2EE code, what are you trying to do?

It sounds like you're removing the bean from the session, modifying it, then returning it to the session. What's the point in removing/adding, when you can just leave the bean in the session and modify it in place?



Tim, I use the setSessionBean method mainly to clear a bean from the session, by passing in null.
13 years ago
JSF
Guys, what I want is to centralize the code to get/set any bean in the session. The code I have shown above is getting repeated in many of beans. I want to avoid that.
13 years ago
JSF
Howdy!

In my JSF managed beans, I frequently have the need to access some bean which is already in session, fiddle around with it and then set it back to the session. Could it be possible to create a managed bean which serves just as a utility class where the above and other common functionality could be hosted? Is it the right way or is there any other way to achieve the same?

Something like:
13 years ago
JSF
Howdy,

I have a JSP within which I include another JSP and within that I have yet another one. These included JSPs are within subView tags. What I'm seeing is that within the innermost JSP, if I have any verbatim tags, then the html inside those tags is NOT rendered the first time the page is loaded. However, when I perform any action which refreshes the page, the html appears. And from that point onwards things are fine .

Has anyone else encountered this problem? I'm using the Apache MyFaces JSF components.

Thanks.
13 years ago
JSF