Advertisement
Guest User

Za marka

a guest
Feb 13th, 2016
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.47 KB | None | 0 0
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <tomee>
  3.  
  4. <Container id="My Singleton Container" type="SINGLETON">
  5. # Specifies the maximum time an invocation could wait for the
  6. # singleton bean instance to become available before giving up.
  7. #
  8. # After the timeout is reached a javax.ejb.ConcurrentAccessTimeoutException
  9. # will be thrown.
  10. #
  11. # Usable time units: nanoseconds, microsecons, milliseconds,
  12. # seconds, minutes, hours, days. Or any combination such as
  13. # "1 hour and 27 minutes and 10 seconds"
  14.  
  15. AccessTimeout = 30 seconds
  16.  
  17. </Container>
  18.  
  19. <Container id="My Stateful Container" type="STATEFUL">
  20. # Specifies the maximum time an invocation could wait for the
  21. # stateful bean instance to become available before giving up.
  22. #
  23. # After the timeout is reached a javax.ejb.ConcurrentAccessTimeoutException
  24. # will be thrown.
  25. #
  26. # Usable time units: nanoseconds, microsecons, milliseconds,
  27. # seconds, minutes, hours, days. Or any combination such as
  28. # "1 hour and 27 minutes and 10 seconds"
  29.  
  30. AccessTimeout = 30 seconds
  31.  
  32. # The passivator is responsible for writing beans to disk
  33. # at passivation time. Different passivators can be used
  34. # by setting this property to the fully qualified class name
  35. # of the PassivationStrategy implementation. The passivator
  36. # is not responsible for invoking any callbacks or other
  37. # processing, its only responsibly is to write the bean state
  38. # to disk.
  39. #
  40. # Known implementations:
  41. # org.apache.openejb.core.stateful.RAFPassivater
  42. # org.apache.openejb.core.stateful.SimplePassivater
  43.  
  44. Passivator org.apache.openejb.core.stateful.SimplePassivater
  45.  
  46. # Specifies the time to wait between invocations. This
  47. # value is measured in minutes. A value of 5 would
  48. # result in a time-out of 5 minutes between invocations.
  49. # A value of zero would mean no timeout.
  50.  
  51. TimeOut 20
  52.  
  53. # Specifies the frequency (in seconds) at which the bean cache is checked for
  54. # idle beans.
  55.  
  56. Frequency 60
  57.  
  58. # Specifies the size of the bean pools for this
  59. # stateful SessionBean container.
  60.  
  61. Capacity 1000
  62.  
  63. # Property name that specifies the number of instances
  64. # to passivate at one time when doing bulk passivation.
  65. # Must be less than the PoolSize.
  66.  
  67. BulkPassivate 100
  68.  
  69. </Container>
  70.  
  71. <Container id="My Stateless Container" type="STATELESS">
  72.  
  73. # Specifies the time an invokation should wait for an instance
  74. # of the pool to become available.
  75. #
  76. # After the timeout is reached, if an instance in the pool cannot
  77. # be obtained, the method invocation will fail.
  78. #
  79. # Usable time units: nanoseconds, microsecons, milliseconds,
  80. # seconds, minutes, hours, days. Or any combination such as
  81. # "1 hour and 27 minutes and 10 seconds"
  82.  
  83. AccessTimeout = 30 seconds
  84.  
  85. # Specifies the size of the bean pools for this stateless
  86. # SessionBean container. If StrictPooling is not used, instances
  87. # will still be created beyond this number if there is demand, but
  88. # they will not be returned to the pool and instead will be
  89. # immediately destroyed.
  90.  
  91. MaxSize = 10
  92.  
  93. # Specifies the minimum number of bean instances that should be in
  94. # the pool for each bean. Pools are prefilled to the minimum on
  95. # startup. Note this will create start order dependencies between
  96. # other beans that also eagerly start, such as other @Stateless
  97. # beans with a minimum or @Singleton beans using @Startup. The
  98. # @DependsOn annotation can be used to appropriately influence
  99. # start order.
  100. #
  101. # The minimum pool size is rigidly maintained. Instances in the
  102. # minimum side of the pool are not eligible for IdleTimeout or
  103. # GarbageCollection, but are subject to MaxAge and flushing.
  104. #
  105. # If the pool is flushed it is immediately refilled to the minimum
  106. # size with MaxAgeOffset applied. If an instance from the minimum
  107. # side of the pool reaches its MaxAge, it is also immediately
  108. # replaced. Replacement is done in a background queue using the
  109. # number of threads specified by CallbackThreads.
  110.  
  111. MinSize = 0
  112.  
  113. # StrictPooling tells the container what to do when the pool
  114. # reaches it's maximum size and there are incoming requests that
  115. # need instances.
  116. #
  117. # With strict pooling, requests will have to wait for instances to
  118. # become available. The pool size will never grow beyond the the
  119. # set MaxSize value. The maximum amount of time a request should
  120. # wait is specified via the AccessTimeout setting.
  121. #
  122. # Without strict pooling, the container will create temporary
  123. # instances to meet demand. The instances will last for just one
  124. # method invocation and then are removed.
  125. #
  126. # Setting StrictPooling to false and MaxSize to 0 will result in
  127. # no pooling. Instead instances will be created on demand and live
  128. # for exactly one method call before being removed.
  129.  
  130. StrictPooling = true
  131.  
  132. # Specifies the maximum time that an instance should live before
  133. # it should be retired and removed from use. This will happen
  134. # gracefully. Useful for situations where bean instances are
  135. # designed to hold potentially expensive resources such as memory
  136. # or file handles and need to be periodically cleared out.
  137. #
  138. # Usable time units: nanoseconds, microsecons, milliseconds,
  139. # seconds, minutes, hours, days. Or any combination such as
  140. # "1 hour and 27 minutes and 10 seconds"
  141.  
  142. MaxAge = 0 hours
  143.  
  144. # Specifies the maximum time that an instance should be allowed to
  145. # sit idly in the pool without use before it should be retired and
  146. # removed.
  147. #
  148. # Usable time units: nanoseconds, microsecons, milliseconds,
  149. # seconds, minutes, hours, days. Or any combination such as
  150. # "1 hour and 27 minutes and 10 seconds"
  151.  
  152. IdleTimeout = 0 minutes
  153.  
  154. </Container>
  155.  
  156. <Container id="My Message Container" type="MESSAGE">
  157.  
  158. # The resource adapter delivers messages to the container
  159. # Default value is Default JMS Resource Adapter.
  160.  
  161. ResourceAdapter = MyJmsResourceAdapter
  162.  
  163. # Specifies the message listener interface handled by this container
  164. # Default value is javax.jms.MessageListener.
  165.  
  166. MessageListenerInterface = javax.jms.MessageListener
  167.  
  168. # Specifies the activation spec class
  169. # Default value is org.apache.activemq.ra.ActiveMQActivationSpec.
  170.  
  171. ActivationSpecClass = org.apache.activemq.ra.ActiveMQActivationSpec
  172.  
  173. # Specifies the maximum number of bean instances that are allowed to
  174. # exist for each MDB deployment.
  175. # Default value is 10.
  176.  
  177. InstanceLimit = 10
  178.  
  179. </Container>
  180.  
  181. <Resource id="MyJmsResourceAdapter" type="ActiveMQResourceAdapter">
  182. BrokerXmlConfig = broker:(tcp://localhost:61616)
  183. ServerUrl = tcp://localhost:61616
  184. DataSource = My Unmanaged DataSource
  185. </Resource>
  186.  
  187. <Resource id="My DataSource" type="DataSource">
  188. JdbcDriver com.mysql.jdbc.Driver
  189. JdbcUrl jdbc:mysql://localhost:3306/ra_21_2012?autoReconnect=true
  190. UserName root
  191. Password komphome
  192. JtaManaged true
  193. </Resource>
  194.  
  195.  
  196. <Resource id="My Unmanaged DataSource" type="DataSource">
  197. JdbcDriver com.mysql.jdbc.Driver
  198. JdbcUrl jdbc:mysql://localhost:3306/ra_21_2012?autoReconnect=true
  199. UserName root
  200. Password komphome
  201. JtaManaged false
  202. </Resource>
  203.  
  204.  
  205. <Resource id="Mail" type="javax.mail.Session">
  206. mail.smtp.host=smtp.gmail.com
  207. mail.smtp.port=587
  208. mail.transport.protocol=smtp
  209. mail.smtp.auth=true
  210. mail.smtp.starttls.enable=true
  211. mail.smtp.user=isaprojekat2015
  212. password=jednostavna
  213. </Resource>
  214.  
  215. <Resource id="JmsConnectionFactory" type="javax.jms.ConnectionFactory">
  216. ResourceAdapter = MyJmsResourceAdapter
  217. </Resource>
  218.  
  219. <Resource id="PaymentQueue" type="javax.jms.Queue">
  220. destination=PaymentQueue
  221. </Resource>
  222.  
  223. <!-- see http://tomee.apache.org/containers-and-resources.html -->
  224.  
  225. <!-- activate next line to be able to deploy applications in apps -->
  226. <!-- <Deployments dir="apps" /> -->
  227.  
  228. <Deployments dir="apps/" />
  229. </tomee>
  230.  
  231.  
  232. ovo kopiras u tomee-xml u conf folderu. promeni samo parametre za bazu naravno!!!!
  233.  
  234.  
  235. @Resource(name="Mail")
  236. Session session;
  237.  
  238. javax.mail.Message msg = new MimeMessage(session);
  239. msg.setFrom(new InternetAddress("xxx@gmail.com"));
  240. msg.setRecipients(RecipientType.TO, InternetAddress.parse("xxx@gmail.com"));
  241. msg.setSubject("Test");
  242. msg.setText("http://localhost:8081/Vezbe09/NekiTvojServlet?key=" + temp.getId());
  243. msg.setSentDate(new Date());
  244.  
  245. // Sends the message
  246. Transport.send(msg);
  247.  
  248. System.out.println("MESSAGE BEAN: Mail was sent successfully.");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement