Nura Horne

Ranch Hand
+ Follow
since Jul 26, 2001
Merit badge: grant badges
For More
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 Nura Horne

Hi All,

I am preparing to take my SCEA exam. If I remember correctly from previous Sun Certifications, the exam software tells you how many responses are expected for a given question. For example, "Which of the following are desirable characteristics of an architecture (choose 3)".

Can anyone tell me if this is the case for SCEA exam or is it up to the sitter to determine how many answers should be checker? I think this point is very relevant to how you prepare for the exam.

Kind regards,
Hello,

I am having trouble getting JBoss to create primary keys with the UUIDKeyGeneratorFactory (I tried with MySQL generate keys with no luck also). I get the following exception when I try to create a new Share bean:

javax.ejb.CreateException: Could not create entity:java.sql.SQLException: Column 'id' cannot be null at org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractCreateCommand.performInsert(JDBCAbstractCreateCommand.java:327)

If I explictly call the setId() method in ejbCreate everything works fine and row is inserted in my table... any help would be much appreciated. I have included relevant files below:


ShareBean.java

package tutorial.ejb;

import java.rmi.RemoteException;
import java.util.Date;

import javax.ejb.EJBException;
import javax.ejb.EntityBean;
import javax.ejb.EntityContext;
import javax.ejb.RemoveException;

/**
* @ejb.bean name="Share"
* display-name="Name for Share"
* description="Description for Share"
* local-jndi-name = "ejb/ShareLocal"
* cmp-version="2.x"
* view-type="local"
* primkey-field="id"
* schema="shares"
*
* @jboss.persistence datasource = "java:/MySqlDS"
* @jboss.persistence datasource-mapping = "mySQL"
* @jboss.persistence create-table = "true"
* @jboss.persistence remove-table = "true"
*
* @ejb.finder query="SELECT OBJECT(o) FROM shares as o"
* signature="java.util.Collection findAll()"
*
* @jboss.unknown-pk class="String" column-name = "id" jdbc-type = "String" sql-type = "VARCHAR"
* @jboss.entity-command name="key-generator" class="org.jboss.ejb.plugins.cmp.jdbc.keygen.JDBCKeyGeneratorCreateCommand"
* @jboss.entity-command-attribute name = "key-generator-factory" value = "UUIDKeyGeneratorFactory"
*/
public abstract class ShareBean implements EntityBean {

public ShareBean() {
super();
// TODO Auto-generated constructor stub
}

public void ejbActivate() throws EJBException, RemoteException {
// TODO Auto-generated method stub

}

public void ejbLoad() throws EJBException, RemoteException {
// TODO Auto-generated method stub

}

public void ejbPassivate() throws EJBException, RemoteException {
// TODO Auto-generated method stub

}

public void ejbRemove() throws RemoveException, EJBException, RemoteException {
// TODO Auto-generated method stub

}

public void ejbStore() throws EJBException, RemoteException {
// TODO Auto-generated method stub

}

public void setEntityContext(EntityContext ctx)
throws EJBException,
RemoteException {
// TODO Auto-generated method stub

}

public void unsetEntityContext() throws EJBException, RemoteException {
// TODO Auto-generated method stub

}

/**
* Create method
* @ejb.create-method view-type = "local"
*/
public String ejbCreate(String symbol, Date date, Integer quantity, Double price, Double commission) throws javax.ejb.CreateException {
// TODO Auto-generated method stub

setSymbol(symbol);
setDate(date);
setQuantity(quantity);
setPrice(price);
setCommission(commission);

return null;
}
/**
* Post Create method
*/
public void ejbPostCreate(String symbol, Date date, Integer quantity, Double price, Double commission) throws javax.ejb.CreateException {
// TODO Auto-generated method stub

}
/**
* Getter for CMP Field id
*
* @ejb.pk-field
* @ejb.persistence column-name = "id"
* @ejb.persistent-field
* @ejb.interface-method view-type="local"
*/
public abstract String getId();

/**
* Setter for CMP Field id
*
* @ejb.interface-method view-type="local"
*/
public abstract void setId(String value);

/**
* Getter for CMP Field symbol
*
*
* @ejb.persistent-field
* @ejb.interface-method view-type="local"
*/
public abstract String getSymbol();

/**
* Setter for CMP Field symbol
*
* @ejb.interface-method view-type="local"
*/
public abstract void setSymbol(String value);

/**
* Getter for CMP Field date
*
*
* @ejb.persistent-field
* @ejb.interface-method view-type="local"
*/
public abstract java.util.Date getDate();

/**
* Setter for CMP Field date
*
* @ejb.interface-method view-type="local"
*/
public abstract void setDate(java.util.Date value);

/**
* Getter for CMP Field quantity
*
*
* @ejb.persistent-field
* @ejb.interface-method view-type="local"
*/
public abstract java.lang.Integer getQuantity();

/**
* Setter for CMP Field quantity
*
* @ejb.interface-method view-type="local"
*/
public abstract void setQuantity(java.lang.Integer value);

/**
* Getter for CMP Field price
*
*
* @ejb.persistent-field
* @ejb.interface-method view-type="local"
*/
public abstract java.lang.Double getPrice();

/**
* Setter for CMP Field price
*
* @ejb.interface-method view-type="local"
*/
public abstract void setPrice(java.lang.Double value);

/**
* Getter for CMP Field commission
*
*
* @ejb.persistent-field
* @ejb.interface-method view-type="local"
*/
public abstract java.lang.Double getCommission();

/**
* Setter for CMP Field commission
*
* @ejb.interface-method view-type="local"
*/
public abstract void setCommission(java.lang.Double value);

}





