gilbert engle

+ Follow
since Jun 03, 2009
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by gilbert engle

toplink session readobject nullpointerexception

Are you looking for these keywords?

You will get a nullpointerexception from session.readObject if you don't include a setter method for your class.

DirectToFieldMapping somethingIntValueMapping = new DirectToFieldMapping();
somethingIntValueMapping.setSetMethodName("setIntValue"); // gotta have this!

When you call readObject this is a request to read an object from the database. It is required that you provide setter methods for ALL object data attributes so that the readObject method can do its job

Session.readObject should be able to detect this problem and give you a meaningful Exception to work with, but it does not. I spent a long time on this one!
OK, who knows what the deal was but Chrome is now working properly for me. Apparently I was experiencing some sort of transient error.

Windows 7, 64 bit, 4GB, Dell Inspiron N411Z
6 years ago
This is the original author. I tried Chrome on a different machine and it worked properly. Both systems are using Windows 7. Who knows what's wrong with the original machine.
6 years ago
// here's a test URL

If you use Firefox or IE you get a page with images and links. If you use Chrome you get the HTML source code displayed in the window without interpretation. I tried

header('Content-type: text/html');

but it didn't help. I just get plain HTML code displayed in the window. Anybody else having this same problem? I should have the latest version of Chrome.

thank you
6 years ago
I successfully got ActiveMQ working with SSL and JBOSS. Here's all the information

Follow directions here

// I don't think it is necessary to update ALL of the following files but I haven't taken the time to figure which are important

<transportConnector name="ssl" uri="ssl://localhost:61617?wantClientAuth=true&needClientAuth=true&transport.commandTracingEnabled=true" />

activemq-demo.xml // probably not needed

<transportConnector name="ssl" uri="ssl://localhost:61617"/>


<transportConnector name="ssl" uri="ssl://localhost:61617?wantClientAuth=true&needClientAuth=true&transport.commandTracingEnabled=true" />


<transportConnector name="ssl" uri="ssl://localhost:61617?wantClientAuth=true&needClientAuth=true&transport.commandTracingEnabled=true" />


<transportConnector name="ssl" uri="ssl://localhost:61617?wantClientAuth=true&needClientAuth=true&transport.commandTracingEnabled=true" />


<transportConnector name="ssl" uri="ssl://localhost:61617?wantClientAuth=true&needClientAuth=true&transport.commandTracingEnabled=true" />


<transportConnector name="ssl" uri="ssl://localhost:61617?wantClientAuth=true&needClientAuth=true&transport.commandTracingEnabled=true" />


<transportConnector name="ssl" uri="ssl://localhost:61617?wantClientAuth=true&needClientAuth=true&transport.commandTracingEnabled=true" />


<networkConnector uri="static:(ssl://localhost:61616)" duplex="true"/>


<transportConnector name="ssl" uri="ssl://localhost:61617?needClientAuth=true" />

activemq.xml (inside <broker>

<transportConnector name="ssl" uri="ssl://localhost:61617?needClientAuth=true" />


<transportConnector name="ssl" uri="ssl://localhost:61617?needClientAuth=true" />

// the following was placed inside AND outside of <broker>
<amq:broker useJmx="false" persistent="false">

keyStore="c:/ActiveMQ/broker.ks" keyStorePassword="password"
trustStore="c:/ActiveMQ/client.ks" trustStorePassword="password"/>

<amq:transportConnector uri="ssl://localhost:61616" />


Download activemq-cpp-library-3.4.3 project
Download Bloodshed Dev C++
Download Open SSL
Drop all source files from activemq-cpp-library-3.4.3/src/main into a Dev C++ project
Set Dev C++ to build a DLL
Update main/activmq/util/Config.h, insert #define HAVE_OPENSSL 1
Build DLL from Dev C++
Update system PATH variable to point to directory containing the DLL
Update system PATH variable to point to \OpenSSL-Win64\lib

Change your code so that you have

ConnectionFactory connectionFactory =
new ActiveMQConnectionFactory("ssl://localhost:61617");

Update activemq.bat to set info about keystores and trust stores, when starting activemq precede by seting ACTIVEMQ_ENCRYPTION_PASSWORD=activemq

"%_JAVACMD%" %SUNJMX% %ACTIVEMQ_DEBUG_OPTS% %ACTIVEMQ_OPTS% %SSL_OPTS% -Dactivemq.classpath="%ACTIVEMQ_CLASSPATH%" -Dactivemq.home="%ACTIVEMQ_HOME%" -Dactivemq.base="%ACTIVEMQ_BASE%" -Dactivemq.conf="%ACTIVEMQ_CONF%""%ACTIVEMQ_DATA%""%ACTIVEMQ_TMP%" -jar "%ACTIVEMQ_HOME%/bin/run.jar" %*

Add debug command to activemq

if "%ACTIVEMQ_OPTS%" == "" set ACTIVEMQ_OPTS=-Xms1G -Xmx1G

When starting client add


OK, I tried to cover everything. All of this will definitely help you reach your goal of ActiveMQ invocation with server and client SSL validation

OK, I have made some progress since my original problem question post. Here's the new scenario

Server server = new Server(Protocol.HTTP, 8182, new TestServerApplication());
// does NOT work
router.attach("/contacts/", ContactServerResource.class); Exception in thread "main" Not Found (404) - Not Found

// does NOT work
router.attach("/contacts/", ContactServerResource.class, Router.MODE_BEST_MATCH); Exception in thread "main" Not Found (404) - Not Found

// works!

I thought maybe I could try something with Router.createRoute(String, Restlet) but the compiler tells me no such method

I'm stuck now. I'm not sure what else to try. Anybody have any ideas? thank you
6 years ago
I just tried spring-web-3.2.0.M2.jar from the latest release. Same results.
6 years ago
Trying to get this stuff to work on your own is crazy. The pieces and parts presented in the User's Guide are incomplete. I finally located some working source code
6 years ago
OK, trying to get this stuff to work on your own is crazy. The pieces and parts that are presented in the user's guide are incomplete. I finally located some working source files.

6 years ago
public class MyTestClientResource {

public static void main(String[] args) throws Exception {

ClientResource clientResource = new ClientResource(
MyTestResource testResource = clientResource.wrap(MyTestResource.class);

// Retrieve the JSON value
Customer result = testResource.retrieve();

System.out.println("CUSTOMER " + result);
if (result != null) {

public interface MyTestResource {

public Customer retrieve();

public void store(Customer customer);

public void stop() throws Exception;

public void remove() throws Exception;


public class TestServerResource extends ServerResource implements MyTestResource {

private static volatile Customer myCustomer = Customer.createSample();
private static Server server = null;

public static void main(String[] args) throws Exception {
server = new Server(Protocol.HTTP, 8182, TestServerResource.class);

public Customer retrieve() {
System.out.println("GET request received");
System.out.println("CUSTOMER( " + myCustomer + ")");
return myCustomer;

public void store(Customer customer) {
System.out.println("PUT request received");
myCustomer = customer;

public void stop() throws Exception {
System.out.println("POST request received");

public void remove() throws Exception {
System.out.println("DELETE request received");
myCustomer = null;


runnning MyTestClientResource results in


I carefully copied all of the source code from the example but it just doesn't work. Any ideas? Thank you very much

source code example

6 years ago
I am trying to put together a web service example with Spring beans. I am getting the following error

19:46:20,478 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-
host].[/iiii]] (MSC service thread 1-2) Exception sending context initialized ev
ent to listener instance of class org.springframework.web.context.ContextLoaderL
istener: org.springframework.beans.factory.BeanDefinitionStoreException: Line 5
in XML document from class path resource [applicationContext.xml] is invalid; ne
sted exception is org.xml.sax.SAXParseException; lineNumber: 5; columnNumber: 76
; Document root element "beans", must match DOCTYPE root "null"..

I have read that this can be caused by old spring jar files. It seems to be loading the wrong version of org.springframework.web.context.ContextLoaderListener.

I have spring-web-2.0-m2.jar in JBOSS_CLASSPATH, the system classpath, and I pass it into Jboss with -classpath.

I can't tell what jar file JBoss is actually using. There are no *spring* files in the JBoss directory structure.

I also put spring-web-2.0-m2.jar into my war file WEB-INF/lib directory.

Does anybody know if there is a newer jar than spring-web-2.0-m2.jar that contains org.springframework.web.context.ContextLoaderListener? I used buy it shows like twenty jar files that contain the class. There is now way to tell which of the listed jar files is the most recent.

Thank you very much for any information.

6 years ago
Here's some more information

I am using RESTClient 3.0

I issue the following GET request through RESTClient 3.0

The java console shows

Oct 03, 2012 8:40:02 AM com.noelios.restlet.LogFilter afterHandle
INFO: 2012-10-03 08:40:02 - - 8182 GET /users/1 - 200 0 - 16 Apache-HttpClient/4.2.1 (java 1.5)

The RESTClient output shows

Oct 03, 2012 8:40:03 AM org.wiztools.restclient.HTTPClientRequestExecuter execut
WARNING: Content-Type header not available in response. Using platform default e
ncoding: windows-1252

The RESTClient 3.0 GUI reports

Content-Length 0
Date: (a date value of the request)
Accept-Ranges bytes
Server Noelios-Restlet-Engine/1.1.10
Connection close
6 years ago
Restlet Code

public static void main(String[] args) {

Component component = new Component();
component.getServers().add(Protocol.HTTP, 8182);

Context ctx = component.getContext();
final Context childCtx = ctx.createChildContext();
Application application = new Application(childCtx) {
public Restlet createRoot() {
// Create a root router
Router router = new Router(childCtx);

public void handle(Request request, Response response) {
// Print the user name of the requested orders
String message = "Orders of user \""
+ request.getAttributes().get("users") + "\"";
response.setEntity(message, MediaType.TEXT_PLAIN);

router.attach("/users/{user}", account);
router.attach("/object/", TestServerResource.class);

return router;



When I use the GUI test tool and submit a GET request the console logs the fact that a request was received but no data is returned. A breakpoint in the handle() method is never hit. The TestServerResource class is never accessed either. I copied this example from the Restlet user guide. I feel like I have entered everything correctly but things just aren't working. Is there an important step that I have missed?

thank you
6 years ago
thanks for your input

// here's where I saw the note saying that there is now way to escape 0x14

OK, I really messed up my earlier source code example. Let me try again.

String encryptedValue = new BASE64Encoder().encode(valueToEncrypt.getBytes());

Sending this string does not cause a problem and it does not contain any 0x14 characters.

String something = "medium length XML string, plain vanilla characters";
Key secretKey = generateKey(something.getBytes());
Cipher c = Cipher.getInstance(ALGORITHM);
c.init(Cipher.ENCRYPT_MODE, secretKey);
byte[] encValue = c.doFinal(valueToEncrypt.getBytes());
String encryptedValue = new BASE64Encoder().encode(encValue);

This encryptedValue String causes an XMLStreamException. Before I send the String I examine every character and I do not find any 0x14 characters. Somehow a 0x14 character is getting added to the stream. Here's the error message

[ ParseError at [row,col]:[7,57]
Message: An invalid XML character (Unicode: 0x14) was found in the element content of the document.]

The thing is I have no way of figuring out [row,col]:[7,57]. There are no newLine characters in the stream to account for 7 rows.

Do you have any idea how to use [row,col]:[7,57] to find the actual character? Thanks very much.
6 years ago

>>>> I suspect the reason it fails in your second example is because the character 0x14 is not encoded. This is not a character supported by XML so must be escaped or encoded.

I read that encoded or escaping the 0x14 character is not going to work. It's still not going to like it.

My problem has evolved to an even stranger level. When I Base64 encode a String and send it to the web service there are no problems. There is no 0x14 character within the String. When I use AES to encrypt a String it fails when it is sent to the web service due to a 0x14 character in the stream. The thing is I check every character in the problem String before it is sent and I don't find any 0x14 characters. I don't know how the problem character is getting into the stream. javax.xml.bind.UnmarshalException
- with linked exception:
[ ParseError at [row,col]:[7,49]
Message: An invalid XML character (Unicode: 0x14) was found in the element conte
nt of the document.]
wn Source)
6 years ago