Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes JBoss/WildFly and the fly likes JBOSS EntityBean CMP with MySQL Help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Reply locked New topic

JBOSS EntityBean CMP with MySQL Help

muthulingam Jayakanthan
Ranch Hand

Joined: Feb 27, 2005
Posts: 43
I have setup JBoss-IDE with Eclipse with Jboss. The Jboss Version I use jboss-4.0.2RC1.

1. I have configured MySQL version 5.0.21 to Jboss. and I followed the URL
to configure the database with JBoss.

2. I made a small table with MySQL

CREATE TABLE `fortunedb`.`test` (
`id` varchar(10) NOT NULL,
`name` varchar(45) NOT NULL,

3. I made a simple Entity Bean Call Test bean to connect to the test table as follow


<![CDATA[Description for Test]]>
<display-name>Name for Test</display-name>




<cmp-field >
<cmp-field >









4. I am running a Servlet Client to get the connection

public void init(ServletConfig config) throws ServletException {
try {
Context context = new InitialContext();
Object ref = context.lookup("java:comp/env/ejb/Test");
home = (TestHome) PortableRemoteObject.narrow(ref, TestHome.class);
} catch (Exception e) {
throw new ServletException("Lookup of java:/comp/env/ failed" + e);

protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException,
IOException {

PrintWriter out=resp.getWriter();

try {

Test bean = home.findByPrimaryKey("jk");
} catch (Exception e) {

5. But when I run this Servlet it gives me the following error

"javax.ejb.FinderException: Find failed: java.sql.SQLException: Syntax error or access violation message from server: "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM test t0_Test WHERE' at line 1""

Please help me to go further on this. I am totally stuck here and I coukld not realise where I made the mistake.
sam jadhav

Joined: Jan 12, 2009
Posts: 5
Same problem with me too
Peter Johnson

Joined: May 14, 2008
Posts: 5852

Sam, please do not resurrect 3 year old posts, but instead [url=]tell the details[/url] in a new post. For example, do you really have a table called 'fortunedb' located in database 'test'? (That is a horrible table name, by the way, and I would never put anything into the 'test' database.)

JBoss In Action
I agree. Here's the link:
subject: JBOSS EntityBean CMP with MySQL Help
jQuery in Action, 3rd edition