For a jboss .war application I received instructions to configure its SLF4j/Logback, setting a folder path string with java:/comp/env/xyz JNDI variable.
I'm using Jboss EAP 7, do I need to set it somewhere in the standalone.xml file? What syntax should be used? The official Logback docs don't help me with Jboss.
EDIT:
More info, the actual code looks for the resource in this way:
basepath = (String) initialContext.lookup("java:/comp/env/" + MyBasePath);
I answer myself, the variable can be set in standalone.xml here:
<subsystem xmlns="urn:jboss:domain:naming:2.0">
<bindings>
<simple name="java:/comp/env/xyz" value="<PATH>" type="java.lang.String"/>
</bindings>
<remote-naming/>
</subsystem>
Related
I have been searching around for this specific problem of mine. We have a folder that is on a shared folder on another server "\\server1\shares\web\images" and I want to link this folder into my web application in Jboss 7.2.2. I'm migrating from Jboss 4.2.2 to Jboss 7.2.2.
Here is my server.xml file from Jboss 4.2.2. You'll notice that the <Context> tag handles this link for me.
<Server>
<Service name="jboss.web">
<!-- ... -->
<Engine name="jboss.web" defaultHost="localhost">
<!-- ... -->
<Host name="myApp" autoDeploy="false" deployOnStartup="false"
deployXML="false" configClass="org.jboss.web.tomcat.security.config.JBossContextConfig">
<!-- ... -->
<Context path="/images" appBase="" docBase="\\server1\shares\web\images"
debug="99" reloadable="true" />
<!-- ... -->
</Host>
</Engine>
</Service>
My research has lead me to use modules, but I cannot figure out how to use the modules properly for this problem. Most examples shows how to provide some link to a folder on the same machine as the Jboss server is on.
So, am I suppose to use modules or is there another way of doing this?
Im a little rusty on configurations as I have not written anything from scratch for years..
I am writing a webservice which I want to use locally with jetty in eclipse and then on the server with Wildfly. I have figured out both separately, but not for both to work at the same time..
What I have is:
In java Im looking for dbsource with
final DataSource ds = (DataSource) ctx.lookup("java:/comp/env/jdbc/smartieDB");
For jetty this works in jetty-env.xml:
<Configure class="org.eclipse.jetty.maven.plugin.JettyWebAppContext">
<New id="smartieDB" class="org.eclipse.jetty.plus.jndi.Resource">
<Arg>jdbc/smartieDB</Arg> ..... etc
web.xml:
<resource-ref>
<description>DB Connection</description>
<res-ref-name>/comp/env/jdbc/smartieDB</res-ref-name> <!--<-this was for wildfly, for jetty this only works: jdbc/smartieDB -->
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
In wildfly the datasource is configured with jndi-name:
<datasource jndi-name="java:/comp/env/jdbc/smartieDB" pool-name="PostgrePool">
Any ideas how can I optimize this so that I dont have to do the checks where it is jetty locally and when it is run on the server? Grateful for all tips!!!
Cheers,
Nikki
I am working with WildFly 9.0.1.Final release and noticed this line in the standalone.xml:
<subsystem xmlns="urn:jboss:domain:jpa:1.1">
<jpa default-datasource="" default-extended-persistence-inheritance="DEEP"/>
</subsystem>
I know that JPA version thats shipped with WildFly 9 is 2.1, so what does the value jpa:1.1 refer to here?
urn:jboss:domain:jpa:1.1 is the namespace for the XML configuration of the JPA subsystem in WildFly. In your WildFly installation, the corresponding schema is located at docs/schema/jboss-as-jpa_1_1.xsd.
The versioning of subsystem schemas is not related to the versioning of any Java EE specs.
I want to create a global custom filter, that catches(for checking/modification etc) http-headers for all web-applications on server.
I tryied to apply my filter as a global-module in standalone.xml, but it doesn't work
<subsystem xmlns="urn:jboss:domain:ee:1.1">
<spec-descriptor-property-replacement>false</spec-descriptor-property-replacement>
<jboss-descriptor-property-replacement>true</jboss-descriptor-property-replacement>
<global-modules>
<module name="com.myfilter.filter" slot="main"/>
</global-modules>
</subsystem>
Help me please!
Global module will only add something to global class path, it will not use it for requests.
What you request is outside Java EE specification. Some servers support such a functionality as an extension to the spec. Tomcat and JBoss have such extended support using Valves. You should be able to do what you're after by implementing a Tomcat Valve, installing it as a module and then configuring it to JBoss like instructed here:
<subsystem xmlns="urn:jboss:domain:web:1.4" default-virtual-server="default-host" native="false">
<valve name="myvalve" module="org.jboss.web-valves" class-name="org.apache.catalina.valves.AccessLogValve">
<param param-name="prefix" param-value="catalina_access_log."/>
<param param-name="suffix" param-value=".txt"/>
</valve>
. . . .
</subsystem>
I've got the order to switch from Liferay on tomcat, to Liferay on JBoss.
One issue I'm having is that unlike in tomcat, I can't seem to find a context.xml in liferay-portal-6.0.5\jboss-5.1.0\server\default\conf
Will it work if I just copy the context.xml from my tomcat installation to my jboss installation? (I don't know if JBoss scans that folder).
Or is there an alternative location where I can put my resource?
<Resource name="jdbc/x" auth="Container"
type="javax.sql.DataSource" driverClassName="oracle.jdbc.OracleDriver"
url="y"
username="z" password="A" maxActive="20" maxIdle="10"
maxWait="-1"/>
Add a file named "*- ds.xml" in the deploy directory server with the following contents:
<?xml version="1.0" encoding="UTF-8"?>
<datasources>
<local-tx-datasource>
<jndi-name>jdbc/myds</jndi-name>
<connection-url>jdbc:oracle:thin:#127.0.0.1:1521:sid</connection-url>
<user-name></user-name>
<password></password>
<new-connection-sql>SELECT * FROM DUAL</new-connection-sql>
<check-valid-connection-sql>SELECT * FROM DUAL</check-valid-connection-sql>
<driver-class>oracle.jdbc.OracleDriver</driver-class>
</local-tx-datasource>
</datasources>