• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

BMP, Jboss, and mysql configuring

 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello in there,
i'm trying one BMP like following:


1. "mm.mysql-2.0.8-bin.jar" ---> jboss-3.2.5\server\default\lib\
2. "mysql-ds.xml" ---> jboss-3.2.5\server\default\deploy
3. my .jar ---> jboss-3.2.5\server\default\deploy
4. mysql "winmysqladmin" running



when i run this jboss show my jar file loaded correctly

set JAVA_HOM
set JBOSS_HOM
....................
copy jar --> jboss-3.2.5\server\default\lib\
....................
cd \
cd C:\mysql\bin\
C:\mysql\bin\mysql
pause


everything goes smoothly until i run client application, i'm getting this error:

javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory]

what all these are anyway, i mean, do i need something i haven't done yet?
do i need to copy sql files somewhere in my jar?
what else i can do? anything?

i appreciated anyone reply me soon so on ...
very thankyou
 
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You need to do two things. First, you need to place the MySQL Driver Jar file on the application server's class path. You can do this by editing the script you use to launch the application server (usually run.sh or run.bat, depending on the platform) - this is what I usually do - or you can copy the Jar file to the server's lib directory (JBOSS_HOME/server/default/lib) - I think that's the correct place.

You will need to restart the application server for it to pick up this new driver.

Second, you will need to deploy the datasource xml file. This is the mysql-ds-xml file you mentioned in your original post. This file should be copied to your server's deploy directory (JBOSS_HOME/server/default/deploy).

That's all there is to it.
 
A. S. Georgie
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mark E Hansen wrote:You need to do two things. First, you need to place the MySQL Driver Jar file on the application server's class path. You can do this by editing the script you use to launch the application server (usually run.sh or run.bat, depending on the platform) - this is what I usually do - or you can copy the Jar file to the server's lib directory (JBOSS_HOME/server/default/lib) - I think that's the correct place.

You will need to restart the application server for it to pick up this new driver.

Second, you will need to deploy the datasource xml file. This is the mysql-ds-xml file you mentioned in your original post. This file should be copied to your server's deploy directory (JBOSS_HOME/server/default/deploy).

That's all there is to it.




with client application i have this error:
javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory]
 
Mark E Hansen
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry about that. When I first read your message, I thought you were having problems deploying the MySQL JDBC drivers. I don't know how I got so far off track.

Hopefully, someone else can answer your Initial Naming Context question.

Best Regards,
 
A. S. Georgie
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mark E Hansen wrote:Sorry about that. When I first read your message, I thought you were having problems deploying the MySQL JDBC drivers. I don't know how I got so far off track.

Hopefully, someone else can answer your Initial Naming Context question.

Best Regards,



first of all, don' mention it, you did very, merry Christmas ...
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

A. S. Georgie wrote:
everything goes smoothly until i run client application, i'm getting this error:

javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory]



Your client (which i believe is a standalone application) classpath, will have to point to JBOSS_HOME/client/jbossall-client.jar
 
A. S. Georgie
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jaikiran Pai wrote:

A. S. Georgie wrote:
everything goes smoothly until i run client application, i'm getting this error:

javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory]



Your client (which i believe is a standalone application) classpath, will have to point to JBOSS_HOME/client/jbossall-client.jar



well, actually i couldn't understand how to point to this JBOSS_HOME/client/jbossall-client.jar but i've made a executable jar that holds all the things your are mentioned, i mean, i unjared JBOSS_HOME/client/jbossall-client.jar first, then i put all these plus my standalone main(...) in, now i have all these things done, things to utterly say is: jboss 3.2.5 is running, my BMP jar loaded bafore, and through bat made this mysql run, i mean both mysql.exe, winmysqladmin. and when i run my client application now i have no error anywhere, but when i check my database to see changes nothing, it's and you see no change at all, also because i'm stupidly new to this technology and more goes to mysql, i need to utter that, when i making a database i have a folder in \mysql\data and three file in, and my deployment descriptor is something like this around this db:
..............
<env-entry>
<env-entry-name>dbUrl</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>jdbc:mysql://localhost/mysql folder name or what?</env-entry-value>
</env-entry>
............

i'm stupidly waiting for your remedy, but first thank you for reply, and merry Christmas ...
 
Mark E Hansen
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your mysql connection-url should look like this:



The port used by MySQL by default is 3306. The server-host should be the name of the host machine on which the database server is running, and database-name is the name of the database you want to use.

When you installed MySQL, did you create a database? If so, that is the database you want to specify.

If you haven't created a database yet (or added users, etc.), then you'll need to do all that. See the MySQL documentation for details: http://dev.mysql.com/doc/refman/5.1/en/index.html

Now, as far as the client application goes, can you please tell us what it is? Have you written a stand-alone Java application which you want to access the MySQL database, or is this a J2EE application of some sort?

 
A. S. Georgie
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mark E Hansen wrote:
Your mysql connection-url should look like this:



Well actually, my ejb-jar.xml, I ha made it like this :
..........................
<reentrant>false</reentrant>
<env-entry>
<env-entry-name>dbUrl</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>jdbc:mysql://localhost/TITINE</env-entry-value>
</env-entry>
................

now I changed it the way you’re saying:
.............
<env-entry-value>jdbc:mysql://localhost:3306/TITINE</env-entry-value>
................


Mark E Hansen wrote:
Now, as far as the client application goes, can you please tell us what it is? Have you written a stand-alone Java application which you want to access the MySQL database, or is this a J2EE application of some sort?



Oky, course it’ like this: lik all BMP I have a inherent component, considering ‘Product’:
1. Product
2. ProductHome
3. ProductBean
4. ProductPK

on the other hand, the client standalone is like:

import BMPEBean.Product;
import BMPEBean.ProductHome;
import BMPEBean.ProductBean;

import javax.naming.*;
import javax.rmi.PortableRemoteObject;
import java.util.Properties;
import java.util.Enumeration;

public class Client {

public static void main(String[] args) {
Properties properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
properties.put(Context.PROVIDER_URL, "localhost:1099");

try {
InitialContext jndiContext = new InitialContext(properties);

Object ref = jndiContext.lookup("BMPProduct");

ProductHome home = (ProductHome) PortableRemoteObject.narrow (ref, ProductHome.class);

home.create(1, "Product1", "Color1", 1.0);
Product product = home.create(2, "Product2", "Color2", 2.0);
product.remove();

Enumeration enum = home.findByName("Product1");
while (enum.hasMoreElements()) {
product = (Product) enum.nextElement();
System.out.println("Id: " + product.getProductId());
System.out.println("P. Name: " + product.getProductName());
System.out.println("Color: " + product.getDescription());
System.out.println("Price: " + product.getPrice());
}

}
catch(Exception e) {
}
}
}

everything go nicely but when I Execute, I mean I compile the client and it goes smoothly, like im’ saying compile is like this:

Output - Compiler
Command completed. No files needed to be created, changed, or deleted
Finished Client.

but see execute thing says:
Client - I/O
javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory]

at last, I really do think least to emphasize my situation and how it is, I mean, copied all filled needed too, I mean:
1. ‘j2ee-1.4.jar’, ‘javax.ejb.jar’, ‘jbossall-client.jar’ say, all the files in “\jboss-3.2.5\client” to C:\j2sdk1.4.2_05\lib
2. ‘mysql-ds.xml’ to “\jboss-3.2.5\server\default\deploy”
3. ‘mm.mysql-2.0.8-bin.jar’ to “\jboss-3.2.5\server\default\lib”

as I depicted, jboss running, and I copied Product.jar in, you see jboss show it safe and sound, also mysql running too, an’ need to utter that my bat for this part is like the following:
cd \
cd C:\mysql\bin\
C:\mysql\bin\winmysqladmin
C:\mysql\bin\mysql

means that with ‘Product.jar’ there mysql is running too, now, what else I can do to have this tango play , much much more appreciation
 
A. S. Georgie
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

A. S. Georgie wrote:

Mark E Hansen wrote:
Your mysql connection-url should look like this:



Well actually, my ejb-jar.xml, I ha made it like this :
..........................
<reentrant>false</reentrant>
<env-entry>
<env-entry-name>dbUrl</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>jdbc:mysql://localhost/TITINE</env-entry-value>
</env-entry>
................

now I changed it the way you’re saying:
.............
<env-entry-value>jdbc:mysql://localhost:3306/TITINE</env-entry-value>
................


Mark E Hansen wrote:
Now, as far as the client application goes, can you please tell us what it is? Have you written a stand-alone Java application which you want to access the MySQL database, or is this a J2EE application of some sort?



Oky, course it’ like this: lik all BMP I have a inherent component, considering ‘Product’:
1. Product
2. ProductHome
3. ProductBean
4. ProductPK

on the other hand, the client standalone is like:

import BMPEBean.Product;
import BMPEBean.ProductHome;
import BMPEBean.ProductBean;

import javax.naming.*;
import javax.rmi.PortableRemoteObject;
import java.util.Properties;
import java.util.Enumeration;

public class Client {

public static void main(String[] args) {
Properties properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
properties.put(Context.PROVIDER_URL, "localhost:1099");

try {
InitialContext jndiContext = new InitialContext(properties);

Object ref = jndiContext.lookup("BMPProduct");

ProductHome home = (ProductHome) PortableRemoteObject.narrow (ref, ProductHome.class);

home.create(1, "Product1", "Color1", 1.0);
Product product = home.create(2, "Product2", "Color2", 2.0);
product.remove();

Enumeration enum = home.findByName("Product1");
while (enum.hasMoreElements()) {
product = (Product) enum.nextElement();
System.out.println("Id: " + product.getProductId());
System.out.println("P. Name: " + product.getProductName());
System.out.println("Color: " + product.getDescription());
System.out.println("Price: " + product.getPrice());
}

}
catch(Exception e) {
}
}
}

everything go nicely but when I Execute, I mean I compile the client and it goes smoothly, like im’ saying compile is like this:

Output - Compiler
Command completed. No files needed to be created, changed, or deleted
Finished Client.

but see execute thing says:
Client - I/O
javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory]

at last, I really do think least to emphasize my situation and how it is, I mean, copied all filled needed too, I mean:
1. ‘j2ee-1.4.jar’, ‘javax.ejb.jar’, ‘jbossall-client.jar’ say, all the files in “\jboss-3.2.5\client” to C:\j2sdk1.4.2_05\lib
2. ‘mysql-ds.xml’ to “\jboss-3.2.5\server\default\deploy”
3. ‘mm.mysql-2.0.8-bin.jar’ to “\jboss-3.2.5\server\default\lib”

as I depicted, jboss running, and I copied Product.jar in, you see jboss show it safe and sound, also mysql running too, an’ need to utter that my bat for this part is like the following:
cd \
cd C:\mysql\bin\
C:\mysql\bin\winmysqladmin
C:\mysql\bin\mysql

means that with ‘Product.jar’ there mysql is running too, now, what else I can do to have this tango play , much much more appreciation

 
Mark E Hansen
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm afraid I may be a little out of my ability to help, so I would just like to make a couple comments and hope that someone else can also help you.

First, with regard to the database connection information, you should create the database connection deployment descriptor (the mysql-ds.xml) file, which contains the database connection url, etc., and deploy that by copying it to the server's deploy directory (which you have done). From here, you don't need to reference the database URL, as you are trying to do in your ejb-jar.xml file, where you've created an environment entry named dbUrl. However, you don't appear to be using this anywhere, so I don't think this is causing any problems. I just wanted you to know that your applications should be using the database connection deployed to the application server.

Secondly, you don't want to extract any JBoss jar files and include the individual files in your application package. Instead, you just want to include the JBoss (and possibly other) Jar files on the CLASSPATH - both when building and running. If you're building the application through the use of a Development Environment, see it's documentation for how to configure the build classpath. As for the runtime, it's still not clear to me what you're running, but it looks like a stand alone Java application. If that's the case, you need to include these additional Jar files on the classpath for the runtime using the -classpath command-line option.

Finally, with all that out of the way, the error your getting is because the runtime can't find the JBoss class org.jnp.interfaces.NamingContextFactory. This class is in JBoss' jnp-client.jar, so you need to add that Jar file to your application's classpath (via the -classpath command-line option).

To be honest, I can't tell if what you are doing is just completely wrong, or if I've just never done it that way. It may be useful for you to locate a tutorial on what you're trying to do and follow that.

Best Regards,
 
A. S. Georgie
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mark E Hansen wrote:I'm afraid I may be a little out of my ability to help, so I would just like to make a couple comments and hope that someone else can also help you.



dear Mark, from the word go, your nice reply was nice and neat, as you are emphasizing I’m gonna do the whole nine yards to get this job done, but that aside, i’m greatfully thank you, and you too ...
 
A. S. Georgie
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
actually i was working with the IDE: Sun(tm) Java(tm) Studio Enterprise 7 2004Q4 with your quote i changed this style,
now i use jdk1.6.0 and command-line. With that error gone another sets appeared

Mark E Hansen wrote:
First, with regard to the database connection information, you should create the database connection deployment descriptor (the mysql-ds.xml) file, which contains the database connection url, etc., and deploy that by copying it to the server's deploy directory (which you have done). From here, you don't need to reference the database URL, as you are trying to do in your ejb-jar.xml file, where you've created an environment entry named dbUrl. However, you don't appear to be using this anywhere, so I don't think this is causing any problems. I just wanted you to know that your applications should be using the database connection deployed to the application server.



upon your quote i changed it like following: (JBOSS_HOME\server\default\deploy\)

mysql-ds.xml --------------------------------
. . .
<datasources>
<local-tx-datasource>
<jndi-name>MySqlDS</jndi-name>
<connection-url>jdbc:mysql://mysql-hostname:3306/jbossdb</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<user-name>x</user-name>
<password>y</password>
</local-tx-datasource>
<local-tx-datasource>
<jndi-name>BMPProduct</jndi-name>
<connection-url>jdbc:mysql://localhost:3306/TITINE</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class> ???
<user-name></user-name>
<password></password>
</local-tx-datasource>
</datasources>
. . .

and after unjaring 'mm.mysql-2.0.14-you-must-unjar-me.jar' m coping the file named mm.mysql-2.0.14-bin.jar in the mm.mysql-2.0.14 folder to the JBOSS_HOME\server\default\lib,

is all right? because when i run the Client i'm having this result:

Got context
Got reference
java.rmi.ServerException: RemoteException occurred in server thread; nested exce
ption is:
java.rmi.ServerException: EJBException:; nested exception is:
javax.ejb.EJBException: null; CausedByException is:
null
Press any key to continue . . .




and JBoss says:

java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/TITINE
INFO [JkMain] Jk running ID=1 time=0/15 config=null
INFO [EjbModule] Deploying BMPProduct
INFO [EJBDeployer] Deployed: file:/D:/jboss-3.2.5/server/default/
eploy/Product.jar
INFO [STDOUT] setEntityContext
INFO [STDOUT] ejbCreate
INFO [STDOUT] java.sql.SQLException: No suitable driver found for
jdbc:mysql://localhost:3306/TITINE
ERROR [LogInterceptor] EJBException, causedBy:
java.lang.NullPointerException
at BMPEBean.ProductBean.ejbCreate(ProductBean.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcce
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.ejb.plugins.BMPPersistenceManager.createEntity(BMPPersiste
ceManager.java:189)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.cre
teEntity(CachedConnectionInterceptor.java:269)
at org.jboss.ejb.EntityContainer.createHome(EntityContainer.java:725)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl
. . .


Mark E Hansen wrote:
Secondly, you don't want to extract any JBoss jar files and include the individual files in your application package. Instead, you just want to include the JBoss (and possibly other) Jar files on the CLASSPATH - both when building and running. If you're building the application through the use of a Development Environment, see it's documentation for how to configure the build classpath. As for the runtime, it's still not clear to me what you're running, but it looks like a stand alone Java application. If that's the case, you need to include these additional Jar files on the classpath for the runtime using the -classpath command-line option.




SET CLASSPATH="...\jnp-client.jar"
JAVA_HOME\bin\java.exe -classpath "...\jbossall-client.jar;JBOSS_HOME\server\default\deploy\Product.jar;" Client


Mark E Hansen wrote:
Finally, with all that out of the way, the error your getting is because the runtime can't find the JBoss class org.jnp.interfaces.NamingContextFactory. This class is in JBoss' jnp-client.jar, so you need to add that Jar file to your application's classpath (via the -classpath command-line option).



after all i got to say, really must say that you really helped me ...

 
Mark E Hansen
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you want to have two instances of <local-tx-datasource> in the mysql-ds.xml file? You have one named MySqlDS and one named BMPProduct.
Unless you believe you need both, get rid of one of them. Keep, for example, the one named MySqlDS and any place that needs to reference a datasource should be changed to reference that name.

Note that the mysql-ds.xml datasource is for use by the components deployed to the JBoss application server, and not by your stand-alone Java client application.

and after unjaring 'mm.mysql-2.0.14-you-must-unjar-me.jar' m coping the file named mm.mysql-2.0.14-bin.jar in the mm.mysql-2.0.14 folder to the JBOSS_HOME\server\default\lib,



I'm not sure what you're doing here. It sounds like you're finding the JDBC connector Jar file and copying it to the application server's lib directory so it will be on the server's classpath. If so, this is fine. However, I'm using MySQL ConnectorJ, version 5.1.10 and it's Jar file is named mysql-connector-java-5.1.10-bin.jar - I'm not sure what you're using.

I have to wonder if the No suitable driver found error is the result of having two local-tx-datasource entries in your mysql-ds.xml file?

JAVA_HOME\bin\java.exe -classpath "...\jbossall-client.jar;JBOSS_HOME\server\default\deploy\Product.jar;" Client



Now here I'm once again confused. You're running a stand-alone Java client application by pointing to a Jar which you have deployed to the JBoss application server. If you have a stand-alone client application, don't place its files in the JBoss deploy directory. If you have a deployed entity (like a J2EE web application), don't try to run it like it was a stand-alone Java client application. Are you perhaps confusing the two?

I don't think you want to copy Product.jar to the deploy directory. Can you please explain why you think you should? Perhaps it will help me see what I am missing.

Whew... let's see where we are now?
 
A. S. Georgie
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mark E Hansen wrote:Do you want to have two instances of <local-tx-datasource> in the mysql-ds.xml file? You have one named MySqlDS and one named BMPProduct.
Unless you believe you need both, get rid of one of them. Keep, for example, the one named MySqlDS and any place that needs to reference a datasource should be changed to reference that name.



lemme see no i don't need both, because i'm really new to these concept i can't say i'm doing rightly...let me change these all, and i'll write you back ...

by stand alone application you mean a program with main(...) or some'?


i removed this one MySqlDS , from the mysql-ds.xml.
 
Mark E Hansen
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A stand-alone Java client application is one that contain main(String [] args) {...}

I'm going to take a wild guess and say that it sounds to me like you're trying to write a stand-alone Java client application that will make calls to your EJBs deployed on the JBoss application server. Does that sound right?

You would create a J2EE application which contains your EJBs, deploy the application to the JBoss application server where they would be ready to accept requests. You could then create a stand-alone Java client application to get a reference to the EJB and make calls to it. Is this what you're trying to do?

Let me ask you a couple questions:

1. Do you need the client application to talk to the database, or will it just talk to the EJB and let the EJB deal with the database?

2. Is your J2EE application already deployed and working in some other way? In other words, are the EJBs running and being accessed by some other application, like a Servlet in your J2EE application?

My own J2EE experience is rather limited, so I'm not sure how much I'm helping. Perhaps someone that sees more about what you're doing will offer some help as well?

 
A. S. Georgie
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mark E Hansen wrote:A stand-alone Java client application is one that contain main(String [] args) {...}

I'm going to take a wild guess and say that it sounds to me like you're trying to write a stand-alone Java client application that will make calls to your EJBs deployed on the JBoss application server. Does that sound right?



that's the pretty much of it...
 
A. S. Georgie
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mark E Hansen wrote:A stand-alone Java client application is one that contain main(String [] args) {...}

I'm going to take a wild guess and say that it sounds to me like you're trying to write a stand-alone Java client application that will make calls to your EJBs deployed on the JBoss application server. Does that sound right?

You would create a J2EE application which contains your EJBs, deploy the application to the JBoss application server where they would be ready to accept requests. You could then create a stand-alone Java client application to get a reference to the EJB and make calls to it. Is this what you're trying to do?



much of a muchness
 
A. S. Georgie
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mark E Hansen wrote:
1. Do you need the client application to talk to the database, or will it just talk to the EJB and let the EJB deal with the database?

yes
 
A. S. Georgie
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mark E Hansen wrote:
2. Is your J2EE application already deployed and working in some other way? In other words, are the EJBs running and being accessed by some other application, like a Servlet in your J2EE application?



Mark you're amazing, how did you get that, yes yes yes....
 
A. S. Georgie
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mark E Hansen wrote:
My own J2EE experience is rather limited, so I'm not sure how much I'm helping. Perhaps someone that sees more about what you're doing will offer some help as well?



well, actually, you know exactly what i want now, and you helped me alot, no problem pal, good luck...
 
Mark E Hansen
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So, the stand-alone Java client application will not use the datasource you've deployed to the JBoss application server. That datasource will be used by the J2EE components deployed to the server, like the EJBs, etc. The stand-alone application will create it's own connection with something like this:

 
A. S. Georgie
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, reckon this verse would make it clear, imean,
I need to have and EJB BMP having deployed in JBoss, done correctly,
and an client stand alone main(String [] args) {...},
and in one syllable saying that only ejb must deal with database,
and client via JBoss, and EJB BMP, the client application only calls Home object of the BMP,
apparently shown below, for sql operations, assuming client’ simplest version is alike:



so I don’ think this part is less clear? (simple stand-alone client that wants
have some insertion via EJB and all that stuff)

Mark E Hansen wrote:Do you want to have two instances of <local-tx-datasource>
in the mysql-ds.xml file? You have one named MySqlDS and one named BMPProduct.
Unless you believe you need both, get rid of one of them.
Keep, for example, the one named MySqlDS and any place that needs to reference a
datasource should be changed to reference that name.

Note that the mysql-ds.xml datasource is for use by the components deployed
to the JBoss application server, and not by your stand-alone Java client application.



yes you’re right, I’ll keep one that I need one bellow (mysql-ds.xml):

  • <datasources>
    <local-tx-datasource>
    <jndi-name>dbUrl</jndi-name>
    <connection-url>jdbc:mysql://localhost:3306/TITINE</connection-url>
    <driver-class>com.mysql.jdbc.Driver</driver-class>
    <user-name></user-name>
    <password></password>
    </local-tx-datasource>
    </datasources>



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

    <datasources>
    <local-tx-datasource>
    <jndi-name>dbUrl</jndi-name>
    <connection-url>jdbc:mysql://localhost:3306/TITINE</connection-url>
    <driver-class>com.mysql.jdbc.Driver</driver-class> ???
    <user-name></user-name>
    <password></password>
    </local-tx-datasource>
    </datasources>


  • Mark E Hansen wrote:I'm not sure what you're doing here.
    It sounds like you're finding the JDBC connector Jar file and copying it to the
    application server's lib directory so it will be on the server's classpath.
    If so, this is fine. However, I'm using MySQL ConnectorJ,
    version 5.1.10 and it's Jar file is named mysql-connector-java-5.1.10-bin.jar -
    I'm not sure what you're using.



    aye’m looking the JDBC connector Jar file, so you think it’s not suitable driver?
    I’ll use what you use mysql-connector-java-5.1.10-bin.jar,
    and copying it to the ‘\jboss-3.2.5\server\default\lib\’ then how is that?

    Mark E Hansen wrote:I have to wonder if the No suitable driver found error
    is the result of having two local-tx-datasource entries in your mysql-ds.xml file?



    well, yes actually, same I say with driver inside ‘mm.mysql-2.0.8-you-must-unjar-me.jar’
    (unjaring and coping ...) it’s what JBoss says, was the result of having two local-tx-datasource.

    Mark E Hansen wrote:Now here I'm once again confused.
    You're running a stand-alone Java client application by pointing to a
    Jar which you have deployed to the JBoss application server.
    If you have a stand-alone client application, don't place its files in
    the JBoss deploy directory. If you have a deployed entity
    (like a J2EE web application), don't try to run it like it was a stand-alone Java client application.
    Are you perhaps confusing the two?



    it was a mistake, one of that winding thing

    JAVA_HOME\bin\java.exe -classpath "jbossall-client.jar;jnp-client.jar;" Client

    Mark E Hansen wrote:I don't think you want to copy Product.jar to the deploy directory.
    Can you please explain why you think you should? Perhaps it will help me see what I am missing.

    So, the stand-alone Java client application will not use the datasource
    you've deployed to the JBoss application server. That datasource will be used by the
    J2EE components deployed to the server, like the EJBs, etc.
    The stand-alone application will create it's own connection with something like this:



    thank you, not now I needed this to know, but you hatched this up,
    but now, even though i copied ‘mysql-connector-java-2.0.14.jar’ instead
    of ‘mm.mysql-2.0.8-you-must-unjar-me.jar’, and foregoing ‘sql-ds.xml’ version:
    I’m having this result with running Client application:

    JAVA_HOME\bin\java.exe -classpath "jbossall-client.jar;jnp-client.jar;" Client ------------------


  • Got context
    Got reference
    java.rmi.ServerException: RemoteException occurred in server thread; nested exce
    ption is:
    java.rmi.ServerException: EJBException:; nested exception is:
    javax.ejb.EJBException: null; CausedByException is:
    null
    Press any key to continue . . .



  • with 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>Your first EJB application </description>
    <display-name>Products Application</display-name>
    <enterprise-beans>
    <entity>
    <ejb-name>JNDIProduct</ejb-name>
    <home>BMPEBean.ProductHome</home>
    <remote>BMPEBean.Product</remote>
    <ejb-class>BMPEBean.ProductBean</ejb-class>
    <persistence-type>Bean</persistence-type>
    <prim-key-class>BMPEBean.ProductPK</prim-key-class>
    <reentrant>false</reentrant>
    <env-entry>
    <env-entry-name>dbUrl</env-entry-name>
    <env-entry-type>java.lang.String</env-entry-type>
    <env-entry-value>jdbc:mysql://localhost:3306/TITINE</env-entry-value>
    </env-entry>
    <env-entry>
    <env-entry-name>dbUserName</env-entry-name>
    <env-entry-type>java.lang.String</env-entry-type>
    <env-entry-value></env-entry-value>
    </env-entry>
    <env-entry>
    <env-entry-name>dbPassword</env-entry-name>
    <env-entry-type>java.lang.String</env-entry-type>
    <env-entry-value></env-entry-value>
    </env-entry>
    </entity>
    </enterprise-beans>
    </ejb-jar>


  • JBoss ------------------------------------------------------------------------------------------

    The system cannot find the file specified.
    =======================================================
    .
    JBoss Bootstrap Environment
    .
    JBOSS_HOME: D:\jboss-3.2.5\bin\\..
    .
    JAVA: C:\Program Files\Java\jdk1.6.0\bin\java
    .
    JAVA_OPTS: -Dprogram.name=run.bat
    .
    CLASSPATH: C:\Program Files\Java\jdk1.6.0\lib\tools.jar;D:\jboss-3.2.5\bin\\ru
    n.jar
    .
    =========================================================
    .
    06:09:20,984 INFO [Server] Starting JBoss (MX MicroKernel)...
    06:09:20,984 INFO [Server] Release ID: JBoss [WonderLand] 3.2.5 (build: CVSTag=
    JBoss_3_2_5 date=200406251954)
    06:09:20,984 INFO [Server] Home Dir: D:\jboss-3.2.5
    06:09:20,984 INFO [Server] Home URL: file:/D:/jboss-3.2.5/
    06:09:20,984 INFO [Server] Library URL: file:/D:/jboss-3.2.5/lib/
    06:09:20,984 INFO [Server] Patch URL: null
    06:09:20,984 INFO [Server] Server Name: default
    06:09:20,984 INFO [Server] Server Home Dir: D:\jboss-3.2.5\server\default
    06:09:20,984 INFO [Server] Server Home URL: file:/D:/jboss-3.2.5/server/default
    /
    06:09:20,984 INFO [Server] Server Data Dir: D:\jboss-3.2.5\server\default\data
    06:09:20,984 INFO [Server] Server Temp Dir: D:\jboss-3.2.5\server\default\tmp
    06:09:20,984 INFO [Server] Server Config URL: file:/D:/jboss-3.2.5/server/defau
    lt/conf/
    06:09:20,984 INFO [Server] Server Library URL: file:/D:/jboss-3.2.5/server/defa
    ult/lib/
    06:09:20,984 INFO [Server] Root Deployment Filename: jboss-service.xml
    06:09:20,984 INFO [Server] Starting General Purpose Architecture (GPA)...
    06:09:21,078 INFO [ServerInfo] Java version: 1.6.0,Sun Microsystems Inc.
    06:09:21,078 INFO [ServerInfo] Java VM: Java HotSpot(TM) Client VM 1.6.0-b105,S
    un Microsystems Inc.
    06:09:21,078 INFO [ServerInfo] OS-System: Windows XP 5.1,x86
    06:09:21,187 INFO [Server] Core system initialized
    06:09:22,000 INFO [Log4jService$URLWatchTimerTask] Configuring from URL: resour
    ce:log4j.xml
    06:09:22,078 INFO [WebService] Using RMI server codebase: http://POPILLON:8083/

    06:09:22,203 INFO [NamingService] Started jnpPort=1099, rmiPort=1098, backlog=5
    0, bindAddress=/0.0.0.0, Client SocketFactory=null, Server SocketFactory=org.jbo
    ss.net.sockets.DefaultSocketFactory@ad093076
    06:09:23,296 INFO [RARMetaData] Loading JBoss Resource Adapter for JDBC 2 XA dr
    ivers
    06:09:23,296 INFO [RARMetaData] Required license terms present. See deployment
    descriptor.
    06:09:32,734 INFO [MailService] Mail Service bound to java:/Mail
    06:09:32,906 INFO [Embedded] Catalina naming disabled
    06:09:33,109 INFO [Http11Protocol] Initializing Coyote HTTP/1.1 on http-0.0.0.0
    -8080
    06:09:33,125 INFO [Catalina] Initialization processed in 188 ms
    06:09:33,125 INFO [StandardService] Starting service jboss.web
    06:09:33,125 INFO [StandardEngine] Starting Servlet Engine: Apache Tomcat/5.0.2
    6
    06:09:33,125 INFO [StandardHost] XML validation disabled
    06:09:33,140 INFO [Catalina] Server startup in 15 ms
    06:09:33,171 WARN [DeploymentInfo] Only the root deployment can set the loader
    repository, ingoring config=null
    06:09:33,187 INFO [TomcatDeployer] deploy, ctxPath=/invoker, warUrl=file:/D:/jb
    oss-3.2.5/server/default/deploy/http-invoker.sar/invoker.war/
    06:09:33,468 WARN [DeploymentInfo] Only the root deployment can set the loader
    repository, ingoring config=null
    06:09:33,468 INFO [TomcatDeployer] deploy, ctxPath=, warUrl=file:/D:/jboss-3.2.
    5/server/default/deploy/jbossweb-tomcat50.sar/ROOT.war/
    06:09:33,531 WARN [DeploymentInfo] Only the root deployment can set the loader
    repository, ingoring config=null
    06:09:33,531 INFO [TomcatDeployer] deploy, ctxPath=/jbossmq-httpil, warUrl=file
    :/D:/jboss-3.2.5/server/default/deploy/jms/jbossmq-httpil.sar/jbossmq-httpil.war
    /
    06:09:33,593 INFO [DefaultDS] Bound connection factory for resource adapter for
    ConnectionManager 'jboss.jca:service=LocalTxCM,name=DefaultDS to JNDI name 'jav
    a:/DefaultDS'
    06:09:33,656 INFO [A] Bound to JNDI name: queue/A
    06:09:33,656 INFO [B] Bound to JNDI name: queue/B
    06:09:33,656 INFO [C] Bound to JNDI name: queue/C
    06:09:33,671 INFO [D] Bound to JNDI name: queue/D
    06:09:33,671 INFO [ex] Bound to JNDI name: queue/ex
    06:09:33,687 INFO [testTopic] Bound to JNDI name: topic/testTopic
    06:09:33,687 INFO [securedTopic] Bound to JNDI name: topic/securedTopic
    06:09:33,687 INFO [testDurableTopic] Bound to JNDI name: topic/testDurableTopic

    06:09:33,687 INFO [testQueue] Bound to JNDI name: queue/testQueue
    06:09:33,718 INFO [UILServerILService] JBossMQ UIL service available at : /0.0.
    0.0:8093
    06:09:33,734 INFO [DLQ] Bound to JNDI name: queue/DLQ
    06:09:33,734 INFO [JmsXA] Bound connection factory for resource adapter for Con
    nectionManager 'jboss.jca:service=TxCM,name=JmsXA to JNDI name 'java:/JmsXA'
    06:09:33,734 INFO [dbUrl] Bound connection factory for resource adapter for Con
    nectionManager 'jboss.jca:service=LocalTxCM,name=dbUrl to JNDI name 'java:/dbUrl
    '
    06:09:33,765 INFO [TomcatDeployer] deploy, ctxPath=/jmx-console, warUrl=file:/D
    :/jboss-3.2.5/server/default/deploy/jmx-console.war/
    06:09:33,921 INFO [TomcatDeployer] deploy, ctxPath=/web-console, warUrl=file:/D
    :/jboss-3.2.5/server/default/tmp/deploy/tmp20621web-console.war/
    06:09:34,281 INFO [Server] JBoss (MX MicroKernel) [3.2.5 (build: CVSTag=JBoss_3
    _2_5 date=200406251954)] Started in 13s:297ms
    06:09:34,281 INFO [Tomcat5] Saw org.jboss.system.server.started notification, s
    tarting connectors
    06:09:34,312 INFO [Http11Protocol] Starting Coyote HTTP/1.1 on http-0.0.0.0-808
    0
    06:09:34,343 INFO [EjbModule] Deploying JNDIProduct
    06:09:34,390 INFO [ChannelSocket] Port busy 8009 java.net.BindException: Addres
    s already in use: JVM_Bind
    06:09:34,390 INFO [ChannelSocket] JK2: ajp13 listening on /0.0.0.0:8010
    06:09:34,390 INFO [JkMain] Jk running ID=1 time=0/31 config=null
    06:09:34,453 INFO [EJBDeployer] Deployed: file:/D:/jboss-3.2.5/server/default/d
    eploy/Product.jar
    06:09:37,734 INFO [STDOUT] setEntityContext
    06:09:37,734 INFO [STDOUT] ejbCreate
    06:09:37,734 INFO [STDOUT] java.sql.SQLException: No suitable driver found for
    jdbc:mysql://localhost:3306/TITINE
    06:09:37,734 ERROR [LogInterceptor] EJBException, causedBy:
    java.lang.NullPointerException
    at BMPEBean.ProductBean.ejbCreate(ProductBean.java:60)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.jboss.ejb.plugins.BMPPersistenceManager.createEntity(BMPPersisten
    ceManager.java:189)
    at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.crea
    teEntity(CachedConnectionInterceptor.java:269)
    at org.jboss.ejb.EntityContainer.createHome(EntityContainer.java:725)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityC
    ontainer.java:1061)
    at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(Ent
    itySynchronizationInterceptor.java:204)
    at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invo
    keHome(CachedConnectionInterceptor.java:214)
    at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractIntercep
    tor.java:88)
    at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInst
    anceInterceptor.java:90)
    at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInte
    rceptor.java:61)
    at org.jboss.ejb.plugins.EntityCreationInterceptor.invokeHome(EntityCrea
    tionInterceptor.java:28)
    at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInte
    rceptor.java:88)
    at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxIntercep
    torCMT.java:315)
    at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.ja
    va:128)
    at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityIntercep
    tor.java:94)
    at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:1
    20)
    at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invokeHome(ProxyF
    actoryFinderInterceptor.java:93)
    at org.jboss.ejb.EntityContainer.internalInvokeHome(EntityContainer.java
    :478)
    at org.jboss.ejb.Container.invoke(Container.java:743)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.
    java:60)
    at org.jboss.mx.server.Invocation.dispatch(Invocation.java:61)
    at org.jboss.mx.server.Invocation.dispatch(Invocation.java:53)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.
    java:185)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:473)
    at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:
    360)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
    at sun.rmi.transport.Transport$1.run(Transport.java:159)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
    at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:5
    35)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTranspor
    t.java:790)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport
    .java:649)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec
    utor.java:885)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
    .java:907)
    at java.lang.Thread.run(Thread.java:619)



    with 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>Your first EJB application </description>
    <display-name>Products Application</display-name>
    <enterprise-beans>
    <entity>
    <ejb-name>JNDIProduct</ejb-name>
    <home>BMPEBean.ProductHome</home>
    <remote>BMPEBean.Product</remote>
    <ejb-class>BMPEBean.ProductBean</ejb-class>
    <persistence-type>Bean</persistence-type>
    <prim-key-class>BMPEBean.ProductPK</prim-key-class>
    <reentrant>false</reentrant>
    </entity>
    </enterprise-beans>
    </ejb-jar>


  • Jboss -------------------------------------------------------------------------------------------------------------------------------
    The system cannot find the file specified.
    ===============================================================================
    .
    JBoss Bootstrap Environment
    .
    JBOSS_HOME: D:\jboss-3.2.5\bin\\..
    .
    JAVA: C:\Program Files\Java\jdk1.6.0\bin\java
    .
    JAVA_OPTS: -Dprogram.name=run.bat
    .
    CLASSPATH: C:\Program Files\Java\jdk1.6.0\lib\tools.jar;D:\jboss-3.2.5\bin\\ru
    n.jar
    .
    ===============================================================================
    .
    06:19:41,500 INFO [Server] Starting JBoss (MX MicroKernel)...
    06:19:41,500 INFO [Server] Release ID: JBoss [WonderLand] 3.2.5 (build: CVSTag=
    JBoss_3_2_5 date=200406251954)
    06:19:41,500 INFO [Server] Home Dir: D:\jboss-3.2.5
    06:19:41,500 INFO [Server] Home URL: file:/D:/jboss-3.2.5/
    06:19:41,500 INFO [Server] Library URL: file:/D:/jboss-3.2.5/lib/
    06:19:41,515 INFO [Server] Patch URL: null
    06:19:41,515 INFO [Server] Server Name: default
    06:19:41,515 INFO [Server] Server Home Dir: D:\jboss-3.2.5\server\default
    06:19:41,515 INFO [Server] Server Home URL: file:/D:/jboss-3.2.5/server/default
    /
    06:19:41,515 INFO [Server] Server Data Dir: D:\jboss-3.2.5\server\default\data
    06:19:41,515 INFO [Server] Server Temp Dir: D:\jboss-3.2.5\server\default\tmp
    06:19:41,515 INFO [Server] Server Config URL: file:/D:/jboss-3.2.5/server/defau
    lt/conf/
    06:19:41,515 INFO [Server] Server Library URL: file:/D:/jboss-3.2.5/server/defa
    ult/lib/
    06:19:41,515 INFO [Server] Root Deployment Filename: jboss-service.xml
    06:19:41,515 INFO [Server] Starting General Purpose Architecture (GPA)...
    06:19:41,609 INFO [ServerInfo] Java version: 1.6.0,Sun Microsystems Inc.
    06:19:41,609 INFO [ServerInfo] Java VM: Java HotSpot(TM) Client VM 1.6.0-b105,S
    un Microsystems Inc.
    06:19:41,609 INFO [ServerInfo] OS-System: Windows XP 5.1,x86
    06:19:41,812 INFO [Server] Core system initialized
    06:19:42,609 INFO [Log4jService$URLWatchTimerTask] Configuring from URL: resour
    ce:log4j.xml
    06:19:42,703 INFO [WebService] Using RMI server codebase: http://POPILLON:8083/

    06:19:42,828 INFO [NamingService] Started jnpPort=1099, rmiPort=1098, backlog=5
    0, bindAddress=/0.0.0.0, Client SocketFactory=null, Server SocketFactory=org.jbo
    ss.net.sockets.DefaultSocketFactory@ad093076
    06:19:43,906 INFO [RARMetaData] Loading JBoss Resource Adapter for JDBC 2 XA dr
    ivers
    06:19:43,906 INFO [RARMetaData] Required license terms present. See deployment
    descriptor.
    06:19:54,968 INFO [MailService] Mail Service bound to java:/Mail
    06:19:55,140 INFO [Embedded] Catalina naming disabled
    06:19:55,343 INFO [Http11Protocol] Initializing Coyote HTTP/1.1 on http-0.0.0.0
    -8080
    06:19:55,359 INFO [Catalina] Initialization processed in 188 ms
    06:19:55,359 INFO [StandardService] Starting service jboss.web
    06:19:55,359 INFO [StandardEngine] Starting Servlet Engine: Apache Tomcat/5.0.2
    6
    06:19:55,359 INFO [StandardHost] XML validation disabled
    06:19:55,375 INFO [Catalina] Server startup in 16 ms
    06:19:55,390 WARN [DeploymentInfo] Only the root deployment can set the loader
    repository, ingoring config=null
    06:19:55,406 INFO [TomcatDeployer] deploy, ctxPath=/invoker, warUrl=file:/D:/jb
    oss-3.2.5/server/default/deploy/http-invoker.sar/invoker.war/
    06:19:55,703 WARN [DeploymentInfo] Only the root deployment can set the loader
    repository, ingoring config=null
    06:19:55,703 INFO [TomcatDeployer] deploy, ctxPath=, warUrl=file:/D:/jboss-3.2.
    5/server/default/deploy/jbossweb-tomcat50.sar/ROOT.war/
    06:19:55,765 WARN [DeploymentInfo] Only the root deployment can set the loader
    repository, ingoring config=null
    06:19:55,765 INFO [TomcatDeployer] deploy, ctxPath=/jbossmq-httpil, warUrl=file
    :/D:/jboss-3.2.5/server/default/deploy/jms/jbossmq-httpil.sar/jbossmq-httpil.war
    /
    06:19:55,828 INFO [DefaultDS] Bound connection factory for resource adapter for
    ConnectionManager 'jboss.jca:service=LocalTxCM,name=DefaultDS to JNDI name 'jav
    a:/DefaultDS'
    06:19:55,890 INFO [A] Bound to JNDI name: queue/A
    06:19:55,890 INFO [B] Bound to JNDI name: queue/B
    06:19:55,890 INFO [C] Bound to JNDI name: queue/C
    06:19:55,890 INFO [D] Bound to JNDI name: queue/D
    06:19:55,906 INFO [ex] Bound to JNDI name: queue/ex
    06:19:55,906 INFO [testTopic] Bound to JNDI name: topic/testTopic
    06:19:55,921 INFO [securedTopic] Bound to JNDI name: topic/securedTopic
    06:19:55,921 INFO [testDurableTopic] Bound to JNDI name: topic/testDurableTopic

    06:19:55,921 INFO [testQueue] Bound to JNDI name: queue/testQueue
    06:19:55,937 INFO [UILServerILService] JBossMQ UIL service available at : /0.0.
    0.0:8093
    06:19:55,953 INFO [DLQ] Bound to JNDI name: queue/DLQ
    06:19:55,968 INFO [JmsXA] Bound connection factory for resource adapter for Con
    nectionManager 'jboss.jca:service=TxCM,name=JmsXA to JNDI name 'java:/JmsXA'
    06:19:55,968 INFO [dbUrl] Bound connection factory for resource adapter for Con
    nectionManager 'jboss.jca:service=LocalTxCM,name=dbUrl to JNDI name 'java:/dbUrl
    '
    06:19:55,984 INFO [TomcatDeployer] deploy, ctxPath=/jmx-console, warUrl=file:/D
    :/jboss-3.2.5/server/default/deploy/jmx-console.war/
    06:19:56,265 INFO [TomcatDeployer] deploy, ctxPath=/web-console, warUrl=file:/D
    :/jboss-3.2.5/server/default/tmp/deploy/tmp51505web-console.war/
    06:19:56,484 INFO [Server] JBoss (MX MicroKernel) [3.2.5 (build: CVSTag=JBoss_3
    _2_5 date=200406251954)] Started in 14s:969ms
    06:19:56,484 INFO [Tomcat5] Saw org.jboss.system.server.started notification, s
    tarting connectors
    06:19:56,515 INFO [Http11Protocol] Starting Coyote HTTP/1.1 on http-0.0.0.0-808
    0
    06:19:56,562 INFO [EjbModule] Deploying JNDIProduct
    06:19:56,593 INFO [ChannelSocket] Port busy 8009 java.net.BindException: Addres
    s already in use: JVM_Bind
    06:19:56,593 INFO [ChannelSocket] JK2: ajp13 listening on /0.0.0.0:8010
    06:19:56,593 INFO [JkMain] Jk running ID=1 time=0/31 config=null
    06:19:56,656 INFO [EJBDeployer] Deployed: file:/D:/jboss-3.2.5/server/default/d
    eploy/Product.jar
    06:20:00,671 INFO [STDOUT] setEntityContext
    06:20:00,671 INFO [STDOUT] ejbCreate
    06:20:00,671 INFO [STDOUT] javax.naming.NameNotFoundException: dbUrl not bound
    06:20:00,671 INFO [STDOUT] java.sql.SQLException: The url cannot be null
    06:20:00,671 ERROR [LogInterceptor] EJBException, causedBy:
    java.lang.NullPointerException
    at BMPEBean.ProductBean.ejbCreate(ProductBean.java:60)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.jboss.ejb.plugins.BMPPersistenceManager.createEntity(BMPPersisten
    ceManager.java:189)
    at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.crea
    teEntity(CachedConnectionInterceptor.java:269)
    at org.jboss.ejb.EntityContainer.createHome(EntityContainer.java:725)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityC
    ontainer.java:1061)
    at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(Ent
    itySynchronizationInterceptor.java:204)
    at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invo
    keHome(CachedConnectionInterceptor.java:214)
    at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractIntercep
    tor.java:88)
    at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInst
    anceInterceptor.java:90)
    at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInte
    rceptor.java:61)
    at org.jboss.ejb.plugins.EntityCreationInterceptor.invokeHome(EntityCrea
    tionInterceptor.java:28)
    at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInte
    rceptor.java:88)
    at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxIntercep
    torCMT.java:315)
    at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.ja
    va:128)
    at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityIntercep
    tor.java:94)
    at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:1
    20)
    at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invokeHome(ProxyF
    actoryFinderInterceptor.java:93)
    at org.jboss.ejb.EntityContainer.internalInvokeHome(EntityContainer.java
    :478)
    at org.jboss.ejb.Container.invoke(Container.java:743)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.
    java:60)
    at org.jboss.mx.server.Invocation.dispatch(Invocation.java:61)
    at org.jboss.mx.server.Invocation.dispatch(Invocation.java:53)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.
    java:185)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:473)
    at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:
    360)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
    at sun.rmi.transport.Transport$1.run(Transport.java:159)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
    at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:5
    35)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTranspor
    t.java:790)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport
    .java:649)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec
    utor.java:885)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
    .java:907)
    at java.lang.Thread.run(Thread.java:619)
     
    Mark E Hansen
    Ranch Hand
    Posts: 650
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Wow, there's a lot of stuff in there to read. I'll do my best, but no promises that I won't miss something

    I noticed that your <datasource> doesn't have a user name or password. Also, you still have question mark charactrers after the <driver-class> element?

    As far as the version of the MySQL JDBC driver, you can choose which ever one you like. I think I downloaded the most current version, and was surprised to see you using something that sounded completely different. Did you get your JDBC driver from the MySQL web site? Anyway, that was the only reason I questioned it. You can you whatever driver works for you. I found the connector-J driver here: http://www.mysql.com/products/connector/

    Whichever JDBC driver you decide to use for MySQL, make sure you remove the other driver files, so you don't end up with dual driver files/Jars in the application server's lib directory.

    In looking at your ejb-jar.xml, I'm confused at why you're including environment entries for dbUrl, dbUserName and dbPassword. Anything deployed to the application server should use the datasource (deployed as mysql-ds.xml) to connect to the database. What is using these environment entries?

    Now, on to the mile-long server.log file ...

    It starts with a message that a file cannot be found. Do you know what this is? Is it important?

    We see that it bound the name for your JDBC connection:

    We then see that it is trying to deploy your Product.jar:


    So it seems the application server is still having a hard time finding the driver class for your datasource, or the URL is not in the correct format for your driver class. I still don't know which driver class you're using, as you've mentioned a couple different versions of which I'm not familiar.

    One think you can do to make sure you're URL is correct for your driver class is to write a simple stand-alone Java application (like I showed above) which just connects to the database.

    Next, we see the following in the server.log:

    It seems there is a problem at line 60 of your ProductBean.java. You'll have to look at that and see why it would get a NullPointerException. Probably you're using a variable which is not set.

    Okay, I see the second ejb-jar.xml doesn't have the environment entries for the database connection. It looks like you tried it once with them there, and once without them.

    In looking at the server.log for the second run, I see error about dbUrl not being bound, even though the datasource deployed properly. I'm thinking there is a problem with how you're looking up the database in your Bean.

    Can you please show your ejbCreate method of your Bean? My guess is you're using the environment entries to create a database connection.

    My hope is that someone that knows more about what you're trying to do in your ejbCreate will chime in here, as we're getting beyond my current ability to help.


    Best Regards,

     
    Jaikiran Pai
    Sheriff
    Posts: 10445
    227
    IntelliJ IDE Ubuntu
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hmm, too much contents in the posts

    Questions to the original poster -

    1) Why are you trying BMP which is deprecated in the recent years?
    2) Why JBoss-3.2.5, which again is too old.
     
    A. S. Georgie
    Ranch Hand
    Posts: 72
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Jaikiran Pai wrote:Hmm, too much contents in the posts

    Questions to the original poster -

    1) Why are you trying BMP which is deprecated in the recent years?
    2) Why JBoss-3.2.5, which again is too old.



    very good question, but i'm thinking, i'm thinking if everybody trying to build an Hello world application, it's not at these very first steps trying to find the very up to date one, that's the very reason why i'm trying to do with all these old ones, to get to thoses on top, maybe
     
    A. S. Georgie
    Ranch Hand
    Posts: 72
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Mark E Hansen wrote:
    Wow, there's a lot of stuff in there to read. I'll do my best, but no promises that I won't miss something



    Very dear Mark, I’m really sorry about that long long creeping stuff, ‘m scratching my brain to just appreciate over all this valuable prompt and notes of you about every nook an’ cranny, I mean, you taught me lock stock’n’barrel here what a programmer need to know : ), one day i repay you, adn I promise. don’ know how but I will.

    Mark E Hansen wrote:
    I noticed that your <datasource> doesn't have a user name or password. Also, you still have question mark charactrers after the <driver-class> element?



    I don’t know username or password is why needed at all, that why I left it alone, I just waned to know is this part is correct or not?


  • mysql-ds.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'>

    <datasources>
    <local-tx-datasource>
    <jndi-name>dbUrl</jndi-name>
    <connection-url>jdbc:mysql://localhost:3306/TITINE</connection-url>
    <driver-class>com.mysql.jdbc.Driver</driver-class>
    <user-name></user-name>
    <password></password>
    </local-tx-datasource>
    </datasources>


  • Mark E Hansen wrote:
    As far as the version of the MySQL JDBC driver, you can choose which ever one you like. I think I downloaded the most current version, and was surprised to see you using something that sounded completely different. Did you get your JDBC driver from the MySQL web site? Anyway, that was the only reason I questioned it. You can you whatever driver works for you. I found the connector-J driver here: http://www.mysql.com/products/connector/



    no, no, not MySQL web site? Actually I got it directly at http://www.ibiblio.org/maven/ Jarrrrrrrrr pool, but I couldn’t find the version you stressed mysql-connector-java-5.1.10-bin.jar, I’ll try other’s.

    Mark E Hansen wrote:
    Whichever JDBC driver you decide to use for MySQL, make sure you remove the other driver files, so you don't end up with dual driver files/Jars in the application server's lib directory.



    I didn’t removed it from the place, but now I’ll do this. now I have there this one: ‘mysql-connector-java-2.0.14’,


    Mark E Hansen wrote:
    In looking at your ejb-jar.xml, I'm confused at why you're including environment entries for dbUrl, dbUserName and dbPassword. Anything deployed to the application server should use the datasource (deployed as mysql-ds.xml) to connect to the database. What is using these environment entries?



    if I change it the way of your belief:


  • 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>Your first EJB application </description>
    <display-name>Products Application</display-name>
    <enterprise-beans>
    <entity>
    <ejb-name>JNDIProduct</ejb-name>
    <home>BMPEBean.ProductHome</home>
    <remote>BMPEBean.Product</remote>
    <ejb-class>BMPEBean.ProductBean</ejb-class>
    <persistence-type>Bean</persistence-type>
    <prim-key-class>BMPEBean.ProductPK</prim-key-class>
    <reentrant>false</reentrant>
    </entity>
    </enterprise-beans>
    </ejb-jar>


  • okey? but see jboss like this:

    jboss ---------------------------------------------------------------------------------------------------

    The system cannot find the file specified.
    =============================================================.
    JBoss Bootstrap Environment
    .
    JBOSS_HOME: D:\jboss-3.2.5\bin\\..
    .
    JAVA: C:\Program Files\Java\jdk1.6.0\bin\java
    .
    JAVA_OPTS: -Dprogram.name=run.bat
    .
    CLASSPATH: C:\Program Files\Java\jdk1.6.0\lib\tools.jar;D:\jboss-3.2.5\bin\\ru
    n.jar
    .
    =============================================================.
    10:12:07,296 INFO [Server] Starting JBoss (MX MicroKernel)...
    10:12:07,296 INFO [Server] Release ID: JBoss [WonderLand] 3.2.5 (build: CVSTag=
    JBoss_3_2_5 date=200406251954)
    10:12:07,296 INFO [Server] Home Dir: D:\jboss-3.2.5
    10:12:07,296 INFO [Server] Home URL: file:/D:/jboss-3.2.5/
    10:12:07,296 INFO [Server] Library URL: file:/D:/jboss-3.2.5/lib/
    10:12:07,296 INFO [Server] Patch URL: null
    10:12:07,296 INFO [Server] Server Name: default
    10:12:07,296 INFO [Server] Server Home Dir: D:\jboss-3.2.5\server\default
    10:12:07,296 INFO [Server] Server Home URL: file:/D:/jboss-3.2.5/server/default
    /
    10:12:07,296 INFO [Server] Server Data Dir: D:\jboss-3.2.5\server\default\data
    10:12:07,296 INFO [Server] Server Temp Dir: D:\jboss-3.2.5\server\default\tmp
    10:12:07,296 INFO [Server] Server Config URL: file:/D:/jboss-3.2.5/server/defau
    lt/conf/
    10:12:07,312 INFO [Server] Server Library URL: file:/D:/jboss-3.2.5/server/defa
    ult/lib/
    10:12:07,312 INFO [Server] Root Deployment Filename: jboss-service.xml
    10:12:07,312 INFO [Server] Starting General Purpose Architecture (GPA)...
    10:12:07,593 INFO [ServerInfo] Java version: 1.6.0,Sun Microsystems Inc.
    10:12:07,593 INFO [ServerInfo] Java VM: Java HotSpot(TM) Client VM 1.6.0-b105,S
    un Microsystems Inc.
    10:12:07,593 INFO [ServerInfo] OS-System: Windows XP 5.1,x86
    10:12:08,015 INFO [Server] Core system initialized
    10:12:09,656 INFO [Log4jService$URLWatchTimerTask] Configuring from URL: resour
    ce:log4j.xml
    10:12:09,859 INFO [WebService] Using RMI server codebase: http://POPILLON:8083/

    10:12:10,125 INFO [NamingService] Started jnpPort=1099, rmiPort=1098, backlog=5
    0, bindAddress=/0.0.0.0, Client SocketFactory=null, Server SocketFactory=org.jbo
    ss.net.sockets.DefaultSocketFactory@ad093076
    10:12:11,828 INFO [RARMetaData] Loading JBoss Resource Adapter for JDBC 2 XA dr
    ivers
    10:12:11,828 INFO [RARMetaData] Required license terms present. See deployment
    descriptor.
    10:12:30,187 INFO [MailService] Mail Service bound to java:/Mail
    10:12:30,390 INFO [Embedded] Catalina naming disabled
    10:12:30,640 INFO [Http11Protocol] Initializing Coyote HTTP/1.1 on http-0.0.0.0
    -8080
    10:12:30,656 INFO [Catalina] Initialization processed in 235 ms
    10:12:30,656 INFO [StandardService] Starting service jboss.web
    10:12:30,656 INFO [StandardEngine] Starting Servlet Engine: Apache Tomcat/5.0.2
    6
    10:12:30,656 INFO [StandardHost] XML validation disabled
    10:12:30,671 INFO [Catalina] Server startup in 15 ms
    10:12:30,718 WARN [DeploymentInfo] Only the root deployment can set the loader
    repository, ingoring config=null
    10:12:30,734 INFO [TomcatDeployer] deploy, ctxPath=/invoker, warUrl=file:/D:/jb
    oss-3.2.5/server/default/deploy/http-invoker.sar/invoker.war/
    10:12:31,093 WARN [DeploymentInfo] Only the root deployment can set the loader
    repository, ingoring config=null
    10:12:31,093 INFO [TomcatDeployer] deploy, ctxPath=, warUrl=file:/D:/jboss-3.2.
    5/server/default/deploy/jbossweb-tomcat50.sar/ROOT.war/
    10:12:31,156 WARN [DeploymentInfo] Only the root deployment can set the loader
    repository, ingoring config=null
    10:12:31,156 INFO [TomcatDeployer] deploy, ctxPath=/jbossmq-httpil, warUrl=file
    :/D:/jboss-3.2.5/server/default/deploy/jms/jbossmq-httpil.sar/jbossmq-httpil.war
    /
    10:12:31,234 INFO [DefaultDS] Bound connection factory for resource adapter for
    ConnectionManager 'jboss.jca:service=LocalTxCM,name=DefaultDS to JNDI name 'jav
    a:/DefaultDS'
    10:12:31,343 INFO [A] Bound to JNDI name: queue/A
    10:12:31,343 INFO [B] Bound to JNDI name: queue/B
    10:12:31,343 INFO [C] Bound to JNDI name: queue/C
    10:12:31,343 INFO [D] Bound to JNDI name: queue/D
    10:12:31,359 INFO [ex] Bound to JNDI name: queue/ex
    10:12:31,359 INFO [testTopic] Bound to JNDI name: topic/testTopic
    10:12:31,359 INFO [securedTopic] Bound to JNDI name: topic/securedTopic
    10:12:31,375 INFO [testDurableTopic] Bound to JNDI name: topic/testDurableTopic

    10:12:31,375 INFO [testQueue] Bound to JNDI name: queue/testQueue
    10:12:31,406 INFO [UILServerILService] JBossMQ UIL service available at : /0.0.
    0.0:8093
    10:12:31,421 INFO [DLQ] Bound to JNDI name: queue/DLQ
    10:12:31,437 INFO [JmsXA] Bound connection factory for resource adapter for Con
    nectionManager 'jboss.jca:service=TxCM,name=JmsXA to JNDI name 'java:/JmsXA'
    10:12:31,437 INFO [dbUrl] Bound connection factory for resource adapter for Con
    nectionManager 'jboss.jca:service=LocalTxCM,name=dbUrl to JNDI name 'java:/dbUrl
    '
    10:12:31,484 INFO [TomcatDeployer] deploy, ctxPath=/jmx-console, warUrl=file:/D
    :/jboss-3.2.5/server/default/deploy/jmx-console.war/
    10:12:31,671 INFO [TomcatDeployer] deploy, ctxPath=/web-console, warUrl=file:/D
    :/jboss-3.2.5/server/default/tmp/deploy/tmp49370web-console.war/
    10:12:32,062 INFO [Server] JBoss (MX MicroKernel) [3.2.5 (build: CVSTag=JBoss_3
    _2_5 date=200406251954)] Started in 24s:750ms
    10:12:32,062 INFO [Tomcat5] Saw org.jboss.system.server.started notification, s
    tarting connectors
    10:12:32,093 INFO [Http11Protocol] Starting Coyote HTTP/1.1 on http-0.0.0.0-808
    0
    10:12:32,156 INFO [EjbModule] Deploying JNDIProduct
    10:12:32,156 INFO [ChannelSocket] Port busy 8009 java.net.BindException: Addres
    s already in use: JVM_Bind
    10:12:32,171 INFO [ChannelSocket] JK2: ajp13 listening on /0.0.0.0:8010
    10:12:32,187 INFO [JkMain] Jk running ID=1 time=0/47 config=null
    10:12:32,234 INFO [EJBDeployer] Deployed: file:/D:/jboss-3.2.5/server/default/d
    eploy/Product.jar
    10:12:36,859 INFO [STDOUT] setEntityContext
    10:12:36,859 INFO [STDOUT] ejbCreate
    10:12:36,875 INFO [STDOUT]
    javax.naming.NameNotFoundException: dbUrl not bound
    10:12:36,875 INFO [STDOUT] java.sql.SQLException: The url cannot be null
    10:12:36,875 ERROR [LogInterceptor] EJBException, causedBy:
    java.lang.NullPointerException

    at BMPEBean.ProductBean.ejbCreate(ProductBean.java:60)

    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.jboss.ejb.plugins.BMPPersistenceManager.createEntity(BMPPersisten
    ceManager.java:189)
    at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.crea
    teEntity(CachedConnectionInterceptor.java:269)
    at org.jboss.ejb.EntityContainer.createHome(EntityContainer.java:725)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityC
    ontainer.java:1061)
    at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(Ent
    itySynchronizationInterceptor.java:204)
    at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invo
    keHome(CachedConnectionInterceptor.java:214)
    at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractIntercep
    tor.java:88)
    at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInst
    anceInterceptor.java:90)
    at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInte
    rceptor.java:61)
    at org.jboss.ejb.plugins.EntityCreationInterceptor.invokeHome(EntityCrea
    tionInterceptor.java:28)
    at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInte
    rceptor.java:88)
    at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxIntercep
    torCMT.java:315)
    at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.ja
    va:128)
    at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityIntercep
    tor.java:94)
    at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:1
    20)
    at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invokeHome(ProxyF
    actoryFinderInterceptor.java:93)
    at org.jboss.ejb.EntityContainer.internalInvokeHome(EntityContainer.java
    :478)
    at org.jboss.ejb.Container.invoke(Container.java:743)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.
    java:60)
    at org.jboss.mx.server.Invocation.dispatch(Invocation.java:61)
    at org.jboss.mx.server.Invocation.dispatch(Invocation.java:53)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.
    java:185)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:473)
    at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:
    360)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
    at sun.rmi.transport.Transport$1.run(Transport.java:159)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
    at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:5
    35)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTranspor
    t.java:790)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport
    .java:649)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec
    utor.java:885)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
    .java:907)
    at java.lang.Thread.run(Thread.java:619)


    Mark E Hansen wrote:
    Now, on to the mile-long server.log file ...

    It starts with a message that a file cannot be found. Do you know what this is? Is it important?



    well, actually I think it is the Driver, what do you think?


    Mark E Hansen wrote:
    So it seems the application server is still having a hard time finding the driver class for your datasource, or the URL is not in the correct format for your driver class. I still don't know which driver class you're using, as you've mentioned a couple different versions of which I'm not familiar.

    One think you can do to make sure you're URL is correct for your driver class is to write a simple stand-alone Java application (like I showed above) which just connects to the database.



    also I changed the <connection-url>jdbc:mysql://localhost:3306/TITINE</connection-url> to <connection-url>jdbc:mysql:\\localhost:3306\TITINE</connection-url> that was same result, so changed it back. as I told ‘fore, I’m using now, ‘mysql-connector-java-2.0.14.jar’


    Mark E Hansen wrote:
    # 06:09:37,734 ERROR [LogInterceptor] EJBException, causedBy: java.lang.NullPointerException
    # at BMPEBean.ProductBean.ejbCreate(ProductBean.java:60)
    # at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

    It seems there is a problem at line 60 of your ProductBean.java. You'll have to look at that and see why it would get a NullPointerException. Probably you're using a variable which is not set.



    checked it, it is:
    ....
    59 con = getConnection();
    60 ps = con.prepareStatement(sql);
    61 ps.setInt(1, productId);
    61 ps.setString(2, productName);
    ....

    I think that connection and driver should hear this, and don’t fiddle with this here no w...

    Mark E Hansen wrote:
    Can you please show your ejbCreate method of your Bean? My guess is you're using the environment entries to create a database connection.



    I’m making it like this:

    %JAVA_HOME%\bin\jar.exe cfv "%JBossHome%\server\default\deploy\Product.jar" BMPEBean "META-INF\ejb-jar.xml"

    cd \
    cd C:\mysql\bin\
    C:\mysql\bin\mysql

    pause
    del "%JBossHome%\server\default\deploy\Product.jar"

    Mark E Hansen wrote:
    My hope is that someone that knows more about what you're trying to do in your ejbCreate will chime in here, as we're getting beyond my current ability to help.



    you know, what, you are a complete java expert and trying to hide why? I don’t know, man you conjuring image of the whole ball of wax here and ... I got words too cheap to thank your help ...
     
    Mark E Hansen
    Ranch Hand
    Posts: 650
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    I see now that you are using Bean Managed Persistence. I've never used this, so my help may be even more limited.

    What has been confusing me is that you have two things:

    1. A datasource descriptor file, named mysql-ds.xml, and
    2. Environment entries in the ejb-jar.xml file for creating a connection to the database.

    I couldn't understand why you would have both. I think you should deploy the datasource descriptor, and use this in your Bean.

    If you can show the source code of your Bean (this is what I meant by show us your ejbCreate method, by the way - I meant show the source code for your ejbCreate() method ), we can see how you are creating the connection. My guess is that you are trying to create it as if you were a stand-alone Java application, when you should be getting it from the datasource (and not using those environment entries). Note that as I've not used Bean Managed Persistence, I'm not clear on how you are supposed to get a connection to the database in this case. Perhaps someone else can clarify this?

    In any case, if your Bean code is making use of the environment entries, then the entries should be included in the ejb-jar.xml file. As I said above, I wonder if this is the correct way for your Bean to get a connection to the database.

    As far as the datasource descriptor goes, it will need the user name and password (if required by the underlying database), so you should add those. My application's mysql-ds.xml file looks like this:

    This is for MySQL Connector-J JDBC Driver version 5.1.10. Your JDBC driver may require a different format. The documentation for your driver should describe this. Note that if you're not using the datasource in your case (because you're creating a connection to the database using the environment entries, etc.), then the datasource descriptor doesn't matter, as it's not being used.

    As far as the format for the <connection-url> element, see the documentation for your driver. My guess is that it would not support the use of the backslash character.

    If you're just trying to lean about EJB, can I make a suggestion? I'm doing the same and am using the book EJB3 in Action from Manning Publications. This has been an excellent book (so far) and I've learned a lot.

    Also, I'm using Eclipse and JBoss Tools for Eclipse, which make creating J2EE applications easier. If you're willing to use Eclipse instead, I can provide links to the tools, and a link to a very good tutorial which walks you through creating the first J2EE application on JBoss.

    Best Regards,
     
    A. S. Georgie
    Ranch Hand
    Posts: 72
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Mark E Hansen wrote:
    I see now that you are using Bean Managed Persistence. I've never used this, so my help may be even more limited.



    yes It's BMP (Bean Managed Persistence)

    Mark E Hansen wrote:
    If you can show the source code of your Bean (this is what I meant by show us your ejbCreate method, by the way - I meant show the source code for your ejbCreate() method ), we can see how you are creating the connection. My guess is that you are trying to create it as if you were a stand-alone Java application, when you should be getting it from the datasource (and not using those environment entries).













    Mark E Hansen wrote:
    Note that as I've not used Bean Managed Persistence, I'm not clear on how you are supposed to get a connection to the database in this case. Perhaps someone else can clarify this?


    no problem

     
    A. S. Georgie
    Ranch Hand
    Posts: 72
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Mark E Hansen wrote:
    If you're just trying to lean about EJB, can I make a suggestion? I'm doing the same and am using the book EJB3 in Action from Manning Publications. This has been an excellent book (so far) and I've learned a lot.

    Also, I'm using Eclipse and JBoss Tools for Eclipse, which make creating J2EE applications easier. If you're willing to use Eclipse instead, I can provide links to the tools, and a link to a very good tutorial which walks you through creating the first J2EE application on JBoss.

    Best Regards,



    Dear Mark that would be definitely big honor to me have your regarding links, books...
    Best regards...
     
    Mark E Hansen
    Ranch Hand
    Posts: 650
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    So if we look at your getConnection() method, we see that you are building your connection object manually, using environment entries for all the connection parameters:


    First, the exception handlers are just printing the message strings from the exceptions, but not otherwise doing anything with the error. My guess is that one of these exceptions is being hit, and so you're not getting a connection object to return, and that results in the NullPointerException we see later.

    It could be this is the cause of the "File not found" error we saw but didn't know where it came from. Trying changing the exception handlers to do more so you can see it in the server.log file. For example, try printing the stack trace - that will make it more visible.

    Next, all the callers of getConnection() just go off and use the returned connection without making sure it is valid. You have two choices here:

    1. Make sure the Bean cannot exist without a valid connection, or

    2. Check that the connection is valid before each use, and do something appropriate if it is not.

    I'm not sure how to do the first one - perhaps check the documentation for what is expected of the ejbCreate() method?
    Basically, if you can't get a connection to the database, what good is the Bean anyway? Perhaps the ejbCreate() method should throw an appropriate exception in this case?

    So, as far as the connection goes, debug the getConnection() method and find out why it is failing and fix that.

    Now, as for using the datasource, I can't supply you with code, but I'm sure there is a way you can create the connection from the datasource, rather than building it yourself from the environment entries. This would be better because the datasource really is a resource which your application will use, so you should configure it in one place only (the mysql-ds.xml file). The application should just reference that.

    Here is a generic example of how to look up a datasource from the JNDI. This may not work exactly as is, so I hope someone can correct this as necessary:

    I'm not sure about the value passed to the lookup() method. The "dbUrl" part would be the name you provided to the datasource in the mysql-ds.xml file.

    Looks like you're getting closer. Again, if you want to learn, you should probably learn with EJB3 technology, rather than the old EJB2 stuff

    Best Regards,

     
    Mark E Hansen
    Ranch Hand
    Posts: 650
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    A. S. Georgie wrote:
    Dear Mark that would be definitely big honor to me have your regarding links, books...
    Best regards...



    I'm using the Galileo edition of Eclipse, which you can download for free from their web site.

    I then installed the JBoss Tools feature, using the instructions at this URL: https://www.jboss.org/tools/download.html
    This basically talked about using the Update feature in Eclipse itself. It applies additional features to Eclipse through the use of update sites. In Eclipse, I went to Help -> Install New Software and provided the update site in the Work with: field. The update site I used was http://download.jboss.org/jbosstools/updates/development/ Have a look at this installation/setup tutorial: http://www.wi.uni-muenster.de/pi/lehre/ss09/EAI/tutorials/tutorial_jboss_setup.html

    Then I used the following Your First JEE Application tutorial: http://www-wi.uni-muenster.de/pi/lehre/ss09/EAI/tutorials/tutorial_jboss_project.html

    This has been very helpful, and I reference that application a lot while I'm reading the EJB3 in Action book.

    Best Regards,
     
    A. S. Georgie
    Ranch Hand
    Posts: 72
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Dear Mark,
    what now i can say about all this, thy heart is really great, and you are a brilliant man, i'll write you then,

    you did something out of this world, i'll write you ...

    my purest regards ...
     
    A. S. Georgie
    Ranch Hand
    Posts: 72
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Mark E Hansen wrote:






  • Dear Mark, this just keeps don’ work with me, but your way of facing a tracing log and how smart you were made me to some degree being alike about, learned a lot from you no less no doubt, head that saying “somewhere, something incredible is waiting to be known.”, then I got stocked to find a way out.

    remember that line bellow:


    The system cannot find the file specified.
    =============================================================.
    .
    JBoss Bootstrap Environment
    .
    ...


    the line saying about “The system cannot find the file specified.” has nothin to do with JBoss, actually before double line ====, actually ‘twas for copying ‘connector mm.mysql-2.0.8-bin.jar’ in bat with a mismatch path , so let the slate clean here we have allright:


    ===============================================================================
    .
    JBoss Bootstrap Environment
    .
    JBOSS_HOME: D:\jboss-3.2.5\bin\\..
    ...


    Mark E Hansen wrote:
    In any case, if your Bean code is making use of the environment entries, then the entries should be included in the ejb-jar.xml file. As I said above, I wonder if this is the correct way for your Bean to get a connection to the database.

    As far as the datasource descriptor goes, it will need the user name and password (if required by the underlying database), so you should add those. My application's mysql-ds.xml file looks like this:



    you know Mark, during these hours, changed both mysql-dx.xml, an’ ejb-jar.xml, and I saw spectrums of errors the most alignment if the one that shades into the following:


  • <?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>Your first EJB application </description>
    <display-name>Products Application</display-name>
    <enterprise-beans>
    <entity>
    <ejb-name>JNDIProduct</ejb-name>
    <home>BMPEBean.ProductHome</home>
    <remote>BMPEBean.Product</remote>
    <ejb-class>BMPEBean.ProductBean</ejb-class>
    <persistence-type>Bean</persistence-type>
    <prim-key-class>BMPEBean.ProductPK</prim-key-class>
    <reentrant>false</reentrant>
    <env-entry>
    <env-entry-name>dbUrl</env-entry-name>
    <env-entry-type>java.lang.String</env-entry-type>
    <env-entry-value>jdbc:mysql://localhost:3306/TITINE?user=Solar;password=Sun</env-entry-value>
    </env-entry>
    <env-entry>
    <env-entry-name>dbUserName</env-entry-name>
    <env-entry-type>java.lang.String</env-entry-type>
    <env-entry-value>Solar</env-entry-value>
    </env-entry>
    <env-entry>
    <env-entry-name>dbPassword</env-entry-name>
    <env-entry-type>java.lang.String</env-entry-type>
    <env-entry-value>Sun</env-entry-value>
    </env-entry>
    </entity>
    </enterprise-beans>
    </ejb-jar>


  • Mark E Hansen wrote:
    This is for MySQL Connector-J JDBC Driver version 5.1.10. Your JDBC driver may require a different format. The documentation for your driver should describe this. Note that if you're not using the datasource in your case (because you're creating a connection to the database using the environment entries, etc.), then the datasource descriptor doesn't matter, as it's not being used.



    as emphasized above, ferreted for that ‘twas like:


  • "jdbc:mysql://localhost/test?user=blah&password=blah");


  • so I supposed to make it alike:


  • mysql-ds.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'>
    <!-- $Id: mysql-ds.xml,v 1.1.2.1 2003/12/12 19:19:56 starksm Exp $ -->
    <!-- Datasource config for MySQL using 3.0.9 available from:
    http://www.mysql.com/downloads/api-jdbc-stable.html
    -->

    <datasources>
    <local-tx-datasource>
    <jndi-name>dbUrl</jndi-name>
    <connection-url>jdbc:mysql://localhost:3306/TITINE?user=Solar;password=Sun</connection-url>
    <driver-class>com.mysql.jdbc.Driver</driver-class>
    <user-name>Solar</user-name>
    <password>Sun</password>
    </local-tx-datasource>
    </datasources>



  • Mark E Hansen wrote:
    ...



    after tracing the JBoss log, I knew where I’m hitting this error, it’s not from first try-catch at ProductionBean, this is exactly related to the second try-catch, and it’s:




    ...
    eploy/Product.jar
    08:56:59,031 INFO [STDOUT] setEntityContext
    08:56:59,031 INFO [STDOUT] ejbCreate
    08:56:59,031 INFO [STDOUT] try1 {... =========dbUrl = jdbc:mysql://localhost:33
    06/TITINE?user=Solar;password=Sun, userName = Solar, and password = Sun ...}
    08:56:59,031 INFO [STDOUT] catch2 {... ========dbUrl = jdbc:mysql://localhost:3
    306/TITINE?user=Solar;password=Sun, userName = Solar, and password = Sun ...}
    08:56:59,031 INFO [STDOUT] java.sql.SQLException: No suitable driver found for
    jdbc:mysql://localhost:3306/TITINE?user=Solar;password=Sun
    08:56:59,031 ERROR [LogInterceptor] EJBException, causedBy:
    java.lang.NullPointerException
    at BMPEBean.ProductBean.ejbCreate(ProductBean.java:59)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.jboss.ejb.plugins.BMPPersistenceManager.createEntity(BMPPersisten
    ceManager.java:189)
    at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.crea
    teEntity(CachedConnectionInterceptor.java:269)
    ...


    i mean:

    08:56:59,031 INFO [STDOUT] try1 {... =========dbUrl = jdbc:mysql://localhost:33
    06/TITINE?user=Solar;password=Sun, userName = Solar, and password = Sun ...}
    08:56:59,031 INFO [STDOUT] catch2 {... ========dbUrl = jdbc:mysql://localhost:3
    306/TITINE?user=Solar;password=Sun, userName = Solar, and password = Sun ...}
    08:56:59,031 INFO [STDOUT] java.sql.SQLException: No suitable driver found for
    jdbc:mysql://localhost:3306/TITINE?user=Solar;password=Sun
    08:56:59,031 ERROR [LogInterceptor] EJBException, causedBy:
    java.lang.NullPointerException
    at BMPEBean.ProductBean.ejbCreate(ProductBean.java:59)


    and before running Client application, Jboss is


    tarting connectors
    08:59:24,875 INFO [Http11Protocol] Starting Coyote HTTP/1.1 on http-0.0.0.0-808
    0
    08:59:24,921 INFO [ChannelSocket] Port busy 8009 java.net.BindException: Addres
    s already in use: JVM_Bind
    08:59:24,921 INFO [ChannelSocket] JK2: ajp13 listening on /0.0.0.0:8010
    08:59:24,921 INFO [JkMain] Jk running ID=1 time=0/15 config=null



    Coping sql-ds.xml to Jboss:


    08:59:45,593 INFO [dbUrl] Bound connection factory for resource adapter for Con
    nectionManager 'jboss.jca:service=LocalTxCM,name=dbUrl to JNDI name 'java:/dbUrl
    '


    and Product.jar, then 'ts:


    08:59:50,687 INFO [EjbModule] Deploying JNDIProduct
    08:59:50,765 INFO [EJBDeployer] Deployed: file:/D:/jboss-3.2.5/server/default/d
    eploy/Product.jar

     
    Mark E Hansen
    Ranch Hand
    Posts: 650
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    I'm glad you found the source of the "cannot find the file" message.
    However, if you just place the Jar in the correct location (in the application server's lib directory) or add it to the classpath used by the application server (by updating the script used to start the server - usually run.bat), then you don't need to copy the file each time you start the server.

    To find the database, you don't need the environment entries for dbUrl, dbUserName and dbPassword. Instead, just deploy the mysql-ds.xml datasource, and look up the connection from the JNDI namespace.

    As for the datasource url, you don't need to provide the user name and password as parameters in the url if you include the user-name and password XML elements. I don't know what will happen if you use both as I've never done that.

    I think you should not use the environment.lookup(...) to get the environment entries and create the database connection using DriverManager. Instead, I think you should just lookup the datasource deployed on the application server (deployed in mysql-ds.xml) and use that directly. Then you don't need to include the environment entries in the ejb-jar.xml.

    On to the error you're getting: No suitable driver found for jdbc:mysql://localhost:3306/TITINE?user=Solar;password=Sun

    It seems one of two things are happening:

    1. The application server cannot find the Driver class, possibly because the correct Jar file is not on the application server's classpath.

    2. The URL is not appropriate for the Driver class. You would have to look at the documentation for your specific driver class and verify that the URL you're providing is correct.

    My guess is that the problem is that the correct Jar is not on the server's classpath.

     
    A. S. Georgie
    Ranch Hand
    Posts: 72
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Mark E Hansen wrote:I'm glad you found the source of the "cannot find the file" message.
    However, if you just place the Jar in the correct location (in the application server's lib directory) or add it to the classpath used by the application server (by updating the script used to start the server - usually run.bat), then you don't need to copy the file each time you start the server.



    so my next would resemble that way ...

    Mark E Hansen wrote:
    To find the database, you don't need the environment entries for dbUrl, dbUserName and dbPassword. Instead, just deploy the mysql-ds.xml datasource, and look up the connection from the JNDI namespace.



    actually, i just wanned to do the same but Jboss just looks the around ejb-jar.xml and about mysql-ds.xml it just adds these lines:


    07:09:33,968 INFO [dbUrl] Bound connection factory for resource adapter for Con
    nectionManager 'jboss.jca:service=LocalTxCM,name=dbUrl to JNDI name 'java:/dbUrl
    '


    but for dbUrl, ... looks in ejb-jar.xml ???

    Mark E Hansen wrote:
    As for the datasource url, you don't need to provide the user name and password as parameters in the url if you include the user-name and password XML elements. I don't know what will happen if you use both as I've never done that.



    i checked this too, it's yes allrigh' ...

    Mark E Hansen wrote:
    I think you should not use the environment.lookup(...) to get the environment entries and create the database connection using DriverManager. Instead, I think you should just lookup the datasource deployed on the application server (deployed in mysql-ds.xml) and use that directly. Then you don't need to include the environment entries in the ejb-jar.xml.

    On to the error you're getting: No suitable driver found for jdbc:mysql://localhost:3306/TITINE?user=Solar;password=Sun

    It seems one of two things are happening:

    1. The application server cannot find the Driver class, possibly because the correct Jar file is not on the application server's classpath.

    2. The URL is not appropriate for the Driver class. You would have to look at the documentation for your specific driver class and verify that the URL you're providing is correct.

    My guess is that the problem is that the correct Jar is not on the server's classpath.



    then i just try infinite drivers to find out this ...


    Dear Mark, after all, i need to thank you and i won't forget this meeting, just b' glad is not the only i got to say, i have a craving, just now and then, "somewhere, someday see thee with thy incredible java books to happen ..."

    BEST BEST REGARDS ...
    Jan-2010
     
    Mark E Hansen
    Ranch Hand
    Posts: 650
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    A. S. Georgie wrote:
    actually, i just wanned to do the same but Jboss just looks the around ejb-jar.xml and about mysql-ds.xml it just adds these lines:


    07:09:33,968 INFO [dbUrl] Bound connection factory for resource adapter for Con
    nectionManager 'jboss.jca:service=LocalTxCM,name=dbUrl to JNDI name 'java:/dbUrl
    '


    but for dbUrl, ... looks in ejb-jar.xml ???



    The above output is JBoss deploying the datasource (mysql-ds.xml). It has nothing to do with the environment entries you've added to the ejb-jar.xml file. In fact, your Bean code is the only thing (that we've seen so far) which is using those environment entries. Like I said before, you can just remove those environment entries, and in your Bean code just do a look-up of the Datasource, rather than using the environment entries to create a DriverManager.

    A. S. Georgie wrote:
    then i just try infinite drivers to find out this ...



    I'm not sure what you mean here.

    If your database is MySQL, then I'm not sure why you wouldn't use their most current driver. If someone else recommended a different drive, throw that away and get the driver provided by the MySQL folks. It's their database. If you feel you need to use a different driver, can you please explain why?

    In a previous post, I posted a link to the MySQL site where you can download the Connect-J driver, version 5.1.10. Get that and follow it's instructions for installation and configuration - I can help with that if you need it. It's pretty simple. Once that is done correctly, it should resolve the "No suitable driver" error you're getting - which I think is your only remaining problem.

    Best Regards,
     
    A. S. Georgie
    Ranch Hand
    Posts: 72
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Mark E Hansen wrote:
    The above output is JBoss deploying the datasource (mysql-ds.xml). It has nothing to do with the environment entries you've added to the ejb-jar.xml file. In fact, your Bean code is the only thing (that we've seen so far) which is using those environment entries. Like I said before, you can just remove those environment entries, and in your Bean code just do a look-up of the Datasource, rather than using the environment entries to create a DriverManager.



    well, then the only thing remained i must change it ...

    Mark E Hansen wrote:
    I'm not sure what you mean here.



    tell you the truth, it was for that to fix this thing no suitable driver ... i need to chase a long tale of checking and getting rid of prior story ... but i don really don't need this ...

    Mark E Hansen wrote:
    If your database is MySQL, then I'm not sure why you wouldn't use their most current driver. If someone else recommended a different drive, throw that away and get the driver provided by the MySQL folks. It's their database. If you feel you need to use a different driver, can you please explain why?

    In a previous post, I posted a link to the MySQL site where you can download the Connect-J driver, version 5.1.10. Get that and follow it's instructions for installation and configuration - I can help with that if you need it. It's pretty simple. Once that is done correctly, it should resolve the "No suitable driver" error you're getting - which I think is your only remaining problem.



    well, actually, yes you proposed it the most reliable url for that Driver, you know i really wanna work with SQL Server this Mysql was just to see how it works ... actually i found the most Driver site here maybe you wanna check it out .... http://sourceforge.net/projects/ not that i'm that expert On SQL Server but my destiny is Oracle definitely for that i need to step o n ...

    also, it's about time for my other practice then just just now au revoir ...
     
    Mark E Hansen
    Ranch Hand
    Posts: 650
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Well, if you want to use SQL Server, the driver I've had the most luck with is the jTDS driver, which you can find here: http://jtds.sourceforge.net/

    Good luck with your project.
     
    A. S. Georgie
    Ranch Hand
    Posts: 72
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Mark E Hansen wrote:Well, if you want to use SQL Server, the driver I've had the most luck with is the jTDS driver, which you can find here: http://jtds.sourceforge.net/

    Good luck with your project.



    Man you are amazing, making me know you deep, next time if it's not bothering thing, next time i'll ask about merely thyself, you know, this work of you is kinka thing makeing me just smile deep, there is no definition about smile, but if someone could it woulda been smile, thank you about that site, my very dear friend ..., you got a one of the great heart of being ...
     
    Forget Steve. Look at this tiny ad:
    a bit of art, as a gift, the permaculture playing cards
    https://gardener-gift.com
    reply
      Bookmark Topic Watch Topic
    • New Topic