ejb-jar.xml


<?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 >

<description><![CDATA[No Description.]]></description>
<display-name>Generated by XDoclet</display-name>

<enterprise-beans>

<!-- Session Beans -->
<session >
<description><![CDATA[Description for Fibo]]></description>
<display-name>Name for Fibo</display-name>

<ejb-name>Fibo</ejb-name>

<home>tutorial.interfaces.FiboHome</home>
<remote>tutorial.interfaces.Fibo</remote>
<ejb-class>tutorial.ejb.FiboBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>

</session>

<!--
To add session beans that you have deployment descriptor info for, add
a file to your XDoclet merge directory called session-beans.xml that contains
the <session></session> markup for those beans.
-->

<!-- Entity Beans -->
<entity >
<description><![CDATA[Description for Share]]></description>
<display-name>Name for Share</display-name>

<ejb-name>Share</ejb-name>

<local-home>tutorial.interfaces.ShareLocalHome</local-home>
<local>tutorial.interfaces.ShareLocal</local>

<ejb-class>tutorial.ejb.ShareBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.String</prim-key-class>
<reentrant>False</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>shares</abstract-schema-name>
<cmp-field >
<description><![CDATA[Getter for CMP Field id]]></description>
<field-name>id</field-name>
</cmp-field>
<cmp-field >
<description><![CDATA[Getter for CMP Field symbol]]></description>
<field-name>symbol</field-name>
</cmp-field>
<cmp-field >
<description><![CDATA[Getter for CMP Field date]]></description>
<field-name>date</field-name>
</cmp-field>
<cmp-field >
<description><![CDATA[Getter for CMP Field quantity]]></description>
<field-name>quantity</field-name>
</cmp-field>
<cmp-field >
<description><![CDATA[Getter for CMP Field price]]></description>
<field-name>price</field-name>
</cmp-field>
<cmp-field >
<description><![CDATA[Getter for CMP Field commission]]></description>
<field-name>commission</field-name>
</cmp-field>
<primkey-field>id</primkey-field>

<query>
<query-method>
<method-name>findAll</method-name>
<method-params>
</method-params>
</query-method>
<ejb-ql><![CDATA[SELECT OBJECT(o) FROM shares as o]]></ejb-ql>
</query>
<!-- Write a file named ejb-finders-ShareBean.xml if you want to define extra finders. -->
</entity>

<!--
To add entity beans that you have deployment descriptor info for, add
a file to your XDoclet merge directory called entity-beans.xml that contains
the <entity></entity> markup for those beans.
-->

