Posts Tagged ‘howto’

HowTo: Setup GWT remote logging

Posted: February 26, 2013 in howto, Java, Technology
Tags: , , ,

I find the official documentation on remote logging wasn’t complete. Here are my notes based on various web sites I visited (here, here, and here). Hope this helps!

App.gwt.xml

You should add the inherits statement below. You should be able to adjust the log level to any of the following: ALL, FINEST, FINER, FINE, CONFIG, INFO, WARNING, SEVERE. I find the popup log console in the browser annoying, so I disabled it.

<inherits name=”com.google.gwt.logging.Logging”/>
<set-property name=”gwt.logging.simpleRemoteHandler” value=”ENABLED” />
<set-property name=”gwt.logging.logLevel” value=”FINEST”/>
<set-property name=”gwt.logging.enabled” value=”TRUE”/>
<set-property name=”gwt.logging.consoleHandler” value=”ENABLED” />
<set-property name=”gwt.logging.popupHandler” value=”DISABLED” />

web.xml

The following code is necessary for the server to receive log information and redirect to server log file.

<servlet>
<servlet-name>remoteLogging</servlet-name>
<servlet-class>com.google.gwt.logging.server.RemoteLoggingServiceImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>remoteLogging</servlet-name>
<url-pattern>/YOUR_MODULE/remote_logging</url-pattern>
</servlet-mapping>

java

Here is the example code you can use in GWT client-side.

import com.google.gwt.logging.client.SimpleRemoteLogHandler;
import java.util.logging.Level;
import java.util.logging.LogRecord;

SimpleRemoteLogHandler remoteLog = new SimpleRemoteLogHandler();
remoteLog.publish(new LogRecord(Level.INFO, “log message”));

Listing files excluding certain names

Posted: August 28, 2012 in howto, Technology
Tags:

I need to list all files in a directory tree excluding files with certain text in its names. This thread helped me to create something similar:

find . -type f |grep -v '/[.svn-base]' -

I needed to start svnserve at boot time as a particular user on Red Hat Enterprise Linux. After looking at this and this posts, I came up with the following:

/etc/rc.d/rc.local
su svn -c "svnserve -d"

 

This effectively runs svnserve in daemon mode as svn user after all other init scripts ran at boot time.

While attempting to crate a domain on the command line, I encountered an error complaining about missing terminalio. A looked around the web led me to this tip on how to work around the issue by adding the following parameter:

-Dweblogic.management.allowPasswordEcho=true

Maven and WebLogic 12c

Posted: February 29, 2012 in howto, Technology
Tags: , ,

Today, I tried to use Maven with WebLogic 12c. The documentation for installation is straight forward. I was able to execute mvn wls:help without any difficulty.

However, using the WebLogic plugin wasn’t as easy. In order to run commands such as mvn wls:start-server, I needed to configure various parameters, such as middlewareHome, domainHOme, user, password, and name. Instead of specifying these parameters every time I run the command, I added the following config to pom.xml:

<!-- WebLogic Server 12c Maven Plugin -->
<plugin>
    <groupId>com.oracle.weblogic</groupId>
    <artifactId>wls-maven-plugin</artifactId>
    <version>12.1.1.0</version>
    <configuration>
        <artifactLocation>
            com.oracle.weblogic:wls-dev:zip:12.1.1.0
        </artifactLocation>
        <middlewareHome>/export/apps/wls</middlewareHome>
        <domainHome>/export/apps/wlsdomains/d1</domainHome>
        <user>weblogic</user>
        <password>welcome1</password>
        <name>applicationName</name>
    </configuration>
 </plugin>

After that, I was able to run the following commands without manually entering additional parameters. :)

mvn wls:start-server
mvn wls:deploy
mvn wls:list-apps
mvn wls:undeploy
mvn wls:stop-server

Initially, I noticed the following error when attempting to deploy/undeploy the web app. This appears to go away after I restarted the server.

[ERROR] Unknown lifecycle phase "applicationName". You must specify a valid lifecycle phase or a goal in the format : or :[:]:. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-site, site, post-site, site-deploy, pre-clean, clean, post-clean. -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/LifecyclePhaseNotFoundException

How to mount box.net on Ubuntu

Posted: February 24, 2012 in howto, Technology
Tags: , , ,

Here is an instruction that worked for me. :)

I found a need to debug JBoss with Eclipse. A search on google led me to ths page. I had to tweak a bit to get my local instance to work.

For example, I had to change the quote character from ” to “.

JAVA_OPTS="-Xdebug -Xnoagent
-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n $JAVA_OPTS"

After that, JBOSS was able to load the new parameters correctly.

The post also have slightly different UI screen than what I see on my version of Eclipse. I did the following:

  1. Go to Run –> Debug Configurations … in the menu
  2. Rick click on Remote Java Application and choose New
  3. Choose the project of your choice. Change the address to 8787 to match the parameter specified for JBoss earlier. Change host name if necessary.
  4. Click Apply and then Debug

I was able to connect to the server and start debug the application. :)

History and tab panel in GWT

Posted: August 4, 2011 in howto, Technology
Tags: , , ,

I came across this tutorial and found it useful! :)

After I was so spoiled by GWT/Eclipse’s streamlined way of deploying a GWT application to the embedded server or Google App Engine, I was annoyed by how little support it has for other application servers. Fortunately, I was able to semi-automatically generate a WAR file for manual deployment on a remote server by following this tutorial :)

Back when I was working with Netbeans, deployment to a remote server was as simple as a single mouse click. On Eclipse, deployment to a remote server appears to be discouraged.

GWT SimplePager

Posted: June 9, 2011 in howto, Technology
Tags: , , , ,

It’s unfortunate that my initial experience with GWT’s SimplePager wasn’t very positive. The paging behaviour toward end of the list showed the following:

  1. For the last page, pager would attempt to request record count at last index + page size. This would cause pager to go index array out of bound. i.e. Let’s say you have 95 records with a page size of 10. The last page’s record index should be 90. If you add page size to it, you get 100. Requesting records between 90 and 100 caused the index array out of bound exception.
  2. If you use next page button navigate to the last page, it would display the last page in a way that the pager would fill the last page with a number of records the same as page size, no matter how many total records are. This created a very weird user experience. i.e For the same parameters above, you would see records #80-90 on the second to last page and then #85-95 on the last page.

After looking on-line for answers, I came across this thread and it helped me to resolve the issues that I observed above. :)