[Beginners Corner] - Re: JNDI, JDBC & Simple Application
by weston.price@jboss.com
A few things:
1) A DataSource does not require a PortableRemoteObject.narrow(). This is typically used for EJB resources running outside of the container (ie thin client).
The real question you are facing is the 'location' of the DataaSource. Code running within the application server can simply access the DataSource as follows:
|
| InitialContext jndiContext = new InitialContext();
| DataSource ds = (DataSource)jndiContext.lookup("java:DSName");
|
|
Note, it's better to use a resource-ref but that is for another discussion :-)
Code, running outside of JBoss wanting to access a DataSource needs to add the following element to the *-ds.xml file
| <use-java-context>false</use-java-context>
|
At this point you can access the DataSource remotely be executing
|
| InitialContext jndiContext = new InitialContext();
| DataSource ds = (DataSource)jndiContext.lookup("DSName");
|
|
Note the difference in the JNDI name. Remote DataSource access uses the Global JNDI namespace, not the ENC namespace reserved for J2EE application components.
A *BIG* word of caution here. DataSources are typicall not meant to be used outside of an application server. Testing simply JDBC interactions is fine but you are strongly, strongly, strongly encouraged not to do this in production environment. More on this can be found here:
http://wiki.jboss.org/wiki/Wiki.jsp?page=ConfigDataSources
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4038338#4038338
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4038338
19 years, 2 months
[Beginners Corner] - Re: Where do external jar files go in the ear?
by weston.price@jboss.com
anonymous wrote :
| AFAIK there is no automatic inclusion of jar files in an EAR. You can define them in application.web:
| Code:
|
|
| myjar.jar
|
|
|
| And you place it in the root dir. of the EAR.
|
|
Not a good idea. The element is to be used for J2EE application clients and should not be used as a method for deploying third party/utility jars.
The correct way to do this is to define a Classpath entry in the MANIFEST.MF file of each J2EE module (ie EJB jar file/WAR file).
Example MANIFEST.MF
|
| Class-Path: jar1.jar jar2.jar
|
|
Note the path itself is relative to the root of the archive. So, for instance assuming you had an EAR structure such as
| EAR
| -->lib
| jar1.jar
| jar2.jar
|
|
Your MANIFEST.MF should look as follows:
|
| Class-Path: lib/jar1.jar lib/jar2.jar
|
|
Again, an entry like the one above should be placed in the MANIFEST.MF file of *each* J2EE module deployed inside your EAR file.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4038334#4038334
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4038334
19 years, 2 months
[JBoss jBPM] - Problem regarding fork
by bcgiuser
Sorry the code is not being posted proeprly, posting again.
|
| <?xml version="1.0" encoding="UTF-8"?>
| <process-definition
| xmlns="urn:jbpm.org:jpdl-3.1" name="simple_workflow">
| <start-state name="start">
| <transition name="forkTransition" to="fork1"></transition>
| </start-state>
| <end-state name="End"></end-state>
| <fork name="fork1">
| <transition name="test1" to="InvokeTest1"></transition>
| <transition name="test2" to="InvokeTest2"></transition>
| </fork>
| <node name="InvokeTest1">
| <action class="net.bcgi.Test1"></action>
| <transition name="" to="join1"></transition>
| </node>
| <node name="InvokeTest2">
| <action class="net.bcgi.Test2"></action>
| <transition name="" to="join1"></transition>
| </node>
| <join name="join1">
| <transition name="" to="End"></transition>
| </join>
| </process-definition>
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4038331#4038331
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4038331
19 years, 2 months