When you generate the LSPS Application, apart from the application, an embedded server, SDK Embedded Server, with the application deployed and a launcher is generated in the *<APP>-embedded* project. The server uses an embedded h2 database.
When you run the server using the launcher class, the server starts and if there is no h2 database, a new h2 database is created in the project.
The server is intended for testing purposes only. For information on how to set up production servers, refer to the deployment documentation
To configure the SMTP settings of SDK Embedded Server, set the respective properties in the mail/LSPS_MAIL
element of the<APP>-embedded/conf/conf/openejb.xml
file:
<Resource id="mail/LSPS_MAIL" type="javax.mail.Session"> mail.transport.protocol=smtp mail.smtp.host=<YOUR_SMTP> mail.smtp.port=25 mail.from=<YOUR@EMAIL.com> mail.smtp.user=lsps_user mail.smtp.auth=true mail.smtp.starttls.enable=true mail.smtp.password=<PASSWORD> password=<PASSWORD>
Important: SDK Embedded Server fails to communicate with an SMTP server that requires MD5Digest authentication. This causes the
sendEmail()
calls to fail. To force another authentication method, specify the following property in the<APP>-embedded/conf/conf/openejb.xml
file:mail.smtp.sasl.mechanisms=PLAIN
To add a data source to the SDK Embedded server, do the following:
In <YOUR_APP>-embedded/conf/conf/openejb.xml
, define the resource and its properties.
Example mssql data source
... <Resource id="jdbc/LSPS_DS" type="javax.sql.DataSource"> JdbcDriver com.microsoft.sqlserver.jdbc.SQLServerDriver JdbcUrl jdbc:sqlserver://localhost:1433;DatabaseName=lsps Username lsps Password lsps </Resource>
Now you can map a data type model to the data source:
You can also create entities for the data base entries and use them via EJBs with EntityManager.
To delete the embedded database of SDK Embedded Server, remove the h2
directory in the <YOUR_APP>-embedded
project.