Michael Daines

Greenhorn
+ Follow
since Oct 29, 2002
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Michael Daines

Sorry if this is a bit long, but I wasn't sure what to exclude.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN' 'http://java.sun.com/dtd/ejb-jar_2_0.dtd'>
<ejb-jar>
<display-name>CabinEJB</display-name>
<enterprise-beans>
<entity>
<display-name>CabinEJB</display-name>
<ejb-name>CabinEJB</ejb-name>
<home>com.daines.titan.cabin.CabinHome</home>
<remote>com.daines.titan.cabin.Cabin</remote>
<ejb-class>com.daines.titan.cabin.CabinBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.Integer</prim-key-class>
<reentrant>False</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>Cabin</abstract-schema-name>
<cmp-field>
<description>no description</description>
<field-name>bedCount</field-name>
</cmp-field>
<cmp-field>
<description>no description</description>
<field-name>shipID</field-name>
</cmp-field>
<cmp-field>
<description>no description</description>
<field-name>cabinName</field-name>
</cmp-field>
<cmp-field>
<description>no description</description>
<field-name>deckLevel</field-name>
</cmp-field>
<cmp-field>
<description>no description</description>
<field-name>cabinID</field-name>
</cmp-field>
<primkey-field>cabinID</primkey-field>
<security-identity>
<description></description>
<use-caller-identity></use-caller-identity>
</security-identity>
</entity>
</enterprise-beans>
<assembly-descriptor>
<method-permission>
<unchecked />
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Remote</method-intf>
<method-name>setBedCount</method-name>
<method-params>
<method-param>int</method-param>
</method-params>
</method>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Remote</method-intf>
<method-name>getShipID</method-name>
<method-params />
</method>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Home</method-intf>
<method-name>findByPrimaryKey</method-name>
<method-params>
<method-param>java.lang.Integer</method-param>
</method-params>
</method>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Remote</method-intf>
<method-name>getHandle</method-name>
<method-params />
</method>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Remote</method-intf>
<method-name>setShipID</method-name>
<method-params>
<method-param>int</method-param>
</method-params>
</method>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Remote</method-intf>
<method-name>getPrimaryKey</method-name>
<method-params />
</method>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Home</method-intf>
<method-name>getEJBMetaData</method-name>
<method-params />
</method>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Remote</method-intf>
<method-name>remove</method-name>
<method-params />
</method>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Remote</method-intf>
<method-name>setDeckLevel</method-name>
<method-params>
<method-param>int</method-param>
</method-params>
</method>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Home</method-intf>
<method-name>remove</method-name>
<method-params>
<method-param>javax.ejb.Handle</method-param>
</method-params>
</method>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Home</method-intf>
<method-name>getHomeHandle</method-name>
<method-params />
</method>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Remote</method-intf>
<method-name>setCabinID</method-name>
<method-params>
<method-param>java.lang.Integer</method-param>
</method-params>
</method>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Remote</method-intf>
<method-name>setCabinName</method-name>
<method-params>
<method-param>java.lang.String</method-param>
</method-params>
</method>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Remote</method-intf>
<method-name>isIdentical</method-name>
<method-params>
<method-param>javax.ejb.EJBObject</method-param>
</method-params>
</method>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Home</method-intf>
<method-name>create</method-name>
<method-params>
<method-param>java.lang.Integer</method-param>
</method-params>
</method>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Home</method-intf>
<method-name>remove</method-name>
<method-params>
<method-param>java.lang.Object</method-param>
</method-params>
</method>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Remote</method-intf>
<method-name>getDeckLevel</method-name>
<method-params />
</method>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Remote</method-intf>
<method-name>getBedCount</method-name>
<method-params />
</method>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Remote</method-intf>
<method-name>getCabinName</method-name>
<method-params />
</method>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Remote</method-intf>
<method-name>getCabinID</method-name>
<method-params />
</method>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Remote</method-intf>
<method-name>getEJBHome</method-name>
<method-params />
</method>
</method-permission>
<container-transaction>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Remote</method-intf>
<method-name>setShipID</method-name>
<method-params>
<method-param>int</method-param>
</method-params>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
<container-transaction>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Remote</method-intf>
<method-name>setDeckLevel</method-name>
<method-params>
<method-param>int</method-param>
</method-params>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
<container-transaction>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Remote</method-intf>
<method-name>getCabinID</method-name>
<method-params />
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
<container-transaction>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Remote</method-intf>
<method-name>setCabinID</method-name>
<method-params>
<method-param>java.lang.Integer</method-param>
</method-params>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
<container-transaction>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Remote</method-intf>
<method-name>getDeckLevel</method-name>
<method-params />
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
<container-transaction>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Remote</method-intf>
<method-name>getCabinName</method-name>
<method-params />
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
<container-transaction>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Remote</method-intf>
<method-name>getShipID</method-name>
<method-params />
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
<container-transaction>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Remote</method-intf>
<method-name>remove</method-name>
<method-params />
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
<container-transaction>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Remote</method-intf>
<method-name>setCabinName</method-name>
<method-params>
<method-param>java.lang.String</method-param>
</method-params>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
<container-transaction>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Remote</method-intf>
<method-name>setBedCount</method-name>
<method-params>
<method-param>int</method-param>
</method-params>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
<container-transaction>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Remote</method-intf>
<method-name>getBedCount</method-name>
<method-params />
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>
First, here's my environment: MS WindowsXP - Home, JDK 1.4.1_03, J2EE 1.3.1. I'm using the reference implementation for my work here.
I am trying to deploy several CMP beans. To date, I've only been able to deploy one stateless session bean, to give you an idea of my experience (yes, this is for a class). This problem happens to me even with the downloaded examples from the O'Reilly Enterprise JavaBeans book, following their example.
When I try to verify the beans, the last step before deployment, I get the following results from the verifier:
Test Name : tests.ejb.entity.TransactionDemarcationHomeInterface
Result : FAILED
Details :
For [CabinEJB]
Error: Transaction attributes must be specified for the methods defined in the home interface [com.daines.titan.cabin.CabinHome]. Method [create] has no transaction attribute defined within this bean [CabinEJB].
?!?!?!?
Now, my interpretation of this is that I've not implemented a create() method. In my xxxHome interface, I have the create() method, and in xxxBean I have a corresponding ejbCreate() method with the same parameters.
I can post my code if necessary, but I have the sinking feeling that this is some sort of environment or set-up issue, and not a problem with the code. If anyone can give me some insight into what the problem is and how to solve it, it would be much appreciated.
Thanx,
msd
I've looked around and not seen any code that seems to cover this. I've tried to figure it out myself, but just cannot get my head around it.
Basically, I have an application where I would like to have the DB log output written to a JTextArea (or other similar component is OK). My first assumption is to use the getLogWriter() method of DriverManager, but then I cannot figure out what to do with it. I'm sure that I'll have to programatically dump to the JTextArea on my own, but how? Or, am I barking up the wrong tree? The name "LogWriter" makes me think that it is only for me sending messages in!?! I want to get the DB's messages, not my own.
Any direction or guidance will be much appreciated.
Thanx,
msd
I've been fiddling with this for a couple days now, and just don't seem to get it to work. I have a client and a server that seem to do everything else right, and when I telnet into the server, it works as expected. But when I use the client, it goes nowhere. I've tried a number of different ways of approaching the problem, but they all produce an incorrect outcome (including a couple where one of the them loops continuously with empty data). The server spawns a thread to deal with each client. At this point, with the code below, the client sends the "START", but it is never received by the server... i.e. it is never going in to the "while ( inputLine )" loop.
Here is what I see as the relevant snippet from the server:
clientThere = true;
while ( clientThere ) {
System.err.println( "## Client is there. Trying to read from in." );
try {
while ( ( inputLine = in.readLine() ) != null ) {
System.err.println( "## in has been read: " + inputLine );
token = new StringTokenizer( inputLine.toUpperCase(), " " );
command = token.nextToken();

// If the message is "START", send a "+COMMAND" to the client
if ( command.equals( "START" ) ) {
System.err.println( "## Received: START" );
out.println( "+COMMAND " );
}
// If "BYE", send "+BYE"
else if ( command.equals( "BYE" ) ) {
System.err.println( "## Received: BYE" );
out.println( "+BYE" );
clientThere = false;
try {
mySocket.close();
} catch ( IOException e ) {
System.err.println( "IOException while closing connection: " + e );
}
}
// If "STOCK", call the getQuote() method to get stock data and send to client
else if ( command.equals( "STOCK" ) ) {
System.err.println( "## Received: STOCK" );
try {
stock = token.nextToken();
out.println( getQuote( stock ) );
} catch ( NoSuchElementException e ) {
// If the STOCK command doesn't have a stock-id, send "+ERROR: Malformed command."
out.println( "+ERROR: Malformed command." );
}
}
// Otherwise, send "+ERROR: Command not understood."
else {
System.err.println( "## Received other: " + command );
out.println( "+ERROR: Command not understood." );
}
}
} catch ( IOException e ) {
System.err.println( "Connection closed to client." );
} catch ( NoSuchElementException nsee ) {
}
}

