wood burning stoves 2.0*
The moose likes JBoss/WildFly and the fly likes Change DefaultDS in JNDI Name Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Change DefaultDS in JNDI Name" Watch "Change DefaultDS in JNDI Name" New topic
Author

Change DefaultDS in JNDI Name

dinesh thalis
Ranch Hand

Joined: Nov 19, 2008
Posts: 39
I developed simple EJB application, in that application I used Jndi-name as DefaultDS It worked perfeclty no exceptions and data goto database now I want to change Default jndi-name to another name like (mySource) if i change it to mySource i got exceptions. below show technologies I used .

EJB3, Netbeans 6.9 IDE, Mysql 5.1, Jboss 5.1 and Ubuntu 9.1

I copy mysql-connector to jboss-5.1.0.GA/server/default/lib this folder, and remove -ds.xml files in jboss-5.1.0.GA/server/default/deploy and put mysql-ds.xml to it.


Here it contain mysql-ds.xml

<datasources>
<local-tx-datasource>
<jndi-name>mySource</jndi-name>
<use-java-context>false</use-java-context>
<connection-url>jdbc:mysql://192.168.1.3:3306/Man</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<user-name>ubuntu</user-name>
<password>rahasak</password>
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
<!-- should only be used on drivers after 3.22.1 with "ping" support
<valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLValidConnectionChecker</valid-connection-checker-class-name>
-->
<!-- sql to call when connection is created
<new-connection-sql>some arbitrary sql</new-connection-sql>
-->
<!-- sql to call on an existing pooled connection when it is obtained from pool - MySQLValidConnectionChecker is preferred for newer drivers
<check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>
-->

<!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
<metadata>
<type-mapping>mySQL</type-mapping>
</metadata>
</local-tx-datasource>
</datasources>



persistent.xml

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="JbossExample-ejbPU" transaction-type="JTA">
<provider>oracle.toplink.essentials.PersistenceProvider</provider>
<jta-data-source>java:/mySource</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties/>
</persistence-unit>
</persistence>


Below Show Errors I got



14:43:38,108 INFO [Ejb3DependenciesDeployer] Encountered deployment AbstractVFSDeploymentContext@13658395{vfszip:/home/dinesh/jboss-5.1.0.GA/server/default/deploy/JbossExample.ear/JbossExample-ejb.jar/}
14:43:38,108 INFO [Ejb3DependenciesDeployer] Encountered deployment AbstractVFSDeploymentContext@13658395{vfszip:/home/dinesh/jboss-5.1.0.GA/server/default/deploy/JbossExample.ear/JbossExample-ejb.jar/}
14:43:38,108 INFO [Ejb3DependenciesDeployer] Encountered deployment AbstractVFSDeploymentContext@13658395{vfszip:/home/dinesh/jboss-5.1.0.GA/server/default/deploy/JbossExample.ear/JbossExample-ejb.jar/}
14:43:38,108 INFO [Ejb3DependenciesDeployer] Encountered deployment AbstractVFSDeploymentContext@13658395{vfszip:/home/dinesh/jboss-5.1.0.GA/server/default/deploy/JbossExample.ear/JbossExample-ejb.jar/}
14:43:38,537 INFO [JBossASKernel] Created KernelDeployment for: JbossExample-ejb.jar
14:43:38,545 INFO [JBossASKernel] installing bean: jboss.j2ee:ear=JbossExample.ear,jar=JbossExample-ejb.jar,name=ChildFacade,service=EJB3
14:43:38,545 INFO [JBossASKernel] with dependencies:
14:43:38,545 INFO [JBossASKernel] and demands:
14:43:38,545 INFO [JBossASKernel] persistence.unit:unitName=JbossExample.ear/JbossExample-ejb.jar#JbossExample-ejbPU
14:43:38,545 INFO [JBossASKernel] jboss.ejb:service=EJBTimerService
14:43:38,545 INFO [JBossASKernel] and supplies:
14:43:38,545 INFO [JBossASKernel] jndi:JbossExample/ChildFacade/remote-Session.ChildFacadeRemote
14:43:38,545 INFO [JBossASKernel] Class:Session.ChildFacadeRemote
14:43:38,545 INFO [JBossASKernel] jndi:JbossExample/ChildFacade/remote
14:43:38,545 INFO [JBossASKernel] Added bean(jboss.j2ee:ear=JbossExample.ear,jar=JbossExample-ejb.jar,name=ChildFacade,service=EJB3) to KernelDeployment of: JbossExample-ejb.jar
14:43:38,966 INFO [EJB3EndpointDeployer] Deploy AbstractBeanMetaData@9e3acc{name=jboss.j2ee:ear=JbossExample.ear,jar=JbossExample-ejb.jar,name=ChildFacade,service=EJB3_endpoint bean=org.jboss.ejb3.endpoint.deployers.impl.EndpointImpl properties=[container] constructor=null autowireCandidate=true}
14:43:38,973 INFO [PersistenceUnitDeployment] Starting persistence unit persistence.unit:unitName=JbossExample.ear/JbossExample-ejb.jar#JbossExample-ejbPU
14:43:38,974 ERROR [AbstractKernelController] Error installing to Start: name=persistence.unit:unitName=JbossExample.ear/JbossExample-ejb.jar#JbossExample-ejbPU state=Create
javax.naming.NameNotFoundException: mySource not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:771)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:779)
at org.jnp.server.NamingServer.getObject(NamingServer.java:785)
at org.jnp.server.NamingServer.lookup(NamingServer.java:443)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:726)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:686)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at org.jboss.jpa.deployment.PersistenceUnitInfoImpl.<init>(PersistenceUnitInfoImpl.java:111)
at org.jboss.jpa.deployment.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:275)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:59)
at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:150)
at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66)
at org.jboss.kernel.plugins.dependency.KernelControllerContextAction$JoinpointDispatchWrapper.execute(KernelControllerContextAction.java:241)
at org.jboss.kernel.plugins.dependency.ExecutionWrapper.execute(ExecutionWrapper.java:47)
at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchExecutionWrapper(KernelControllerContextAction.java:109)
at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(KernelControllerContextAction.java:70)
at org.jboss.kernel.plugins.dependency.LifecycleAction.installActionInternal(LifecycleAction.java:221)
at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:54)
at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:42)
at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)
at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)
at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:774)
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:540)
at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:121)
at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:51)
at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62)
at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)
at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1439)
at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1157)
at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1178)
at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1210)
at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1098)
at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:781)
at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:702)
at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117)
at org.jboss.system.server.profileservice.hotdeploy.HDScanner.scan(HDScanner.java:362)
at org.jboss.system.server.profileservice.hotdeploy.HDScanner.run(HDScanner.java:255)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
14:43:39,007 INFO [TomcatDeployment] deploy, ctxPath=/JbossExample-war
14:43:39,059 WARN [HDScanner] Failed to process changes
org.jboss.deployers.client.spi.IncompleteDeploymentException: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):



