[JNDI/Naming/Network] - Re: Dtabase connection Error(Mysql)
by pepelara
I have set up MySQL as default DataSource (DefaultDS). You can try it.
I think this is not the question because I guess you are on a BMP Ejb.
Anyway, what version are you using? I am using 4.2.2 GA and I have no
any jboss-ds.xml. Can you tell me if it is a BMP and the version of your JBoss.
By the way, I am observing your code,
private CustomerFacadeRemote lookupCustomerFacadeBean() {
try {
return ((ejb.CustomerFacadeRemoteHome) getServiceLocator().getRemoteHome("java:comp/env/CustomerFacadeBean", ejb.CustomerFacadeRemoteHome.class)).create();
Try to simplify. This is my client to call to the EJB,
Properties properties = new Properties();
| properties.put(Context.INITIAL_CONTEXT_FACTORY,
| "org.jnp.interfaces.NamingContextFactory");
| properties.put(Context.PROVIDER_URL, "localhost:1099");
|
| try {
| // Get an initial context
| InitialContext jndiContext = new InitialContext(properties);
| System.out.println("Got context");
|
| // Get a reference to the Bean
| Object ref = jndiContext.lookup("BMPBooks");
| System.out.println("Got reference");
| // Get a reference from this to the Bean's Home interface
| BooksHomeRemote home = (BooksHomeRemote)
| PortableRemoteObject.narrow(ref, BooksHomeRemote.class);
|
And now I can create the bean (home.create(...))
I give you the descriptors,
The ejb-jar.xml,
| <?xml version="1.0" encoding="UTF-8"?>
| <ejb-jar id="ejb-jar_ID" version="2.1" xmlns="http://java.sun.com/xml/ns/j2ee"
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd">
| <description>Your first EJB application </description>
| <display-name>Bookstore Application</display-name>
| <enterprise-beans>
| <entity>
| <ejb-name>BMPBooks</ejb-name>
| <home>es.deusto.ejb.BooksHomeRemote</home>
| <remote>es.deusto.ejb.BooksRemote</remote>
| <ejb-class>es.deusto.ejb.BooksBean</ejb-class>
| <persistence-type>Bean</persistence-type>
| <prim-key-class>java.lang.Integer</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/myDB</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>myDbUser</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>myDbPassword</env-entry-value>
| </env-entry>
| </entity>
| </enterprise-beans>
| </ejb-jar>
|
And the application.xml,
| <?xml version="1.0" encoding="UTF-8"?>
| <application xmlns="http://java.sun.com/xml/ns/j2ee" version="1.4"
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xsi:schemaLocation="http://java.sun.com /xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application_1_4.xsd">
| <display-name>MyBookstore</display-name>
| <description>Application description</description>
| <module>
| <ejb>bookstore-ejb.jar</ejb>
| </module>
| <module>
| <java>bookstore-client.jar</java>
| </module>
| </application>
|
I hope it help you
Regarding,
Jose Alvarez de Lara
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4153147#4153147
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4153147
17 years, 11 months
[Management, JMX/JBoss] - Re: 4.2.2 GA: service=JNDIView call causes NPE
by jaikiran
"J-Pro" wrote :
| "jaikiran" wrote : How did you install JBoss-4.2.2 GA? Was it through the JEMS installer or did you use the zip archive?
| I just downloaded zip-archive and extracted it at C:\Java\jboss-4.2.2.GA.
|
That should be good, because there have been some issues reported when JEMS installer was used.
"J-Pro" wrote :
| "jaikiran" wrote : Have you modified anything in the server after installing JBoss?
| Yes:
| 1. Updated JSF version to 1.2_07
| 2. Added 2 datasources in one file: mssql-ds.xml
| 3. Added sqljdbc.jar and sqljdbc_auth.dll in server\default\lib\
| 4. Deployed my app.
| 5. One more difference in clean server zip and my server dir which I don't know(maybe it's some working files like in tmp and work dirs?): http://img81.imageshack.us/my.php?image=jbrl0.png
|
|
#2 and #3 dont seem to be a problem (though i am not sure why the sqljdbc_auth.dll is required). However, i would revert back #1. More so because the exception that you posted, does show something related to JSF. How exactly did you update the JSF version? Which all files did you change and where?
"J-Pro" wrote :
| "jaikiran" wrote : Which version of Java is being used and which operating system?
| I use jre1.6.0_05, but in MyEclipse(from where I run my JBoss) I use jdk1.6.0_01.
| System: Windows XP SP2 x86
|
| "jaikiran" wrote : When JBoss is starting, you will see the Java version being printed out, post it here.
|
| 22:04:37,359 INFO [ServerInfo] Java version: 1.6.0_01,Sun Microsystems Inc.
| 22:04:37,359 INFO [ServerInfo] Java VM: Java HotSpot(TM) Client VM 1.6.0_01-b06,Sun Microsystems Inc.
| 22:04:37,359 INFO [ServerInfo] OS-System: Windows XP 5.1,x86
|
JBoss-4.2.x is not yet certified to run with Java 1.6. Use Java 1.5 instead.
Undo the changes to the JSF jars and use Java 1.5 and try accessing the JNDIView. See if it works. Post back with details, if it doesn't.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4153133#4153133
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4153133
17 years, 11 months