And here is a snippet from the client:
//After receiving "+HELLO" from server...
out.println( "START" );
// Control then returns to main(), which calls upon the following code...
keyIn = new BufferedReader( new InputStreamReader( System.in ) );
// Within a loop, first read messages from the server and respond to those
// messages as described in the requirements, then read from the keyboard,
// sending the server whatever is typed by the user
while ( active ) {
try {
while ( ( serverCommand = in.readLine() ) != null ) { // Potential NullPointerException here, depending on rest of code, not currently happening.
if ( serverCommand.startsWith( "+BYE" ) ) {
System.out.println( serverCommand );
active = false;
} else if ( serverCommand.startsWith( "+COMMAND" ) ) {
System.out.print( serverCommand );
} else if ( serverCommand.startsWith( "+" ) ) {
System.out.println( serverCommand );
out.println( "START" );
} else {
System.err.println( "Something seriously fucked up happened!" );
out.println( "START" );
}
}
out.println( keyIn.readLine() );
} catch ( IOException e ) {
System.err.println( "IOException when reading from Server: " + e );
} catch ( NullPointerException npe ) {}
}

If someone can point out to me the error of my ways, I'm sure it will be a pleasant alternative to shooting myself or someone else. Part of the requirement for this class project is that we use the while ( inputLine ) loop, but even when I tried to pull this out it doesn't work correctly.
Thanx,
msd
22 years ago