<!-- Message Driven Beans -->
<!--
To add message driven beans that you have deployment descriptor info for, add
a file to your XDoclet merge directory called message-driven-beans.xml that contains
the <message-driven></message-driven> markup for those beans.
-->

</enterprise-beans>

<!-- Relationships -->

<!-- Assembly Descriptor -->
<assembly-descriptor >
<!--
To add additional assembly descriptor info here, add a file to your
XDoclet merge directory called assembly-descriptor.xml that contains
the <assembly-descriptor></assembly-descriptor> markup.
-->

<!-- finder permissions -->

<!-- finder permissions -->

<!-- transactions -->

<!-- finder transactions -->
</assembly-descriptor>

</ejb-jar>




jbosscmp-jdbc.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jbosscmp-jdbc PUBLIC "-//JBoss//DTD JBOSSCMP-JDBC 4.0//EN" "http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_4_0.dtd">

<jbosscmp-jdbc>
<defaults>
</defaults>

<enterprise-beans>

<!--
To add beans that you have deployment descriptor info for, add
a file to your XDoclet merge directory called jbosscmp-jdbc-beans.xml
that contains the <entity></entity> markup for those beans.
-->

<entity>
<ejb-name>Share</ejb-name>
<datasource>java:/MySqlDS</datasource>
<datasource-mapping>mySQL</datasource-mapping>
<create-table>true</create-table>
<remove-table>true</remove-table>

<cmp-field>
<field-name>id</field-name>
<column-name>id</column-name>

</cmp-field>
<cmp-field>
<field-name>symbol</field-name>

</cmp-field>
<cmp-field>
<field-name>date</field-name>

</cmp-field>
<cmp-field>
<field-name>quantity</field-name>

</cmp-field>
<cmp-field>
<field-name>price</field-name>

</cmp-field>
<cmp-field>
<field-name>commission</field-name>

</cmp-field>

<unknown-pk>
<unknown-pk-class>String</unknown-pk-class>
<column-name>id</column-name>
<jdbc-type>String</jdbc-type>
<sql-type>VARCHAR</sql-type>
</unknown-pk>
<entity-command name="key-generator" class="org.jboss.ejb.plugins.cmp.jdbc.keygen.JDBCKeyGeneratorCreateCommand">
<attribute name="key-generator-factory">UUIDKeyGeneratorFactory</attribute>
</entity-command>
<!-- jboss 3.2 features -->
<!-- optimistic locking does not express the exclusions needed -->
</entity>

</enterprise-beans>

