Right now i have to make migration of one application.
Basic configuration:
JBOSS 5.1.0 GA
Seam 2.2.0.GA
JBPM 3.2.2
RichFaces 3.3.1.GA
Hibernate 3.3.1.GA
OS: Debian/Linux
Application has been deployed on JBoss server with its own configuration.
On old machine there was postfix (localhost, port 25) for sending messages.
On new machine i have different host and port.
What i have now in components.xml:
<mail:mail-session session-jndi-name="java:/Mail" />
My mail-service.xml:
<mbean code="org.jboss.mail.MailService"
name="jboss:service=Mail">
<attribute name="JNDIName">java:/Mail</attribute>
<attribute name="User">XXX</attribute>
<attribute name="Password">XXX</attribute>
<attribute name="Configuration">
<!-- A test configuration -->
<configuration>
<!-- Change to your mail server prototocol -->
<property name="mail.store.protocol" value="pop3"/>
<property name="mail.transport.protocol" value="smtp"/>
<!-- Change to the user who will receive mail -->
<property name="mail.user" value="XXX"/>
<!-- Change to the mail server -->
<property name="mail.pop3.host" value="localhost"/>
<!-- Change to the SMTP gateway server -->
<property name="mail.smtp.host" value="XXX"/>
<property name="mail.smtp.auth" value="true"></property>
<property name="mail.smtp.ssl.enable" value="false"></property>
<property name="mail.smtp.port" value="587"/>
<property name="mail.smtp.connectiontimeout" value="20000"></property>
<property name="mail.smtp.timeout" value="20000"></property>
<!-- The mail server port -->
<!-- Change to the address mail will be from -->
<property name="mail.from" value="XXX"/>
<!-- Enable debugging output from the javamail classes -->
<property name="mail.debug" value="true"/>
</configuration>
</attribute>
<depends>jboss:service=Naming</depends>
I'm intrested only in sending messages.
But still:
javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 25;
nested exception is:
java.net.ConnectException: Connection refused
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1282)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:370)
at javax.mail.Service.connect(Service.java:275)
at javax.mail.Service.connect(Service.java:156)
at javax.mail.Service.connect(Service.java:105)
at javax.mail.Transport.send0(Transport.java:168)
at javax.mail.Transport.send(Transport.java:98)
<xxx>
Caused by: java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:529)
at java.net.Socket.connect(Socket.java:478)
at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:232)
at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:189)
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1250)
... 59 more
Of course connection is refused because application is still pointed on localhost:25.
I have tried to find with grep other configurations, allocations, etc. mail-service is started (jmx-console info). Still its looked like aplication is not configured properly but using defaults.. Whats wrong?
PS: I'm not specialist in JBoss. I don't have root account on this hosting server.
Related
One way I know to configure DB in JBOSS FUSE is to use blueprint.xml.
Below configuration in blueprint.xml works
<bean id="gemsDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" />
<property name="url" value="${gems_url}" />
<property name="username" value="${gems_username}" />
<property name="password" value="${gems_password}" />
<property name="maxIdle" value="5" />
<property name="minIdle" value="1" />
<property name="initialSize" value="1" />
</bean>
However, Is there any way to configure it in JBOSS container specific configuration file. For example - In JBOSS EAP we can configure it in standalone.xml. On similar lines can we configure it in JBOSS FUSE?
Jboss Fuse provides the integration with various data sources. You need to configure them bundle wise like you have used. But no such configuration is there on container level.
You can define a Datasource in a bundle and export it. In other bundles you import and use it like a service.
Prerequisites
Install these features
features:install jdbc
features:install jndi
Datasource bundle
Drop an XML file inside deploy folder with following content:
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
<bean id="dataSource" class="org.postgresql.jdbc3.Jdbc3SimpleDataSource">
<property name="url" value="jdbc:postgresql://localhost:5432/databasename"/>
<property name="user" value="username"/>
<property name="password" value="xxx"/>
</bean>
<service interface="javax.sql.DataSource" ref="dataSource">
<service-properties>
<entry key="osgi.jndi.service.name" value="jdbc/yourdatabasename_ds"/>
</service-properties>
</service>
</blueprint>
This will export a service with javax.sql.DataSource interface and a JNDI name
Use Datasource service
When a bundle needs the datasource, ask OSGi to inject it.
<blueprint>
<reference id="yourDatabaseDs"
interface="javax.sql.DataSource"
availability="mandatory"
filter="(osgi.jndi.service.name=jdbc/yourdatabasename_ds)"/>
</blueprint>
The right Datasource is retrieved using the JNDI name you provided.
Using availability="mandatory" you can force your bundle to wait for the Datasource to become available. The bundle won't start without this reference.
You need the correct JDBC drivers for the database you are using.
Other goodies
You have a lot of commands in JBoss Fuse console to interact with the database now, like jdbc:datasources that will list all available datasources. With jdbc:query you can run any SQL against your DB (good for debugging issues and testing the connection)
I want to use terracotta + Shiro in order to implement SSO. When I try to test it, I have the error:
The configuration data in the base configuration from server at 'localhost:9510' does not obey the Terracotta schema:
[0]: Line 4, column 5: Expected elements 'tc-properties servers clients' instead of 'system' here in element tc-config#http://www.terracotta.org/config
[1]: Line 16, column 13: Expected elements 'offheap authentication http-authentication data-backup tsa-port jmx-port tsa-group-port security' instead of 'statistics' here in element server
[2]: Line 19, column 13: Expected elements 'offheap authentication http-authentication data-backup tsa-port jmx-port tsa-group-port security' instead of 'dso-port' here in element server
[3]: Line 21, column 13: Expected elements 'offheap authentication http-authentication data-backup tsa-port tsa-group-port security' instead of 'l2-group-port' here in element server
[4]: Line 32, column 13: Expected elements 'offheap http-authentication data-backup tsa-port tsa-group-port security' instead of 'dso' here in element server
[5]: Line 50, column 9: Expected elements 'server mirror-group update-check garbage-collection restartable client-reconnect-window' instead of 'mirror-groups' here in element servers
[6]: Line 63, column 9: Expected elements 'server mirror-group update-check garbage-collection restartable client-reconnect-window' instead of 'ha' here in element servers
[7]: Line 86, column 5: Element not allowed: application in element tc-config#http://www.terracotta.org/config
Could anyone helps me to find what's wrong?
Here is my configuration:
ehcache.xml on the tc client:
<ehcache name="Plugin_Ehcache"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="ehcache.xsd"
updateCheck="false" monitoring="autodetect"
dynamicConfig="false">
<diskStore path="java.io.tmpdir/shiro-ehcache"/>
<defaultCache
maxElementsInMemory="10000"
eternal="false"
timeToIdleSeconds="120"
timeToLiveSeconds="120"
overflowToDisk="false"
diskPersistent="false"
diskExpiryThreadIntervalSeconds="120">
<terracotta/>
</defaultCache>
<cache name="shiro-activeSessionCache"
maxElementsInMemory="10000"
eternal="true"
timeToLiveSeconds="0"
timeToIdleSeconds="0"
diskPersistent="false"
overflowToDisk="false"
diskExpiryThreadIntervalSeconds="600">
<terracotta/>
</cache>
<terracottaConfig url="localhost:9510"/>
</ehcache>
tc-config.xml on the tc server
<tc:tc-config xsi:schemaLocation="http://www.terracotta.org/schema/terracotta-8.xsd"
xmlns:tc="http://www.terracotta.org/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<tc-properties>
<property name="l2.l1reconnect.enabled" value="true"/>
<property name="l2.l1reconnect.timeout.millis" value="5000"/>
<property name="sigar.enabled" value="false"/>
<property name="search.use.commit.thread" value="false"/>
<property name="search.lucene.use.ram.directory" value="true"/>
<property name="search.query.wait.for.txns" value="false"/>
<property name="logging.maxLogFileSize" value="100"/>
<property name="logging.maxBackups" value="10"/>
</tc-properties>
<system>
<configuration-model>development</configuration-model>
</system>
<servers>
<server host="localhost" name="Terracotta Server1">
<!-- Specify the path where the server should store its data. -->
<data>C:\Program Files\Terracotta\terracotta-3.7.5\server\server-data</data>
<logs>C:\Program Files\Terracotta\terracotta-3.7.5\server\server-logs</logs>
<index>C:\Program Files\Terracotta\terracotta-3.7.5\server\server-index</index>
<statistics>C:\Program Files\Terracotta\terracotta-3.7.5\server\server-statistics</statistics>
<!-- Specify the port where the server should listen for client
traffic. -->
<dso-port bind="127.0.0.1">9510</dso-port>
<jmx-port bind="127.0.0.1">9520</jmx-port>
<l2-group-port bind="localhost">9530</l2-group-port>
<!--jmx-port bind="xxx.xxx.xxx.xxx">9520</jmx-port>
<tsa-port>9510</tsa-port>
<tsa-group-port>9530</tsa-group-port-->
<!-- Enable BigMemory on the server. -->
<!--offheap>
<enabled>true</enabled>
<maxDataSize>4g</maxDataSize>
</offheap-->
<authentication/>
<dso>
<client-reconnect-window>120</client-reconnect-window>
<persistence>
<mode>permanent-store</mode>
<!--mode>temporary-swap-only</mode-->
<!--<offheap>
<enabled>false</enabled>
<maxDataSize>450m</maxDataSize>
</offheap>-->
</persistence>
<garbage-collection>
<enabled>true</enabled>
<verbose>false</verbose>
<interval>300</interval>
</garbage-collection>
</dso>
</server>
<mirror-groups>
<mirror-group group-name="group1">
<members>
<member>Terracotta Server1</member>
</members>
<ha>
<mode>networked-active-passive</mode>
<networked-active-passive>
<election-time>5</election-time>
</networked-active-passive>
</ha>
</mirror-group>
</mirror-groups>
<ha>
<mode>networked-active-passive</mode>
<networked-active-passive>
<election-time>5</election-time>
</networked-active-passive>
</ha>
<update-check>
<enabled>false</enabled>
</update-check>
<!-- Add the restartable element for Fast Restartability (optional). -->
<!--restartable enabled="true"/-->
</servers>
<clients>
<logs>logs-%i</logs>
</clients>
</tc:tc-config>
Which version of Terracotta libraries are you using ? The tc-config.xml has some updated tags in 4.x version onwards. Please make sure the tc-config and ehcache xml obeys the schema.
Cheers,
Ridhav
I saw you tried to use the mirror-group tag in your tc config, but it seems you misplaced it.
For example, this config should work :
<?xml version="1.0" encoding="UTF-8" ?>
<tc:tc-config xsi:schemaLocation="http://www.terracotta.org/schema/terracotta-8.xsd"
xmlns:tc="http://www.terracotta.org/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<tc-properties>
<property name="l2.l1reconnect.enabled" value="true"/>
<property name="l2.l1reconnect.timeout.millis" value="5000"/>
<property name="sigar.enabled" value="false"/>
<property name="search.use.commit.thread" value="false"/>
<property name="search.lucene.use.ram.directory" value="true"/>
<property name="search.query.wait.for.txns" value="false"/>
<property name="logging.maxLogFileSize" value="100"/>
<property name="logging.maxBackups" value="10"/>
</tc-properties>
<servers>
<mirror-group group-name="group1">
<server host="localhost" name="Terracotta Server1">
<!-- Specify the path where the server should store its data. -->
<data>C:\Program Files\Terracotta\terracotta-3.7.5\server\server-data</data>
<logs>C:\Program Files\Terracotta\terracotta-3.7.5\server\server-logs</logs>
<index>C:\Program Files\Terracotta\terracotta-3.7.5\server\server-index</index>
<!--<statistics>C:\Program Files\Terracotta\terracotta-3.7.5\server\server-statistics</statistics>-->
<!-- Specify the port where the server should listen for client
traffic. -->
<tsa-port>9510</tsa-port>
<jmx-port>9520</jmx-port>
<tsa-group-port>9530</tsa-group-port>
<authentication/>
</server>
</mirror-group>
<update-check>
<enabled>false</enabled>
</update-check>
<!-- Add the restartable element for Fast Restartability (optional). -->
<!--restartable enabled="true"/-->
</servers>
<clients>
<logs>logs-%i</logs>
</clients>
</tc:tc-config>
Take a look at this line that defines the schema used to construct your xml configuration file:
<tc:tc-config xsi:schemaLocation="http://www.terracotta.org/schema/terracotta-8.xsd
Enter the address provided and take a look at how nested xml elements and attributes are allowed to be used.
For instance, element dso-port is allowed in terracotta-6.xsd and terracotta-7.xsd, but not in the terracotta-8.xsd, which is the one you declared.
By the way, depending on the version of terracotta server you use, the appropriate xml schema should be declared due to element incompatibilities.
I'm trying to invoke an Stateless Session Bean (EJB 3) deployed on Jboss 7.1 Final from an remote instance of JBoss ESB 4.10.
In my jboss-esb.xml I have the following information:
<action name="EJBTestWithReturnValue" class="org.jboss.soa.esb.actions.EJBProcessor">
<property name="ejb3" value="true" />
<property name="method" value="login" />
<property name="jndi-name" value="gwtbatis-ear/gwtibatis-ejb/UserServiceEJB!com.aestasit.gwtibatis.UserServiceRemote" />
<property name="initial-context-factory" value="org.jnp.interfaces.NamingContextFactory" />
<property name="security-principal" value="xxxx" />
<property name="security-credentials" value="xxxx" />
<property name="provider-url" value="localhost:4447" />
<property name="ejb-params">
<arg0 type="java.lang.String">username</arg0>
<arg1 type="java.lang.String">password</arg1>
</property>
<property name="esb-out-var" value="org.jboss.soa.esb.message.defaultEntry"/>
Whatever JNDI binding I try I always get an error "invalid stream header: 00000018".
I successfully invoke the same EJB from a Java client but I use a different context factory ("org.jboss.naming.remote.client.InitialContextFactor").
Is there a way to invoke the remote EJB from ESB, without importing the client lib required by JBoss 7 and wriying my own EJB invoker?
If I run HornetQ with config\stand-alone\non-clustered config files, the HornetQ server starts up fine.
If I remove the JNDI and JMS sections from the hornetq-beans.xml file:
<!-- JNDI server. Disable this if you don't want JNDI -->
<bean name="JNDIServer" class="org.jnp.server.Main">
<property name="namingInfo">
<inject bean="Naming"/>
</property>
<property name="port">1099</property>
<property name="bindAddress">localhost</property>
<property name="rmiPort">1098</property>
<property name="rmiBindAddress">localhost</property>
</bean>
AND
<!-- The JMS server -->
<bean name="JMSServerManager" class="org.hornetq.jms.server.impl.JMSServerManagerImpl">
<constructor>
<parameter>
<inject bean="HornetQServer"/>
</parameter>
</constructor>
</bean>
I get the server dying immediately. This is the output I get:
C:\development\hornetQ\hornetq-2.2.14.Final\bin>run.bat ..\config\custom
A subdirectory or file ..\logs already exists.
***********************************************************************************
"java -XX:+UseParallelGC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Xms512M - Xmx1024M -Dhornetq.config.dir=..\config\custom
-Djava.util.logging.config.file=..\config\custom\logging.properties -java.library.path=. -classpath ..\config\custom;..\schemas\;
C:\development\hornetQ\hornetq-2.2.14.Final\lib\hornetq-bootstrap.jar;C:\development\hornetQ\hornetq-2.2.14.Final\lib\hornetq-core-client-java5.jar;
C:\development\hornetQ\hornetq-2.2.14.Final\lib\hornetq-core-client.jar;C:\development\hornetQ\hornetq-2.2.14.Final\lib\hornetq-core.jar;
...etc.
***********************************************************************************
* [main] 28-Aug 11:7:22,132 INFO [HornetQBootstrapServer] Starting HornetQ Server
* [main] 28-Aug 11:7:23,91 WARNING [FileConfigurationParser] AIO wasn't located on this platform, it will fall back to using pure Java NIO. If your platform is Linux, install
LibAIO to enable the AIO journal
* [hornetq-shutdown-thread] 28-Aug 11:7:23,147 INFO [HornetQBootstrapServer] Stopping HornetQ Server...
Would appreciate if someone would tell me what I'm doing wrong.
I want to configure my mail-service.xml to send emails from my Gmail account. I have made a configuration, but it doesn't work
<?xml version="1.0" encoding="UTF-8"?>
<server>
<mbean code="org.jboss.mail.MailService"
name="jboss:service=Mail">
<attribute name="JNDIName">java:/Mail</attribute>
<attribute name="User">***#gmail.com</attribute>
<attribute name="Password">***</attribute>
<attribute name="Configuration">
<configuration>
<property name="mail.smtp.auth" value="true"/>
<property name="mail.smtp.starttls.enable" value="true"/>
<property name="mail.smtp.socketFactory.class" value="javax.net.ssl.SSLSocketFactory"/>
<!-- Change to your mail server prototocol -->
<property name="mail.store.protocol" value="pop3"/>
<property name="mail.transport.protocol" value="smtp"/>
<!-- Change to the user who will receive mail -->
<property name="mail.user" value="nobody"/>
<!-- Change to the mail server -->
<property name="mail.pop3.host" value="pop3.nosuchhost.nosuchdomain.com"/>
<!-- Change to the SMTP gateway server -->
<property name="mail.smtp.host" value="smtp.gmail.com"/>
<!-- The mail server port -->
<property name="mail.smtp.port" value="465"/>
<!-- Change to the address mail will be from -->
<property name="mail.from" value="nobody#nosuchhost.nosuchdomain.com"/>
<!-- Enable debugging output from the javamail classes -->
<property name="mail.debug" value="false"/>
</configuration>
</attribute>
<depends>jboss:service=Naming</depends>
</mbean>
</server>
I struggled with this too, but eventually got it working. I wrote up what I did here:
http://mrmcgeek.blogspot.com/2010/09/confguring-java-mail-with-jboss-as-5.html
You need to add the following to the mail-service.xml:
<property name="mail.smtp.user" value="${username}#gmail.com" />
<property name="mail.smtp.password" value="${password}" />
<property name="mail.smtp.ssl.enable" value="true" />
You didn't set the host properly.Try this one
<?xml version="1.0" encoding="UTF-8"?>
<!-- $Id: mail-service.xml 62350 2007-04-15 16:50:12Z dimitris#jboss.org $ -->
<server>
<mbean code="org.jboss.mail.MailService"
name="jboss:service=Mail">
<attribute name="JNDIName">java:/Mail</attribute>
<attribute name="User">type sender mail id here</attribute>
<attribute name="Password">type password</attribute>
<attribute name="Configuration">
<!-- A test configuration -->
<configuration>
<property name="mail.smtp.auth" value="true"/>
<property name="mail.smtp.starttls.enable" value="true"/>
<property name="mail.smtp.socketFactory.class" value="javax.net.ssl.SSLSocketFactory"/>
<!-- Change to your mail server prototocol -->
<property name="mail.store.protocol" value="pop3"/>
<property name="mail.transport.protocol" value="smtp"/>
<!-- Change to the user who will receive mail -->
<property name="mail.user" value="nobody"/>
<!-- Change to the SMTP gateway server -->
<property name="mail.smtp.host" value="smtp.gmail.com"/>
<!-- The mail server port -->
<property name="mail.smtp.port" value="465"/>
<!-- Change to the address mail will be from -->
<property name="mail.from" value=""/>
<!-- Enable debugging output from the javamail classes -->
<property name="mail.debug" value="false"/>
</configuration>
</attribute>
<depends>jboss:service=Naming</depends>
</mbean>
</server>