java-ee

Error Obtaining Lock (org.neo4j.kernal.StoreLockException)

微笑、不失礼 提交于 2019-12-12 10:43:56
问题 When trying to create new nodes in an already existing database, I am getting the following exception: org.neo4j.kernal.StoreLockException . The code snippit below is the actual line that results in the exception. Below that I have attached some more detail and the full stack trace. If I create a new folder and use that as the DB_PATH , then my code works fine on the first run. On the second run, it will fail with the same exception. It appears something is preventing the lock from being

How to list all JNDI entries in “java:global” namespace

时光总嘲笑我的痴心妄想 提交于 2019-12-12 10:42:57
问题 Goal is to list all the JNDI entries programmatically. new InitialContext().list("java:global") doesn't work. EJB 3.1, Wildfly or Glassfish 4 回答1: I think that the safer way to navigate in JNDI namespace is first to lookup its root and then list its content. I've tried this way in WildFly 8.1.0 and it worked : Context root = (Context) new InitialContext().lookup("java:global"); NamingEnumeration<NameClassPair> names = root.list(""); 来源: https://stackoverflow.com/questions/26463970/how-to-list

How to stack custom annotation in Java with @Inject annotation

吃可爱长大的小学妹 提交于 2019-12-12 10:02:25
问题 I saw this several times when browsing.. people are using @Inject annotation with their own to inject EntityManager like this: @Inject @MyEm EnityManager em; because you cannot just inject the EntityManager . You can do it only with @PersistenceContext . Does anybody know how to make this work (with the custom annotation), because I didn't find any information on the net? Give a example if you can, please. 回答1: Basically what you need to do is create a discriminator annotation and use it in

Specifics on How Glassfish Server is Run with IntelliJ Debugger?

為{幸葍}努か 提交于 2019-12-12 09:59:46
问题 I'm curious as to how the IntelliJ debugger uses the domain.xml of my glassfish server and reports a webpage when requested. Specifically, I have an IntelliJ project called blobGame that uses a Glassfish server that opens a webpage called blobGame when the artifacts .war and .ear are deployed. Firstly, how are these artifacts deployed? When I deploy them, I MUST have the URL of the localhost be http://localhost:60836/blobGame_war_exploded , and localhost:60836/blobGame DOES NOT WORK, even if

JDBC SQL aliasing not working

北城以北 提交于 2019-12-12 09:58:20
问题 I am trying to run the following query in my java web application: SELECT platform AS "Platform" FROM edb.cases The web-app is working fine and is able to execute all queries however whenever I use an alias (through 'AS'), the resultant data-set gives me a null value for the alias. In fact, despite using an alias for the column 'platform' in the above query, the resultant data-set has a null value for the key 'Platform' but gives me the correct value for the key 'platform' (which is the

JMS Timeout or TimeToLive

风格不统一 提交于 2019-12-12 09:56:51
问题 I am fairly new to Java EE and JMS and am looking at doing an implementation using JMS. Think of the following scenario: Scenario A user hits a servlet. A message is then put into a JMS server/Queue from this servlet. A response is then sent back to the user saying "Message Queued". Option 1 The consumer/MDB receives the message from the JMS queue and processes it. This is normal operation and pretty standard. Option 2 There is no consumer(for what ever reason) or the receiver is processing

what method in jsoup can return the modified html?

随声附和 提交于 2019-12-12 09:49:46
问题 When I parse the html file(stored in native) with jsoup . I have modified some elements in the html file, so I want to save the modified html, and replace the old one? Do any body know which method in jsoup can do the job? Thank you so much!!! 回答1: You could write the contents of either document.toString() or document.outerHtml() to file, where document is got from Document document = Jsoup.connect("http://...").get(); // any document modifications... like so: BufferedWriter htmlWriter = new

How to unit testing EJBs when using JPA2?

Deadly 提交于 2019-12-12 09:46:38
问题 How would you go about unit testing an EJB that uses JPA? For example, if I have an Order entity and and OrderEJB that is supposed to calculate the total of an order (as defined below) how would I go about unit testing the EJB without touching the database? Also, how would you define values for your entities, so you can assert the expected calculation? Here is some example code below... @Entity public class Order { @Id private long OrderId; private LineItem[] items; } And an orderEJB

Are there any advantages to using an XSLT stylesheet compared to manually parsing an XML file using a DOM parser

我的未来我决定 提交于 2019-12-12 09:45:38
问题 For one of our applications, I've written a utility that uses java's DOM parser. It basically takes an XML file, parses it and then processes the data using one of the following methods to actually retrieve the data. getElementByTagName() getElementAtIndex() getFirstChild() getNextSibling() getTextContent() Now i have to do the same thing but i am wondering whether it would be better to use an XSLT stylesheet. The organisation that sends us the XML file keeps changing their schema meaning

How often is a programmatic created EJB Timer executed in a cluster?

陌路散爱 提交于 2019-12-12 09:44:24
问题 In a clustered JEE6 environment (Glassfish 3.1.2), a @Singleton bean is/can be created on every cluster node. If this Singleton Bean registers a programmatic timer on its @PostConstruct - how often is the @Timeout method executed? -- on only one of that singletons (per tick), or once (per tick) for each Singeton that registered that a timer? Below the code is an example what this question mean to this code. @Singleton public class CachedService { @Resource private TimerService timerService;