</jbosscmp-jdbc>
18 years ago
Hi,
I am getting a "FileNotFound configs/security.properties" when I run the AdviceClient from HeadFirst EJB.
Has anyone else experienced this? I am on WinXP, JDK1.4, J2EE1.3.1 and am starting the J2EE RI from the projects/advice directory.
Any ideas?
Thanks
Arun
Hi,
I am trying to get the first example (Advice Bean) in the "Headfirst EJB" book up and running. I have created the Java classes as per the book, compiled them and deployed them fine.
Does it matter which directory I start the J2EE RI server from? I notice Cloudscape is putting log files in the directory I start the server from yet logs are placed in C:\j2sdkee1.3.1\logs (i.e. centralised).
With the server running and the deploytool reporting everything is ok (and all the instructions followed and double checked in the book), I run the test client which accesses the bean and prints out a random string generated by it (its a very simple bean!). The client code is again as per the book.
Running the client is producing a FileNotFoundException saying can't find C:\HeadfirstEJB\projects\advice\configs\security.properties. As you probably can guess C:\HeadfirstEJB\projects\advice\ is the working directory for my project and also where deploytool was instructed to store the AdviceApp.ear file and also the generated client jar AdviceAppClient.jar (again as per the book).
Needless to say, this directory does not contain configs\security.properties and nor do I think it should. I note that C:\j2sdkee1.3.1 contains a configs\security.properties file and I think the client is looking in the wrong place.
I had a hunch it might be something to do with the InitialContext object, but I really don't know - can anyone help me out to get this (simple) example working please?
Many thanks
Arun
Hi, I am writing a script that polls a data source and just prints some status information from it to the console. Over time the data in the data source will change and I want to update the console accordingly. Updates will be every 10 secs or so. However, I don't want to just keep printing the info with System.out.println as this is ugly and hard for the user to keep tabs on. I want to clear the console and output the info giving the illusion of the screen being updated so all the user sees is the value changing in the output. Is there any way I can do this in Java? Also is it possible to use formatting codes to the console in Java, i.e. to change the colour/boldness of certain characters in the output?
Thanks in advance
Arun
20 years ago
Hi All,
This question is two fold:
1.
I have a servlet that accesses a database and thus under certain conditions an exception can occur. When such an exception occurs I would like to redirect to display an error page and then terminate the servlet... are there any special techniques for doing this or should I just write appropriate html tags/text to HttpResponse and "return"?
2.
Assuming an exception is not generated a query can take a long time. As such I would like to display a page telling the user the the calculation is in progress that remains visible from the moment the query form is submitted until the calculation is complete and the results are ready to be sent to the client. The query results are actually an SVG file (mime:
image/svg+xml). The structure of the calls through the system are:
HTML query from --> [form data] --> QueryServlet --> Results
Is there some way I can display a working page and then when the QueryServlet is ready to send the results to the client, remove this page and begin sending the results?
Thanks in advance,
Arun
20 years ago
Hi All,
I have set up a simple web app as follows according to the Tomcat Developer's guide.
.
|-- build.properties
|-- build.xml
|-- docs
|-- src
| `-- Hello.java
`-- web
|-- WEB-INF
| `-- web.xml
`-- index.html
I can compile it fine using the command 'ant' to execute the build.xml script (from the Developer's guide with necessary changes for usernames etc). I can also install it fine with the command 'ant install' and the output says everything is fine.
I go to the manager app and my application (context /aranea is shown, but is stopped). So I check the logs and I see the following errors:

Why is this...? I can provide any relevant configuration files if they would be helpful?
Thanks in advance,
Arun
(edited by Cindy to wrap lines that are too long)
[ March 19, 2003: Message edited by: Cindy Glass ]
20 years ago
Hi all,
I need to write a type 4 jdbc driver. The data source is a specially formatted scientific text file, but I think this is unimportant. What I would like to know is where I can find information on how to go about doing such a thing. I have found articles on writing type 3 drivers on javaworld.com but no type 4.
Thanks in advance. Arun
Hi,
I want to load a GIF and then extract part of it, say only the area (x,y,w,h) as an Image object. Then I can display only this part of the Image into a Graphics context for displaying. Anyone know how I can do this?
Regards,
Arun
22 years ago
Hi I'm looking to make a custom border... but only on one side of the rectangle. Basically what I want to do is change the appearance of the line that appears under a JMenuBar... anyone know how?
If I set the border of the JMenuBar to Etched (the style I want) it totally encloses the menu bar, I want it only on the South (bottom) side of the menu bar as for the default appearance. Anyone know how I can do this, either with a Border (preferably) or otherwise.
Also does anyone know how to adjust the width of the bevel on a RaisedBevel border?
Rgds, A
22 years ago
You can create instances of any swing component u like and add it to the panel, and then draw some grpahics onto the panel as well. However the fact that you want to do this suggests that you may want two panels, one for drawing, one for components, but it depends on how yu want th egui of your app. Just ensure you call the paint method of the panel to make the components get painted before you do any graphics:
<code>
public void paint(Graphics g)
{
super.paint();
// now do drawing here
}
</code>
22 years ago
Suggest you start with the online sun java tutorial at java.sun.com in the docs section.
it'll save u shelling out on a book, but is also the best swing (among other things) reference I have found to date.
Rgs, A
22 years ago
Yup, I lloked through it also and it has no errors in it that will be detrimental to programming more sophisticated works.
Good luck, A
22 years ago
As far a s I know it doesn't matter where your methods are defined in Java code so the fact that it is after main does not matter.
22 years ago