DEPLOYMENTS MISSING DEPENDENCIES:
Deployment "jboss.j2ee:ear=JbossExample.ear,jar=JbossExample-ejb.jar,name=ChildFacade,service=EJB3" is missing the following dependencies:
Dependency "<UNKNOWN jboss.j2ee:ear=JbossExample.ear,jar=JbossExample-ejb.jar,name=ChildFacade,service=EJB3>" (should be in state "Described", but is actually in state "** UNRESOLVED Demands 'persistence.unit:unitName=JbossExample.ear/JbossExample-ejb.jar#JbossExample-ejbPU' **")
Dependency "<UNKNOWN jboss.j2ee:ear=JbossExample.ear,jar=JbossExample-ejb.jar,name=ChildFacade,service=EJB3>" (should be in state "Described", but is actually in state "** UNRESOLVED Demands 'jboss.ejb:service=EJBTimerService' **")
Deployment "jboss.j2ee:ear=JbossExample.ear,jar=JbossExample-ejb.jar,name=ChildFacade,service=EJB3_endpoint" is missing the following dependencies:
Dependency "jboss.j2ee:ear=JbossExample.ear,jar=JbossExample-ejb.jar,name=ChildFacade,service=EJB3" (should be in state "Configured", but is actually in state "PreInstall")



DEPLOYMENTS IN ERROR:
Deployment "persistence.unit:unitName=JbossExample.ear/JbossExample-ejb.jar#JbossExample-ejbPU" is in error due to the following reason(s): javax.naming.NameNotFoundException: mySource not bound
Deployment "<UNKNOWN jboss.j2ee:ear=JbossExample.ear,jar=JbossExample-ejb.jar,name=ChildFacade,service=EJB3>" is in error due to the following reason(s): ** UNRESOLVED Demands 'jboss.ejb:service=EJBTimerService' **, ** UNRESOLVED Demands 'persistence.unit:unitName=JbossExample.ear/JbossExample-ejb.jar#JbossExample-ejbPU' **



at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:993)
at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:939)
at org.jboss.deployers.plugins.main.MainDeployerImpl.checkComplete(MainDeployerImpl.java:873)
at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.checkComplete(MainDeployerAdapter.java:128)
at org.jboss.system.server.profileservice.hotdeploy.HDScanner.scan(HDScanner.java:369)
at org.jboss.system.server.profileservice.hotdeploy.HDScanner.run(HDScanner.java:255)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)


14:44:04,268 INFO [[/JbossExample-war]] Marking servlet addRecord as unavailable
14:44:04,268 ERROR [[addRecord]] Allocate exception for servlet addRecord
javax.naming.NameNotFoundException: JbossExample not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:771)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:779)
at org.jnp.server.NamingServer.getObject(NamingServer.java:785)
at org.jnp.server.NamingServer.lookup(NamingServer.java:396)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:726)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:686)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:1346)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:817)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:686)
at org.jboss.ejb3.JndiUtil.lookup(JndiUtil.java:44)
at org.jboss.injection.JndiPropertyInjector.lookup(JndiPropertyInjector.java:75)
at org.jboss.injection.JndiPropertyInjector.inject(JndiPropertyInjector.java:99)
at org.jboss.web.tomcat.service.TomcatInjectionContainer.processInjectors(TomcatInjectionContainer.java:366)
at org.jboss.web.tomcat.service.TomcatInjectionContainer.newInstance(TomcatInjectionContainer.java:271)
at org.jboss.web.tomcat.service.TomcatInjectionContainer.newInstance(TomcatInjectionContainer.java:265)
at org.jboss.web.tomcat.service.TomcatInjectionContainer.newInstance(TomcatInjectionContainer.java:256)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1006)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:777)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:129)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)


Please help me to do it. i suffered Internet but unable to solve the problem, Is their any other files should i changed in Joss to this? I'm waiting for you're precious reply's.


Thank You.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Change DefaultDS in JNDI Name
 
Similar Threads
Unable to deploy EJB application to JBoss when implementing persistence
JBOSS 5.0.1.ga problem with mysql-ds and deploying service=Queue and service="PostOffice"
Exception while deploying JPA Application
Error in Deployement of Ear File
"Failed to resolve schema nsURI= location=persistence" Issue...