Here are some lines from the Java EE 6 tutorial about JNDI local lookup.
The java:app namespace is used to look up local enterprise beans packaged within the same application. That is, the enterprise bean is packaged within an EAR file containing multiple Java EE modules. JNDI addresses using the java:app namespace are of the following form:
java:app[/module name]/enterprise bean name[/interface name]
The module name is optional. The interface name is required only if the enterprise bean implements more than one business interface.
My question is: Why is the module name optional? What if there are two enterprise beans with the same name in two different modules?
The module name is not optional if you deploy an EAR. The module name is omitted if you deploy a WAR or EJB JAR directly without packaging it within an EAR because in that case, there is only one module so there is no ambiguity.
Related
I am using IBM Webspehere 8.5, where i need to pass the the log4j2 config file path externally (not hardcoded in deployed jar file as for dev, uat and prod different config file are present)
Log4j2 site tells https://logging.apache.org/log4j/2.0/faq.html
You can also specify the full path of the configuration file with this system property:
-Dlog4j.configurationFile=path/to/log4j2.xml
IBM WS site tells how to set it (But is it system property or environment variable)
http://www-01.ibm.com/support/docview.wss?uid=swg21254153
Also . Can you please let me know the right way to set Log4j2 system property.
See the Java virtual machine custom properties topic in the Knowledge Center for information on setting JVM system properties:
To set custom properties, connect to the administrative console and navigate to the appropriate Java virtual machine custom properties page.
Application Server
Click Servers > Server Types, and either WebSphere application servers > server_name or WebSphere proxy servers > server_name. Then, under Server Infrastructure, click Java and process management > Process definition > Java virtual machine > Custom properties.
Can someone help me with the process of deploying EJB application on TOMEE server (OpenEJB standalone server)? Is it simply dropping EJB application jar in the common library folder (apps folder) of the server?
How does TOMEE bind EJBs to JNDI names?
TomEE follows JavaEE6 naming for JNDI names.
To deploy a war put it like for tomcat in webapps/ folder and for ejbmodules or ears create a apps/ folder to put them there and uncomment the Deployments line in conf/tomee.xml.
I have successfully migrated our application from log4j 1.x to log4j 2.x.
But there is one external component which cannot be migrated. Meaning calls to log4j 1.x should remain as they are.
I have log4j2.xml for our application and the old log4j.properties for the external component.I am getting the logs for the appenders in log4j2.xml but nothing for the one defined in log4j.properties. I read the post -
Mixing log4j 1.x and log4j 2
and have added the required jars. Earlier with log4j 1.x we used to have 2 log4j.properties - one for the applciation and another one for the external component using PropertyConfigurator. Now with log4j2.xml I am not sure how we can achieve this.
Configuring log4j2 and log4j using a single log4j2 xml file
This post says we cannot have log4j.properties in the classpath. Does that mean that I need to transfer all the appenders defined in log4j.properties to log4j2.xml ? Can I have a seperate log4j2.xml just for the external component.
You cannot have two log4j2.xml configurations (well, separate web apps can have separate configurations but in general each process has one config).
Option 1: The easiest thing to do is to use the bridge log4j-1.2-api-2.x.jar and merge the log4j.properties configuration into the log4j2.xml. Then all logging is done by lo4j 2 and it should all work.
If you want to do things the hard way you may be able to succeed but it may take some fiddling.
Option 2: If by "migrated our application from log4j 1.x to log4j 2.x" you mean your application now uses the log4j 2 API, then you should be able to use both log4j 1.x to log4j 2 at the same time. (log4j 1.x for the external component.)
In that case, do not use the bridge log4j-1.2-api-2.x.jar. If you use the bridge, it will route calls to the log4j 1.x API to log4j 2. Usually that is what you want, but in this case it sounds like your external component wants to use the log4j 1.x internals. (Is this true? If not, consider option 1.)
If your application now uses the log4j 2 API, except for the external component, then put these jars and config files in your classpath:
log4j-api-2.x.jar
log4j-core-2.x.jar
log4j-1.2.x.jar
log4j2.xml - the log4j 2 configuration for your application
log4j.properties - the log4j 1.x configuration for the external component
But again, simply merging the configurations is probably easier to maintain.
i have an application server (JBoss) with some EJBs deployed. Now i must develop an OSGi application which i would like to reuse with my application server. I know that new application servers allows to deploy OSGi bundles in the application server itself.
These are my questions:
Could i simple deploy my OSGi bundles into the application server instead of EJBs?
Do OSGi services scale as well as EJB or should i better use EJB for performance-critical parts of the application(Is there are any "OSGi service thread pool" in application server)?
Will the OSGi service be the bottleneck for EJB-Based application if used together?
Thanks, Slava
If you were using GlassFish, you could do use best both the worlds, as GlassFish can automatically make your EJBs that are part of your OSGi bundle available as OSGi services. See
http://weblogs.java.net/blog/ss141213/archive/2010/03/30/ejb-osgi-service-demo-eclipsecon
For more info, ask in glassfish forum at users#glassfish.java.net
Specifically, I want to have my grails app under development to connect to an Oracle db defined by an tnsnames.ora file. I have the tnsnames.ora file located in c:\drivers\Network\ on my PC. When I run the grails app via "grails run-war", the db connection string defined in the tnsnames.ora file doesn't seem to be picked up:
grails prod run-war -Dserver.port=62215 -Doracle.net.tns_admin=C:\drivers\Network\
It seems the name-value pair of oracle.net.tns_admin is not being passed to the JVM used by the the embedded Tomcat that comes with Grails 1.2.0. If not, what is the proper way of specifying it, or pass any JAVA_OPTS to the underlying JVM?
You're best off setting your JAVA_OPTS in the Grails startup script (%GRAILS_HOME%/bin/grails.bat). See this link for an example.