Setting JAVA_OPTS in open shift is not working - spring

I am trying to set java options for my spring application in open shift and its not working. I tried exporting JAVA_OPTIONS and _JAVA_OPTIONS in my app and still I see a file not found exception in my spring initialization exception.
I am trying to load a properties file in spring which is picked based on the environment variable
stack trace:
org.springframework.beans.factory.BeanInitializationException: Could not load properties; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/config_${targetEnv}.properties]
any help is appreciated.

You should be using the JAVA_OPTS_EXT environment variable to set any extra JAVA_OPTS that you would like your application to use.

Related

"Connection cannot be null when hibernate.dialect is not set" and sessionFactory error

I want to import in eclipse and connect with PostgreSQL database. PostgreSQL is configured on another machine.
I have imported the war file in eclipse and changed 3 file with IP address of the machine where PostgreSQL is installed. Three files were hibernate.cnf.xml, spring-database.xml, na-dispatcher.xml. Like
jdbc:postgresql://192.168.1.15:5432/mydatabase.
After that I tried running the application in tomcat server with eclipse IDE.
I got error like
./web-inf/sping-security.xml
1
Connection cannot be null when 'hibernate.dialect' not set
Also an error regarding session factory and all.
I can't paste the code because we can't use internet in office. Please help me in resolving this. Tomorrow is the deadline. no code
2
Error creating bean with name ‘sessionFactory’ defined in ServletContext resource [/WEB-INF/spring-servlet.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when ‘hibernate.dialect’ not set

Need help in deploying warn using WSAdmin install with JNDI

I am trying to deploy a web application using WSAdmin tool. But it is throwing an error.
JACl script that I am using is :
$AdminApp install /opt/www/temp/SampleApp.war {-nopreCompileJSPs -nodeployejb -server delivery -cell delivery_cell -node delivery_node -appname SampleApp -contextroot SampleApp -MapWebModToVH {{"SampleApp" SampleApp.war,WEB-INF/web.xml default_host}}}
Error I am getting is:
com.ibm.ws.scripting.ScriptingException: WASX7109E: Insufficient data for install task "MapResRefToEJB
ADMA0007E: A validation error occurred in task Mapping resource references to resources. The Java Naming and Directory Interface (JNDI) name is not specified for resource reference jdbc/app_DB in module SampleApp with EJB name.
From the error above I understand that I need to configure my JNDI with -MapResRefToEJB. I tried to understand this option but getting too confused.
Can anyone help me to resolve this issue?
These errors appear to be caused by the MapResRefToEJB option in
the wsadmin command not being set correctly, or the resource it is pointing to
not existing correctly in the web.xml file.
Additional information on MapResRefToEJB
Options for the AdminApp object install, installInteractive, edit,
editInteractive, update, and updateInteractive commands
http://pic.dhe.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topic=/com.ibm.websphere.nd.doc/info/ae/ae/rxml_taskoptions.html
Thank you
Note : Opinions are my own.

ehcache help needed

Hello i am trying to setup Ehcache on my local system , There is only java based caching ,i am performing . I got the exception when i just ran the main method " 10:16:32,637 INFO [main] Main - javax.xml.transform.TransformerFactory=null
10:16:32,684 FATAL [main] Main - No embedded stylesheet instruction for file: file:/C:/workspaces/Ehacache/EhcacheTest/src/config/ehcache.xml
org.eclipse.wst.xsl.jaxp.debug.invoker.TransformationException: No embedded stylesheet instruction for file: file:/C:/workspaces/Ehacache/EhcacheTest/src/config/ehcache.xml
at org.eclipse.wst.xsl.jaxp.debug.invoker.internal.JAXPSAXProcessorInvoker.transform(JAXPSAXProcessorInvoker.java:225)
at org.eclipse.wst.xsl.jaxp.debug.invoker.internal.JAXPSAXProcessorInvoker.transform(JAXPSAXProcessorInvoker.java:186)
at org.eclipse.wst.xsl.jaxp.debug.invoker.internal.Main.main(Main.java:73)
Caused by: org.eclipse.wst.xsl.jaxp.debug.invoker.TransformationException: No embedded stylesheet instruction for file: "
In my Code i have put only this in the main method
CacheManager cm = new CacheManager("src/config/ehcache.xml");
String[] test = cm.getCacheNames();
System.out.println(test.length);
and also in my src/config/ i have put only ehcache.xml. I didnot put ehcache.xsd, Do i need to mention that also
My take is that you are not running your Java class' main method, but Eclipse is trying to execute your ehcache.xml file. You need to make sure you run the correct target.

OC4J 10.1.3.3 unable to find ojms.rar setting up database persistences

I'm running into problems with JMS in Oracle AS 10.1.3.3.
The error I am getting is 'connectors\ojms.rar (The system cannot find the path specified)' from EM.
Below are a few bullets on the environment.
This is on a Windows XP SP3 machine.
All configuration is through EM.
The EM is a local instance that has been used for over a year.
This instance has existing db connection management exposed through JNDI.
Oracle_home is set to the directory where I unzip the OC4J zip file. c:\oc4j_10.1.3.3.
ojms.rar file is in %ORACLE_HOME%\j2ee\home\connectors
Configuring OC4J for JMS with Database Persistence
I've create a new data connection for Oracle AQ and exposed the connection through JNDI as jms/flexc
When creating the Resource Adapter through EM, I'm providing the following information:
Resource Name: JMS on FlexC
Adding a new resource
Name : jmsFlexc
Datasource JNDI : jms/flexc (selected from dropdown box)
Very quickly, I get the error below:
An error has occurred.
connectors\ojms.rar (The system cannot find the path specified)
connectors\ojms.rar (The system cannot find the path specified)
[Select to hide information] Hide Additional Trace Information
oracle.sysman.ias.studio.j2ee.deploy.DeployUtil$DeploymentFailureException at
oracle.sysman.ias.studio.j2ee.deploy.DeployUtil.deployArchive(DeployUtil.java:211) at
oracle.sysman.ias.studio.j2ee.deploy.DeployUtil.deployArchive(DeployUtil.java:85) at
oracle.sysman.ias.studio.oc4j.jms.JMXDeployDbProviderAdminBean.deployDBProviderAndConfigure(JMXDeployDbProviderAdminBean.java:121) at
oracle.sysman.ias.studio.oc4j.jms.DeployDbProviderHelper.deployDBProvider(DeployDbProviderHelper.java:242) at
oracle.sysman.ias.studio.oc4j.jms.DeployDbProviderHelper.handleEvent(DeployDbProviderHelper.java:127) at
oracle.sysman.ias.studio.sdk.AbstractController.handleEvent(AbstractController.java:769) at
oracle.sysman.emSDK.svlt.PageHandler.handleRequest(PageHandler.java:378) at
oracle.sysman.emSDK.svlt.EMServlet.myDoGet(EMServlet.java:765) at
oracle.sysman.emSDK.svlt.EMServlet.doGet(EMServlet.java:283) at
oracle.sysman.ias.studio.app.StudioConsole.doGet(StudioConsole.java:385) at
oracle.cabo.servlet.UIXServlet.doPost(Unknown Source) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:763) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at
com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65) at
oracle.sysman.ias.studio.app.BrowserVersionFilter.doFilter(BrowserVersionFilter.java:75) at
com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:15) at
oracle.sysman.ias.studio.app.MultipleJVMFilter.doFilter(MultipleJVMFilter.java:85) at
com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:17) at
oracle.sysman.ias.studio.app.PostLogonFilter.doFilter(PostLogonFilter.java:80) at
com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:17) at
oracle.sysman.ias.studio.app.ShortHostnameRedirectFilter.doFilter(ShortHostnameRedirectFilter.java:68) at
com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:621) at
com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370) at
com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871) at
com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453) at
com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:221) at
com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:122) at
com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:111) at
oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260) at
oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:239) at
oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:34) at
oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:880) at
com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303) at
java.lang.Thread.run(Thread.java:619) Caused by: oracle.oc4j.admin.jmx.shared.exceptions.JMXRuntimeException: connectors\ojms.rar (The system cannot find the path specified) at
oracle.oc4j.admin.jmx.shared.util.JarTool.(JarTool.java:122) at
oracle.sysman.ias.studio.j2ee.deploy.DeployPageUtil.getArchiveType(DeployPageUtil.java:105) at
oracle.sysman.ias.studio.j2ee.deploy.DeployUtil.deployArchive(DeployUtil.java:133) ... 33 more Caused by: java.io.FileNotFoundException: connectors\ojms.rar (The system cannot find the path specified) at
java.util.zip.ZipFile.open(Native Method) at
java.util.zip.ZipFile.(ZipFile.java:114) at
java.util.jar.JarFile.(JarFile.java:135) at
java.util.jar.JarFile.(JarFile.java:99) at
oracle.oc4j.admin.jmx.shared.util.JarTool.(JarTool.java:119) ... 35 more
Discovered that this is a bug in OC4J.
The solution was found by a colleague as a comment made to this blog
I also got an error when deploying the
resource adapter. I found that this
was a bug in Oracle Standalone
10.1.3.3.0 (bug 6786060 on Metalink) and can be solved either by using
10.1.3.2.0 or by starting Oracle standalone without the ORACLE_HOME
environment variable. This is made by
the command "java -jar oc4j.jar". I
used the last solution and it worked
fine for me.

Exception: Need to specify class name in environment or system property: java.naming.factory.initial [duplicate]

This question already has answers here:
The meaning of NoInitialContextException error
(13 answers)
Closed 9 years ago.
When i run a JMS related application, i am encountering the following exception error.
javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
We are using Sun Application Server 9.1
Any idea what are we missing?
I already tried adding the following but result still the same
Properties env = new Properties();
env.put("java.naming.factory.initial","com.sun.jndi.cosnaming.CNCtxFactory");
Context ctx = new InitialContext(env);
A very common error can be that you have not added the jboss-client.jar!
or alternate jar if using weblogic.
I was facing the same problrm while working with spring & weblogic . I had resolved it by setting two properties
System.getProperties().put("java.naming.factory.initial","weblogic.jndi.WLInitialContextFactory");
System.getProperties().put("java.naming.provider.url", "t3://localhost:80")
In my environment, setting Context.INITIAL_CONTEXT_FACTORY wasn't enough. I also had to set Context.URL_PKG_PREFIXES, explained at http://docs.oracle.com/javase/6/docs/api/javax/naming/Context.html#URL_PKG_PREFIXES.

Resources