ROOT
C:\apache-tomee-plus-1.7.3\
WAR LOCATION
C:\apache-tomee-plus-1.7.3\apps\alliance.ear\crm2.war
WEB ROOT LOCATION
C:\apache-tomee-plus-1.7.3\webapps\ROOT
I am having Trouble with setting couple of issues setting up the WEB-INF/classes/server.properties :
first issue webRoot setting it cannot auto detect the webRoot only way i can get it to work is to set it up with the Absolute Path which is not what i want it to do .. is there a way to configure a relative path since this will be installed differently in production . right now the war files is placed under the C:\apache-tomee-plus-1.7.3\apps\alliance.ear\ folder and root is in different location \webapps\ROOT as you can see from the previous file structure so i had to get it using the absolute path
Second issue is using the JNDI configuration for SQL server :
right now the my context for the jndi is " openejb:Resource/jdbc/DefaultDS " but thats giving me an warning and error
we have been using this context in out existing application without any issues or problem where it did deploy correctly and allows to connect
here is my Tomee.xml for the JNDI configuration
<?xml version="1.0" encoding="UTF-8"?>
<tomee>
<!-- see http://tomee.apache.org/containers-and-resources.html -->
<Resource id="jdbc/DefaultDS" type="DataSource">
JdbcDriver com.microsoft.sqlserver.jdbc.SQLServerDriver
JdbcUrl jdbc:sqlserver://localhost;selectMethod=direct;DatabaseName=myDB
UserName user
Password pass
JtaManaged true
</Resource>
<!-- activate next line to be able to deploy applications in apps -->
<Deployments dir="apps" />
</tomee>
11-28 11:27:30 [WARNING] Failed to create MBean for naming resource [jdbc/DefaultDS]
javax.management.MalformedObjectNameException: Invalid character ':' in value part of property
at javax.management.ObjectName.construct(ObjectName.java:618)
at javax.management.ObjectName.<init>(ObjectName.java:1382)
at org.apache.catalina.mbeans.MBeanUtils.createObjectName(MBeanUtils.java:578)
at org.apache.catalina.mbeans.MBeanUtils.createMBean(MBeanUtils.java:181)
at org.apache.catalina.deploy.NamingResources.addResource(NamingResources.java:378)
at org.apache.tomee.catalina.OpenEJBNamingResource.addResource(OpenEJBNamingResource.java:102)
at org.apache.tomee.catalina.TomcatJndiBuilder.mergeRef(TomcatJndiBuilder.java:653)
at org.apache.tomee.catalina.TomcatJndiBuilder.mergeJndi(TomcatJndiBuilder.java:139)
at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1338)
at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1100)
at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:130)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5419)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1574)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1564)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
11-28 11:27:33 [SEVERE] Error merging Java EE JNDI entries in to war /crm2: Exception: Unable to load type 'java:openejb/Resource/jdbc/DefaultDS' for comp/env/jdbc/DefaultDS
org.apache.openejb.OpenEJBException: Unable to load type 'java:openejb/Resource/jdbc/DefaultDS' for comp/env/jdbc/DefaultDS
at org.apache.openejb.assembler.classic.JndiEncBuilder.getType(JndiEncBuilder.java:617)
at org.apache.openejb.assembler.classic.JndiEncBuilder.buildMap(JndiEncBuilder.java:291)
at org.apache.openejb.assembler.classic.JndiEncBuilder.buildBindings(JndiEncBuilder.java:173)
at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1387)
at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1100)
at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:130)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5419)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1574)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1564)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Any help would be appreciated with configuring Apache Tomee
With respect to the JNDI configuration, your res-type definition doesn’t seem to be valid. A valid value here is a java type. See examples here: https://tomcat.apache.org/tomcat-7.0-doc/jndi-resources-howto.html. And, as you can from the stack trace, it’s the container that doesn’t like this value, not any SmartClient/SmartGWT code. I think what you want is:
In terms of the webRoot autodetection, can you please share the initial portion of the server init log that shows the relevant log statements? Also, are you using SmartClient or SmartGWT? Which version (and build date)? This last info should be part of the server startup logs.
Ok, thanks. To get the obvious out of the way, did you by any chance move the isomorphic/ directory from webRoot to somewhere else? I’m looking at these two log messages:
11-28 13:23:21 [INFO] Successfully loaded server.properties from CLASSPATH at location: file:/C:/apache-tomee-plus-1.7.3/apps/alliance.ear/crm2/WEB-INF/classes/server.properties
11-28 13:23:21 [SEVERE] Can't find marker file for webRoot: C:/apache-tomee-plus-1.7.3/apps/alliance.ear/crm2/isomorphic for configured/autodetected webRoot - if you moved the 'isomorphic' directory, please set isomorphicPathRootRelative in server.properties to the new location and restart the servlet engine.
Per the first log message, it looks like the webRoot should be C:/apache-tomee-plus-1.7.3/apps/alliance.ear/crm2 because the framework is clearly successfully loading a file from that dir. But then it can’t find the isomorphic/ dir in there. Do you see it there on the filesystem and does the user the container is running as have permissions to read that directory?
Tomee is extracting the crm2.war to a crm2 folder in our EAR file (Enterprise Application Archive ) folder .. but the ROOT folder where we have the isomorphic and the shared/ds folders are in a different directory as i mentioned before the file Structure note alliance.ear is our archive for all our EJB’s and WAR files that are packaged together and deployed under the C:\apache-tomee-plus-1.7.3\apps\alliance.ear for easy installation in production… the Isomorphic is located in the root folder of the Tomee C:\apache-tomee-plus-1.7.3\webapps\ROOT along with all the ds.xml files in the shared folder also
now the webRoot if i set it to the absolute path C:\apache-tomee-plus-1.7.3\webapps\ROOT every thing works .. the only problem is this path cant be hardcoded and should allow us to use the relative path or even the containers default ROOT path
Can you share the configuration of the webapps in the ear? META-INF/application.xml at the .ear level, I think.
Are the ‘crm2’ and ‘ROOT’ apps distinct? Or is the crm2 app being mapped to / and hence appearing in multiple places? I’m trying to see if our initializer is somehow firing somewhere it shouldn’t or maybe they are distinct apps and both use SmartClient - in which case maybe this is a classloader issue…
Anything more you can share about the intended layout and config would be helpful
The CRM2 application gets deployed relative to the ROOT context so they are are not distinct in matter of deployment .. but they are is separate folders .
In my testing, the EAR explodes the WAR in the apps/ directory. I’d like to understand how your configuration has both an apps/ and a webapps/ copy. Can you share your conf/tomee.xml? Any deviations from stock install there or in any other configuration files?
<?xml version="1.0" encoding="UTF-8"?>
<tomee>
<!-- see http://tomee.apache.org/containers-and-resources.html -->
<Resource id="jdbc/DefaultDS" type="DataSource">
JdbcDriver com.microsoft.sqlserver.jdbc.SQLServerDriver
JdbcUrl jdbc:sqlserver://localhost;selectMethod=direct;DatabaseName=pltfloor
UserName user
Password pass
JtaManaged true
</Resource>
<!-- activate next line to be able to deploy applications in apps -->
<Deployments dir="apps" />
</tomee>
That is the default WEB application development i dont see where my CRM2.war is deploying in the webapps/Root folder ?
what version of TomEE are u using in your test environment ? would u like me to setup a quick tomee configuration and send it your way ?
I’m using 1.7.4 - so slightly different, but I can’t imagine it accounts for this delta. I’m trying to understand how the isomorphic/ and shared/ folders are ending up in webapps/ROOT (which is what you said was happening in post #10)
I did that setup. i copied the isomorphic and shared folders to the webapps/ROOT
cause i would like the other wars in the EAR using the same isomorphic folder and shared folder
That is highly inadvisable. Although in advanced, very specific configurations you could theoretically have a shared location like this, it’s really easy to run into trouble. First of all, doing this will require you to specify an explicit webRoot in server.properties - which is what you’re trying to avoid doing (for good reason). There’s no way for us to get outside of the deployment directory and figure out automatically that you’ve moved the isomorphic/ dir. And some containers would preclude filesystem access outside the deployment dir.
Furthermore, both client and server need to see the contents of both isomorphic/ and shared/ (the datasources contained in both of these dirs are used by both the client and server) and in almost every case, every app has its own copies of these and they shouldn’t be shared between apps. Apps may also use different versions of SmartClient/SmartGWT and sharing these would cause really obscure gotcha bugs.
Bottom line is: don’t do this. The only thing you’re saving is disk space, and not very much at that.
In theory yes. But in practice, it will be interpreted as relative to the cwd at the point the jvm that boostraps the app server. Note also that the jvm itself (or a possible wrapper script that invokes it on the end user’s machine) or the app server bootstrap logic could change the cwd before our init block runs.
If you really know what you’re doing, and you’d like to strike out on your own, without further support from us, you can attempt to set the webRoot value to use autodetect mode with a relative path like so:
webRoot: __AUTODETECT__/../../foo/bar
This hasn’t been tested at all and so may or may not work. It also may or may not work in any given container or configuration. You’re totally on your own here. Hope this helps.
looks like the Token has to be alone for the auto detect to work cant be embedded inside of a relative path
Isomorphic Init: Exception in Init.go()
java.lang.Exception: Configured webRoot path is invalid please check your server.properties setting. Current value is:
__AUTODETECT__/../../../webapps/ROOT
at com.isomorphic.base.ISCInit.go(ISCInit.java:118)
at com.isomorphic.base.InitListener.contextInitialized(InitListener.java:92)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5017)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5531)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1574)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1564)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Isomorphic Init: Exception in Init.go()
java.lang.Exception: Configured webRoot path is invalid please check your server.properties setting. Current value is:
__AUTODETECT__/../../../webapps/ROOT
at com.isomorphic.base.ISCInit.go(ISCInit.java:118)
at com.isomorphic.base.Init.go(Init.java:92)
at com.isomorphic.base.Init.go(Init.java:97)
at com.isomorphic.base.Init.init(Init.java:105)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1284)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1197)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1087)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5267)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5557)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1574)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1564)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Isomorphic Init: Exception in Init.go()
java.lang.Exception: Configured webRoot path is invalid please check your server.properties setting. Current value is:
__AUTODETECT__/../../../webapps/ROOT
at com.isomorphic.base.ISCInit.go(ISCInit.java:118)
at com.isomorphic.base.Init.go(Init.java:92)
at com.isomorphic.servlet.BaseServlet.init(BaseServlet.java:141)
at com.isomorphic.servlet.PreCache.init(PreCache.java:76)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1284)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1197)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1087)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5267)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5557)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1574)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1564)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Isomorphic Init: Exception in Init.go()
java.lang.Exception: Configured webRoot path is invalid please check your server.properties setting. Current value is:
__AUTODETECT__/../../../webapps/ROOT
at com.isomorphic.base.ISCInit.go(ISCInit.java:118)
at com.isomorphic.base.Base.<clinit>(Base.java:52)
at com.isomorphic.servlet.BaseServlet.init(BaseServlet.java:151)
at com.isomorphic.servlet.PreCache.init(PreCache.java:76)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1284)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1197)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1087)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5267)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5557)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1574)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1564)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
12-07 12:28:59 [INFO] Isomorphic PreCache servlet loading
Problem loading builtinTypes.xml
Exception when loading from __AUTODETECT__/../../../webapps/ROOT/isomorphic/system/schema/builtinTypes.xml:
java.io.FileNotFoundException: __AUTODETECT__\..\..\..\webapps\ROOT\__AUTODETECT__\..\..\..\webapps\ROOT\isomorphic\syst
em\schema\builtinTypes.xml (The system cannot find the path specified)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(FileInputStream.java:195)
at java.io.FileInputStream.<init>(FileInputStream.java:138)
at com.isomorphic.io.file.ISCNativeFile.getInputStream(ISCNativeFile.java:159)
at com.isomorphic.xml.XML$DocumentCache.loadObjectFromFile(XML.java:414)
at com.isomorphic.store.ProcessedFileCache.getObjectFromFile(ProcessedFileCache.java:147)
at com.isomorphic.xml.XML.getXMLDocument(XML.java:434)
at com.isomorphic.xml.XML.toDSRecords(XML.java:442)
at com.isomorphic.xml.XML.toDSRecords(XML.java:446)
at com.isomorphic.xml.XML.toDSRecords(XML.java:451)
at com.isomorphic.datasource.DataSource.<clinit>(DataSource.java:1110)
at com.isomorphic.datasource.DataSourceManager.getDataSource(DataSourceManager.java:168)
at com.isomorphic.datasource.DataSourceManager.getDataSource(DataSourceManager.java:121)
at com.isomorphic.servlet.PreCache.preLoadDataSources(PreCache.java:142)
at com.isomorphic.servlet.PreCache.init(PreCache.java:89)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1284)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1197)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1087)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5267)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5557)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1574)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1564)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
What is the purpose of having multiple web apps share these directories? The key thing to understand is that you should not be running different versions of the client and server, so with your approach where e.g. isomorphic/ is “shared”, when you upgrade to a new version of SmartClient or SmartGWT, you would need to redeploy both the ROOT app that contains isomorphic/ (for the client-side) and simultaneously ALL the apps that use it.
If this is the outcome you want, why have separate apps at all?