EJB deployment descriptor
Hi
I have jusr started with the EJB. I am using JBoss Server.
I have a session bean and a MessageDrivenBean in the same package. Do I mention both of them in the same ejb-jar.xml file place inside the META-INF directory as follows:
<?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>
<display-name>AccountManager6JAR</display-name>
<enterprise-beans>
<session>
</session>
<message-driven>
</message-driven>
</enterprise-beans>
</ejb-jar>
I addition to the above I also have the jboss.xml file in META-INF directory as follows:
<?xml version="1.0"?>
<jboss>
<enterprise-beans>
<message-driven>
<res-ref-name>.....</res-ref-name>
<configuration-name>.....</configuration-name>
<jndi-name>.....</jndi-name>
</message-driven>
</enterprise-beans>
</jboss>
do I need to add an entry of the my message driven bean in the ejb-jar.xml file or having the jboss.xml file is sufficient??
Many thanks for the help!!
Well, the xml file for JBoss is specific to JBoss. Therefore you should refer to JBoss documentation for that. However, what I suggest is that you make a EAR file out of your jars and then deploy it. That should solve the problem, as EAR file is a standard.
Ironluca
Similar Messages
-
Weblogic EJB Deployment Descriptor
Hi,
Can someone help me in learning how to write weblogic specific deployment descriptors for EJBs ??? Where can I find good tutorial or help. I am new to EJB.
Thank you in advanceWhy not search http://bea.com and see what pops up. I searched their site for "EJB deployment descriptors" and got quite a few hits.
-
EJB deployment descriptors in clustered environment
I was wondering how EJB deployment descriptor settings work in a clustered environment. Are the deployment descriptors per WebLogic instance they are deployed in or the entire clustered environment? For example, if my descriptor for a stateless session ejb has max-beans-in-free-pool set to 5 and I deploy this stateless ejb in 4 WebLogic instances of one cluster, does this mean that there will be a max of 5 instance of this bean in the free pool for the entire cluster or will there be a max of 20 (5 per WebLogic instance and 4 WebLogic instances in the cluster) instances of this bean for the entire cluster?
Thanks,
Bryan
Those settings are per server instance.
Cameron Purdy
Tangosol, Inc.
http://www.tangosol.com
+1.617.623.5782
WebLogic Consulting Available
"Bryan Dixon" <[email protected]> wrote in message
news:3a6b51a0$[email protected]..
>
> I was wondering how EJB deployment descriptor settings work in a clustered
environment. Are the deployment descriptors per WebLogic instance they are
deployed in or the entire clustered environment? For example, if my
descriptor for a stateless session ejb has max-beans-in-free-pool set to 5
and I deploy this stateless ejb in 4 WebLogic instances of one cluster, does
this mean that there will be a max of 5 instance of this bean in the free
pool for the entire cluster or will there be a max of 20 (5 per WebLogic
instance and 4 WebLogic instances in the cluster) instances of this bean for
the entire cluster?
>
> Thanks,
> Bryan
>
-
EJB deployment descriptor vs. annotations
Hi,
I need some example of EJB deployment descriptor and matching Java code with annotations for my school project. In other words I need the same information in descriptor and in annotations. If anyone would provide me with some simple sample, I would be very thankful.
MilanThis shows an ejb-jar.xml file. At the bottom it breaks down what each section does and what annotation it refers to, should be straight forward to create some code snippets from it...
[http://docs.jboss.com/ejb3/app-server/reference/build/reference/en/html/partial_deployment_descriptors.html|http://docs.jboss.com/ejb3/app-server/reference/build/reference/en/html/partial_deployment_descriptors.html]
n -
Weblogic vendor specific EJB deployment descriptor
Hi All,
I have been trying to get weblogic-ejb.xml working to provide the names where I want my EJB3 beans accessable in JNDI, but this has not been working for me.
I have been looking through the web - there are not too many mentions of the deployment descriptor. If there any tutorials or official documents from BEA on this, links would be highliy appreciated.
I am using WL10_01 if it helps.
Thanks,
Kirill.Did you try <business-interface-jndi-name-map> tag in weblogic-ejb-jar.xml?
With the following example setup, you should be able to look up the Session bean that implements service.JPAService interface in JNDI tree with "JPAService".
<weblogic-enterprise-bean>
<ejb-name>JPAServiceBean</ejb-name>
<stateless-session-descriptor>
<business-interface-jndi-name-map>
<business-remote>service.JPAService</business-remote>
<jndi-name>JPAService</jndi-name>
</business-interface-jndi-name-map>
</stateless-session-descriptor>
<enable-call-by-reference>true</enable-call-by-reference>
</weblogic-enterprise-bean>
</weblogic-ejb-jar> -
About EJB deployment descriptor
Hello. I am developing EJB3 with glassfish and weblogic 10. I know I can use annotations to simplify
deployment without using ejb-jar.xml , sun-ejb-jar.xml, weblogic-ejb-jar.xml. However, I do want to know
how to write these files correctly because they have higher priority when used.
Somebody may give me a template about writing these files? (ejb 3 specification, for ejb2, I can
use xdoclet to generate them).Thanks a lot.Hi Martin,
you're are right, XDoclet support for OC4J is lacking the most important stuff. In my case I needed explicit mapping of CMR-fields. Of course, manually editing orion-ejb-jar.xml either by using a text editor or JDeveloper is no option at all.
So I've added support for explicit CMR-mapping to the OC4J XDoclet templates. It works but wasn't fun to do as Oracle's documentation of CMR-mapping is highly inconsistent (e.g. text, figures, and example code are not in sync).
As I've done this as part of a services contract, I cannot easily publish the results. I'll ask my client and let you know.
Anyway, orion-ejb-jar.xml will be obsolete by default in OC4J 10.x as Oracle switches to Toplink as the default persistence manager. So again, XDoclet support is needed for generating the Toplink-specific deployment descriptor.
I'd really appreciate Oracle to provide OC4J-specific XDoclet enhancements. This would help OC4J in gaining wider acceptance.
Stefan -
EJB Deployment Descriptors not deploying to WLS
Hi,
We're using Eclipse 3.4.1 with the OEPE to target WLS 10.3 with Java 6/JEE 1.4 on a Windows XP Professional development machine.
We have an EJB 2.1 project as part of a larger EAR. The beans (all stateless session beans) and associated interfaces and deployment descriptors within are maintained manually for internal reasons; we do not rely on EJBGen or XDoclet or anything like that to manage these. We are NOT using any annotations in these EJBs, as is the default when you create a bean. Instead we rely on weblogic-ejb-jar.xml and ejb-jar.xml.
We're having an issue where deploying to the local Weblogic server instance fails with the following error displaying in the Eclipse console:
<Dec 19, 2008 9:21:13 AM CST> <Warning> <Deployer> <BEA-149004> <Failures were detected while initiating deploy task for application 'xxxxxxx'.>
<Dec 19, 2008 9:21:13 AM CST> <Warning> <Deployer> <BEA-149078> <Stack trace for message 149004
weblogic.application.ModuleException: Exception preparing module: EJBModule(xxxxxxxEJB.jar)
[EJB:011023]An error occurred while reading the deployment descriptor. The error was:
No EJBs found in the ejb-jar file {0}. Please ensure the ejb-jar contains EJB declarations via an ejb-jar.xml deployment descriptor or at least one class annotated with the @Stateless, @Stateful or @MessageDriven EJB annotation..
at weblogic.ejb.container.deployer.EJBModule.prepare(EJBModule.java:452)
at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:93)
at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:387)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)
at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:58)
Truncated. see log file for complete stacktrace
java.io.IOException: No EJBs found in the ejb-jar file {0}. Please ensure the ejb-jar contains EJB declarations via an ejb-jar.xml deployment descriptor or at least one class annotated with the @Stateless, @Stateful or @MessageDriven EJB annotation.
at weblogic.ejb.container.dd.xml.EjbDescriptorReaderImpl.createReadOnlyDescriptorFromJarFile(EjbDescriptorReaderImpl.java:199)
at weblogic.ejb.spi.EjbDescriptorFactory.createReadOnlyDescriptorFromJarFile(EjbDescriptorFactory.java:93)
at weblogic.ejb.container.deployer.EJBModule.loadEJBDescriptor(EJBModule.java:1198)
at weblogic.ejb.container.deployer.EJBModule.prepare(EJBModule.java:380)
at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:93)
Truncated. see log file for complete stacktrace
We DO have multiple beans defined, but it seems that WLS just isn't aware of them due to the lack of a deployment descriptor. It appears that Eclipse/OEPE is not copying the ejb-jar.xml and weblogic-ejb-jar.xml files to the build directory when the project is build:
xxxxxEJB
|-- ejbModule
|.....|-- META-INF
|.....|.....|-- ejb-jar.xml
|.....|.....|-- MANIFEST.MF
|.....|.....|-- weblogic-ejb-jar.xml
|.....|-- com (etc., .java files)
|-- build
......|-- classes
............|-- META-INF
............|......|-- MANIFEST.MF
............|-- com (etc, .class files)
Other notes:
- Cleaning the project does not help.
- Starting a new workspace does not help.
- It works under Eclipse 3.3.2 with the Europa version of OEPE.
- Explicitly exporting an EJB Jar file DOES include the two deployment descriptors (just not deploying to the embedded test server we've defined in our Servers view)
Any ideas? This seems like either a bug in the OEPE, or maybe WTP.Yes, I have a simple EJB2.1 project with hand-crafted EJB remote/home interfaces/classes and deployment descriptors. Also tried Clean/Rebuild and manually delete
files under /build/classes.
Here are my descriptors files:
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">
<display-name>TestEJB</display-name>
<enterprise-beans>
<session>
<display-name>HelloSessioin</display-name>
<ejb-name>HelloSession</ejb-name>
<home>sessions.HelloSessionHome</home>
<remote>sessions.HelloSession</remote>
<ejb-class>sessions.HelloSessionBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Bean</transaction-type>
<security-identity>
<use-caller-identity/>
</security-identity>
</session>
</enterprise-beans>
</ejb-jar>
weblogic-ejb-jar.xml
<?xml version="1.0" encoding="UTF-8"?>
<weblogic-ejb-jar
xmlns="http://www.bea.com/ns/weblogic/90" xmlns:j2ee="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/ns/weblogic/90 http://www.bea.com/ns/weblogic/90/weblogic-ejb-jar.xsd">
<weblogic-enterprise-bean>
<ejb-name>HelloSession</ejb-name>
<stateless-session-descriptor>
</stateless-session-descriptor>
<jndi-name>ejb.HelloSessionRemoteHome</jndi-name>
</weblogic-enterprise-bean>
</weblogic-ejb-jar>
Did you check if there is any error/warning in Error Log view? -
Does pass-by-value in an EJB deployment descriptor work in iAS 6.0 sp4?
I deployed an EJB into iAS 6.0 SP4 with pass-by-value session element set to true but the EJB is still passing by reference. Is this a known problem in SP4? I checked the session descriptor in kregedit for that EJB and I couldn't find any entry that relates to the pass-by-value element.
Please help.Hi Yudong,
Thanks for the info. Do you know if this is only specific to SP4? The problem seems to be present in SP3 as well.
Thanks -
Hello,
Is it possible to add specific attributs in addition of the existing tag for an ejb into the ejb_jar file?
thank u
adAccording to the Dtd for ejb-jar.xml the session & entity bean tags
do not have any attributes.
thanks,
Deepak -
ExportException+StubNotFoundException in Clustered EJB Deployment
Hi All,
I'm a Newbie to WebLogic and would appreciate help in solving my problem.
I am running WLS 5.1sp6 on NT4 and am trying to implement a two server cluster on one machine.
The cluster runs fine, but as soon as I try to deploy our EJBs in the cluster level properties file I get the exceptions listed in the attached log.
In a standalone environment the EJBs function flawlessly but not in a cluster.
Notice that the EJB is successfully deployed to the server but the exception crops up a little further down the track.
The only unusual thing about the environment I can think of is the WebLogic CLASSPATH is disabled.
The EJB deployment descriptor contains:
<clustering-descriptor>
<home-is-clusterable>True</home-is-clusterable>
<stateless-bean-is-clusterable>True</stateless-bean-is-clusterable>
</clustering-descriptor>
Any ideas?
Thanks in advance,
Andrew
[weblogic.log]
Hi all,
It seems it was a classpath problem ...I put the ejb jar file in the java classpath and now it works like a charm.
Thanks for the tip Chris!
Andrew
"Chris Jones" <[email protected]> wrote:
>
>Hi,
>
>Sounds like a classpath problem. The cluster is trying to instantiate the EJB but the stub is not in the weblogicclasspath. I’m not sure what you mean when you say it is disabled.
>
>Hope this helps,
>
>Chris
>
>"Andrew Quinan" <[email protected]> wrote:
>>
>>
>>
>>Hi All,
>>
>>I'm a Newbie to WebLogic and would appreciate help in solving my problem.
>>
>>I am running WLS 5.1sp6 on NT4 and am trying to implement a two server cluster on one machine.
>>
>>The cluster runs fine, but as soon as I try to deploy our EJBs in the cluster level properties file I get the exceptions listed in the attached log.
>>
>>In a standalone environment the EJBs function flawlessly but not in a cluster.
>>Notice that the EJB is successfully deployed to the server but the exception crops up a little further down the track.
>>
>>The only unusual thing about the environment I can think of is the WebLogic CLASSPATH is disabled.
>>
>>The EJB deployment descriptor contains:
>><clustering-descriptor>
>> <home-is-clusterable>True</home-is-clusterable>
>> <stateless-bean-is-clusterable>True</stateless-bean-is-clusterable>
>></clustering-descriptor>
>>
>>Any ideas?
>>
>>Thanks in advance,
>>Andrew
>
-
Deployment descriptor error for an EJB 3.0 entity bean module
Hi all,
i'm facing an error deploying an EJB 3.0 entity bean module wrapped in an enterprise application on WebLogic 10.
The application is composed as follows:
WASEnterprise.ear
|-META-INF
|-application.xml
|-WAS.jar
|-META-INF
|-persistence.xml
In other words the application server is unable to load persistence.xml deployment descriptor and,during deployment, it throws an error message like this:
<Error> <J2EE> <BEA-160197> <Unable to load descriptor C:\bea\user_projects\domains\base_domain\autodeploy\WASEnterprise\WAS/META-INF/persistence.xml of module WAS. The error is weblogic.descriptor.DescriptorException: Unmarshaller failed
I suppose that the persistence.xml is correct since i can deploy the application on jboss without any problem.
The persistence.xml deployment descriptor is:
<?xml version="1.0" encoding="UTF-8"?>
<persistence>
<persistence-unit name="CNT4">
<non-jta-data-source>cnt5ds</non-jta-data-source>
<class>it.eni.italgas.was.db.entity.AsiDisco</class>
<class>it.eni.italgas.was.db.entity.AsiErrori</class>
<class>it.eni.italgas.was.db.entity.WasAsiRouting</class>
<class>it.eni.italgas.was.db.entity.WasAsiRoutingId</class>
<class>it.eni.italgas.was.db.entity.WasAsiSchemas</class>
</persistence-unit>
</persistence>
and the application.xml deployment descriptor is:
<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="5" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd">
<display-name>WASEnterprise</display-name>
<module id="myeclipse.1188512259959">
<ejb>WAS.jar</ejb>
</module>
</application>
I don't use any other weblogic specific deployment descriptor.
Have you ever experienced such a strange behaviour? Can you suggest something to solve the problem?
Thanks inadvance.
Denis MaggiorottoHi all,
i'm facing an error deploying an EJB 3.0 entity bean module wrapped in an enterprise application on WebLogic 10.
The application is composed as follows:
WASEnterprise.ear
|-META-INF
|-application.xml
|-WAS.jar
|-META-INF
|-persistence.xml
In other words the application server is unable to load persistence.xml deployment descriptor and,during deployment, it throws an error message like this:
<Error> <J2EE> <BEA-160197> <Unable to load descriptor C:\bea\user_projects\domains\base_domain\autodeploy\WASEnterprise\WAS/META-INF/persistence.xml of module WAS. The error is weblogic.descriptor.DescriptorException: Unmarshaller failed
I suppose that the persistence.xml is correct since i can deploy the application on jboss without any problem.
The persistence.xml deployment descriptor is:
<?xml version="1.0" encoding="UTF-8"?>
<persistence>
<persistence-unit name="CNT4">
<non-jta-data-source>cnt5ds</non-jta-data-source>
<class>it.eni.italgas.was.db.entity.AsiDisco</class>
<class>it.eni.italgas.was.db.entity.AsiErrori</class>
<class>it.eni.italgas.was.db.entity.WasAsiRouting</class>
<class>it.eni.italgas.was.db.entity.WasAsiRoutingId</class>
<class>it.eni.italgas.was.db.entity.WasAsiSchemas</class>
</persistence-unit>
</persistence>
and the application.xml deployment descriptor is:
<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="5" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd">
<display-name>WASEnterprise</display-name>
<module id="myeclipse.1188512259959">
<ejb>WAS.jar</ejb>
</module>
</application>
I don't use any other weblogic specific deployment descriptor.
Have you ever experienced such a strange behaviour? Can you suggest something to solve the problem?
Thanks inadvance.
Denis Maggiorotto -
The DOCTYPE declaration in the ejb-jar.xml deployment descriptor is missing
Hello,
I want to create web service from ejb but everytime I want to do it, I get the following error:
I'm using NWDS 7.2 and JDK 1.6
[004]Deployment aborted
Settings
SDM host : XXX
SDM port : 50118
URL to deploy : file:/C:/DOCUME1/XXXX/LOCALS1/Temp/temp3760382784932063822XXXWSProjectEar.ear
Result
=> deployment aborted : file:/C:/DOCUME1/XXX/LOCALS1/Temp/temp3760382784932063822XXX/WSProjectEar.ear
Aborted: development component 'XXXWSProjectEar'/'sap.com'/'localhost'/'2011.01.06.15.48.31'/'0':
Caught exception during application deployment from SAP J2EE Engine's deploy service:
java.rmi.RemoteException: Cannot deploy application sap.com/XXXWSProjectEar.. Reason: The DOCTYPE declaration in the ejb-jar.xml deployment descriptor is missing. ; nested exception is: com.sap.engine.services.ejb.exceptions.deployment.EJBXMLParserException: The DOCTYPE declaration in the ejb-jar.xml deployment descriptor is missing.
(message ID: com.sap.sdm.serverext.servertype.inqmy.extern.EngineApplOnlineDeployerImpl.performAction(DeploymentActionTypes).REMEXC)
Deployment exception : The deployment of at least one item aborted
Can anyone tell me why am I getting this error.
Thnx for your help.
Best regards.Hello Decio Junior,
Actually yes, I resolved my problem.
I'm developing an EJB 3.0 project. I'm using NWDS 7.2 and JDK 1.6 as I said.
The problem is that my server was using JDK 1.4 and that was the problem.
EJB 1.1 and 2.1 need ejb-jar.xml but EJB 3.0 use the annotations instead.
Check your server JDK Version. It should be JDK 1.5 or higher.
Something else that you should check, in your project properties :
In the Build PATH : Use JDK 1.5
In the Java Compiler : Set the java compiler compliance level to 1.6 and check use default compliance settings
Hope it would help.
If you need more explanations, I'm here
Good luck. -
Ejb accessing the deployment descriptor
My ejb needs to be able to access the deployment descriptor to retrieve some user information needed to connect to a web service. What is the best way to do this? I know servletts can do this, and if necessary, I could have my servlet retrieve the info and pass it to the bean, but I was hoping to avoid this.
Thanks
MattWell, sure I think that is easy. In your <entity> or <session> deployment descriptor you can have:
<env-entry>
<env-entry-name>WebServiceLogins</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>su, dan, bob, steve, richard, suzie, carla</env-entry-value>
</env-entry>
<env-entry>
<env-entry-name>WebServicePasswords</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>drs100, vfdds2, ajk14, pass411, richard23, q4lty, uo738ww1</env-entry-value>
</env-entry>
Then in your intial-context in your session or entity ejb.....
InitialContext ic = new InitialContext();
String logins = (String) ic.lookup("java:comp/env/WebServiceLogins");
String passwords = (String) ic.lookup("java:comp/env/WebServicePasswords"); -
Dynamic update of EJB/Web deployment descriptors
In 8.1SP3, is there any provision to allow for dynamic update of EJB/Web deployment descriptors? I'm specifically looking at env var changes.
I noticed that there are some mentions of the ability to dynamically update deployment descriptors, but it appears that the general facility has been deprecated, and they've incorporated all of the WebLogic-specific descriptor information directly into the console.
When I dig through the JMX namespace and some of the MBean classes, I also see mentions of "deployment descriptor editors", but it's not clear how to utilize that.
I'm aware of the fact that my application would have to be aware of possible dynamic updates to the descriptors, so I'd have to be able to implement some sort of listener for that.I have the same question but for a different purpose. I am part of a hosting group and we have app teams that have defined init-params in the web.xml that have to be changed as the app is promoted up through test environments and ultimately to production - only we need to be able to do this WITHOUT "cracking open" the archive.
I was hoping to be able to script something to do the update after deployment.
So any help at all would be appreciated. In the meantime will continue to poke around in the WLST and MBean docs.
Thanks,
Ed -
Referencing EJB on remote server AND using deployment descriptor
We're using Weblogic 6.1sp2 under Windows 2000.
We have a web application on server A and several EJBs running on server B -
some of these may in the future be moved to different servers.
We would like to ensure that this only requires reconfiguring the deployment
descriptors.
In our web app, we access the EJB's like this:
AccountHome accHome = (AccountHome) (new
InitialContext()).lookup("java:comp/env/ejb/AccountHome")
- we then map ejb/AccountHome to the JNDI name in the weblogic.xml file in
the web app - the JNDI name will usually (but not always) be the class name
of the implementing class, e.g. system.billing.accounting.AccountHome
However, to make this work when the EJB is on server B, we must put a
jndi.properties file in the server A classpath containing
java.naming.provider.url=t3://server_b:7001/
to point to server B.
Now, this makes ALL JNDI lookups on server A go to server B - this is not
what we want. Especially not in the case where some EJB's move to server C -
B and C may be in separate clusters and will not be clustering the JNDI
tree. Also, other web applications on the server will need to go to
different servers.
Alternatively, we could specify a property set in the InitialContext
constructor with a provider url. But in that case, the mapping from
web.xml/weblogic.xml is apparently not applied - or rather, if we look up
"java:comp/env/ejb/AccountHome", weblogic maps it to
"system.billing.accounting.AccountHome" and then tries to look it up on the
local machine, server A.
If we look up "system.billing.accounting.AccountHome", it does correctly
look it up on the server specified in the provider url and finds the entry.
However, this would mean that we would have to specify the exact jndi name.
In addition, we would have to hard-code the server name for each lookup.
An alternative would be to "copy" the JNDI entries from server B to server A
(or to some other shared, global JNDI registry). But these would need to be
kept in sync - especially since server B is really a cluster, where
different servers may come online at different times and register their EJBs
as clusterable, so the stubs would need to be continously updated.
My best idea is to bypass the whole web.xml/weblogic.xml mapping scheme and
just add our own config file with stuff like
<mappings>
<map entry="java:comp/env/ejb/AccountHome">
<jndi-properties>
java.naming.provider.url=t3://server_b:7001/
java.naming.security.principal=jndiuser
java.naming.security.credentials=mysecretpassword
</jndi.properties>
<jndi-name>sysmte.billing.accounting.AccountHome</jndi-name>
</map>
</mappings>
We then need to wrap all the lookups in our own lookup mechanism which first
checks the config file to find any mappings.
However, this seems like reinventing the wheel and will also confuse most
deployment tools etc.
Does anybody have any suggestions where we
1. Don't put a jndi.properties file in the server classpath
2. Lookup ejb's using "java:comp/env/ejb/SomeEJB" - not the JNDI name.
3. Don't hardcode the server names in the application - but potentially
in the deployment descriptor.
4. Can look up different EJB's on different machines
Niels HarremoësThere is an article on dev2dev that may explain what you are seeing...
http://dev2dev.bea.com/articlesnews/discussion/thread.jsp?thread=142
HTH
dwfa
"Niels Ull Harremoës" <[email protected]> wrote in message
news:[email protected]...
It turns out that we can make it work by entering the url of the server in
the weblogic.xml entry - e.g. instead of having
<reference-descriptor>
<ejb-reference-description>
<ejb-ref-name>ejb/AccountHome</ejb-ref-name>
<jndi-name>system.billing.accounting.AccountHome</jndi-name>
</ejb-reference-description>
</reference-descriptor>
we enter
<reference-descriptor>
<ejb-reference-description>
<ejb-ref-name>ejb/AccountHome</ejb-ref-name>
<jndi-name>t3://server_b:7001/system.billing.accounting.AccountHome</jndi-na
me>
</ejb-reference-description>
</reference-descriptor>
However, we are unsure on whether this will establish a new JNDIconnection
to server_b on every lookup? And it's not documented anywhere?
Does anybody have any other suggestions?
"Niels Ull Harremoës" <[email protected]> wrote in message
news:[email protected]...
We're using Weblogic 6.1sp2 under Windows 2000.
We have a web application on server A and several EJBs running on serverB -
some of these may in the future be moved to different servers.
We would like to ensure that this only requires reconfiguring thedeployment
descriptors.
In our web app, we access the EJB's like this:
AccountHome accHome = (AccountHome) (new
InitialContext()).lookup("java:comp/env/ejb/AccountHome")
- we then map ejb/AccountHome to the JNDI name in the weblogic.xml file
in
the web app - the JNDI name will usually (but not always) be the classname
of the implementing class, e.g. system.billing.accounting.AccountHome
However, to make this work when the EJB is on server B, we must put a
jndi.properties file in the server A classpath containing
java.naming.provider.url=t3://server_b:7001/
to point to server B.
Now, this makes ALL JNDI lookups on server A go to server B - this is
not
what we want. Especially not in the case where some EJB's move to serverC -
B and C may be in separate clusters and will not be clustering the JNDI
tree. Also, other web applications on the server will need to go to
different servers.
Alternatively, we could specify a property set in the InitialContext
constructor with a provider url. But in that case, the mapping from
web.xml/weblogic.xml is apparently not applied - or rather, if we look
up
"java:comp/env/ejb/AccountHome", weblogic maps it to
"system.billing.accounting.AccountHome" and then tries to look it up onthe
local machine, server A.
If we look up "system.billing.accounting.AccountHome", it does correctly
look it up on the server specified in the provider url and finds theentry.
However, this would mean that we would have to specify the exact jndiname.
In addition, we would have to hard-code the server name for each lookup.
An alternative would be to "copy" the JNDI entries from server B to
server
A
(or to some other shared, global JNDI registry). But these would need tobe
kept in sync - especially since server B is really a cluster, where
different servers may come online at different times and register theirEJBs
as clusterable, so the stubs would need to be continously updated.
My best idea is to bypass the whole web.xml/weblogic.xml mapping schemeand
just add our own config file with stuff like
<mappings>
<map entry="java:comp/env/ejb/AccountHome">
<jndi-properties>
java.naming.provider.url=t3://server_b:7001/
java.naming.security.principal=jndiuser
java.naming.security.credentials=mysecretpassword
</jndi.properties>
<jndi-name>sysmte.billing.accounting.AccountHome</jndi-name>
</map>
</mappings>
We then need to wrap all the lookups in our own lookup mechanism whichfirst
checks the config file to find any mappings.
However, this seems like reinventing the wheel and will also confuse
most
deployment tools etc.
Does anybody have any suggestions where we
1. Don't put a jndi.properties file in the server classpath
2. Lookup ejb's using "java:comp/env/ejb/SomeEJB" - not the JNDIname.
3. Don't hardcode the server names in the application - butpotentially
in the deployment descriptor.
4. Can look up different EJB's on different machines
Niels Harremoës
Maybe you are looking for
-
My security question answers don't work, how do I change them?
I have 4 computers synced to my iTunes account. It asks me security questions to which I know the answers, but every time I put them in, they are incorrect. I obviously have 2 computers that work perfectly to download, purchase, make CD's etc. But
-
Adobe Photoshop Scratch Disk Full/Startup Disk Full error - PLEASE HELP
Dear ALL, I have started to notice recently that when I run Photoshop CS on my Mac OSX Tiger, I am getting the Startup Disk Full error message. Never happended before. Since my initial post I downloaded Macaroni (utility) and have run the daily/weekl
-
UTL_SMTP send HTML email with embedded image?
Hi, I can use UTL_SMTP to send an HTML email ok, but does anyone have an example of how to include an inline embedded image in the email? Thanks!
-
How can I change the attached image with blue background to the attached image with white background in FW? Is there a way to do that? It's an image -- not a font in a text box -- so can't just change canvas color. Actually, I don't see where I can a
-
Create Run As Accounts - Error 635 unable to securely store the password information
Hello, I'm running on SCVMM 2012 R2. When I try to create a new Run As Accounts the jobs fail with the error Virtual Machine Manager is unable to securely store the password informaiton on this machine. Ensure that the Microsoft Cryptographic Service