Java EE

17K

Solutions

9K

Contributors

Java Enterprise Edition (Java EE) is a specification defining a collection of Java-based server and client technologies and how they interoperate. Java EE specifies server and client architectures and uses profiles to define technology sets targeted at specific classes of applications. All Java EE profiles share a set of common features, such as naming and resource injection, packaging rules and security requirements.

Share tech news, updates, or what's on your mind.

Sign up to Post

while doing maven clean and then maven insall i am getting below error while doing maven install





COMPILATION ERROR :
[INFO] -------------------------------------------------------------
No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------






[INFO] BUILD FAILURE



how to fix this error.

what is root cause of this.
why not eclipse always remember my jdk?
do i ned to set up separately and tell eclipse about my jdk1.8??

please advise
0
Free Tool: SSL Checker
LVL 9
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

while importing unzipped code as import as maven project to eclipse getting below error



Project testproject already exists


 Add a version or custom suffix using "Name template" in "Advanced" settings



how to fix this error. pLEase advise
0
Please help, I am trying to run my project through debug as it helps me see my break points and if my code it working line by line but now when i try to debbug i get this exception. I tried using this link below to resolve my issue but now I am worried it could be something in my code.

https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014690354 

When I run it straight with the server its fine but I want to debug. I am fairly new in JAVA and feel very very DUMB



[2017/08/16 10:03:01:061 CAT] 00000087 LocalTranCoor E   WLTC0017E: Resources rolled back due to setRollbackOnly() being called.
[2017/08/16 10:03:01:061 CAT] 00000087 webapp        E com.ibm.ws.webcontainer.webapp.WebApp logServletError SRVE0293E: [Servlet Error]-[GenericServletWrapper]: javax.el.ELException: Unable to find ExpressionFactory of type: com.ibm.javart.debug.resolution.InterpExpressionFactory
      at javax.el.ExpressionFactory.newInstance(ExpressionFactory.java:190)
      at javax.el.ExpressionFactory.newInstance(ExpressionFactory.java:118)
      at com.ibm.ws.jsp.configuration.JspConfiguration.<init>(JspConfiguration.java:63)
      at com.ibm.ws.jsp.configuration.JspConfigurationManager.getConfigurationForUrl(JspConfigurationManager.java:99)
      at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.translateJsp(AbstractJSPExtensionServletWrapper.java:560)
      at …
0
I need to send a POST request using java. The server i am trying to access has a username and password i need to pass those parameters as well.

1.) I have installed Tomcat in my machine and configured the developer environment. I am using eclipse. There are different types of projects i could create using Eclipse, and i need to know what is the best project i should create to develop my application ?

2.) Can someone show me some sample code or tutorial which would help me to develop my task ?

My Eclipse version : Eclipse Java EE, Indigo service release 2

EDIT

Is it a JPA project, Enterprise Application Project, Dynamic Web Project, Dynamic Web Application, EJB project, Application Client project, Static Web Project.
1
Below line gives error as below as        device.getInternetConnection() return enum not String.            
callableStatement.setString("InternetConnection", device.getInternetConnection());


Multiple markers at this line
      - The method getInternetConnection() is undefined for the type Device
      - The method setString(String, String) in the type CallableStatement is not applicable for the arguments (String,
       Device.getInternetConnection)


Here  device.getInternetConnection()); returns the enum  InternetConnection

      public enum InternetConnection{
            
            WIFI("08"),
            CELLULAR("06");
            
            InternetConnection(String ip){
                  this.ip = ip;
            }
            
            private final String ip;
            
            public static InternetConnection getFromIP(String ip) {
                  for(InternetConnection pc : InternetConnection.values()) {
                  if(pc.getIP().equals(ip))...
                       ......
                  }
                  throw new IllegalArgumentException("This iP: " + iP + " does not exist");
            }
            
            public String getIP() {
                  return ip;
            }
      }

How to change my callable statement setter to accommodate enum instead of string?
please advise
0
Hi,

while creating client from wsdl using web servicesw getting below error




public class CustomerOrdersWS {

      public static void main(String[] args) {
            // TODO Auto-generated method stub
            CustomerOrdersService service=new CustomerOrdersService(new URL{"http://localhost:8080/wsdlfirstws/services/customerOrders?wsdl"});
            

      }

}




Multiple markers at this line
      - Type mismatch: cannot convert from String[] to
       CustomerOrdersService
      - Syntax error on token(s), misplaced construct(s)
      - Syntax error on token ")", delete this token

i wonder what it mean by above error and how to resolve it please advise
0
tomcat wont start in debug

where as tomcat is staring fine in regular mode.

i increased time out from 45 to 450 still similar error.

Server Tomcat v8.0 Server at localhost was unable to start within 450 seconds. If the server requires more time, try increasing the timeout in the server editor.
i wonder why server starts in regular mode but takes forever to start in debug mode.

regular startup happens in 10 seconds asap.

Aug 14, 2017 5:40:21 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:wsdlfirstws' did not find a matching property.
Aug 14, 2017 5:40:21 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version:        Apache Tomcat/8.0.39
Aug 14, 2017 5:40:21 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built:          Nov 9 2016 08:48:39 UTC
Aug 14, 2017 5:40:21 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server number:         8.0.39.0
Aug 14, 2017 5:40:21 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name:               Windows 10
Aug 14, 2017 5:40:21 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version:            10.0
Aug 14, 2017 5:40:21 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture:          amd64
Aug 14, 2017 5:40:21 PM org.apache.catalina.startup.VersionLoggerListener log…
0
Hi,

I have  abc.zip which i unzipped and imported to eclipse as maven project.

Later i got updated version of abc2.zip. I extracted to differnt folder called new_folder. Now when i try to import abc2.zip i am getting error as

 Project wsdlfirstws already exists
 Add a version or custom suffix using "Name template" in "Advanced" settings



how to fix this error and import updated abc2 project
0
Hi, I'm Pradip Kumar, Java Developer. I need some help to Develop My Java application for my desktop.
To show registry key, subregistry key till n number,
To show control panel Installed software under J Frame Java .
0
While installing tomcat how to know which http free port is free?8080 is always busy occupied by glassfish etc.

any tool or software etc which tells all free and occupied ports on my windows laptop to decide which port to allocate to tomcat?

what is ajp/1.3 conector port 8009 which shows while installing?
please advise
0
Free Tool: Subnet Calculator
LVL 9
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

http://codingbat.com/prob/p152303
I am looking at above challenge description

Given an array of strings, return a Map<String, Integer> containing a key for every different string in the array, always with the value 0. For example the string "hello" makes the pair "hello":0. We'll do more complicated counting later, but for this problem the value is simply 0.

word0(["a", "b", "a", "b"]) → {"a": 0, "b": 0}
word0(["a", "b", "a", "c", "b"]) → {"a": 0, "b": 0, "c": 0}
word0(["c", "b", "a"]) → {"a": 0, "b": 0, "c": 0}

not clear on what hello has to do with unique string. please advise
public Map<String, Integer> word0(String[] strings) {
 
Map map=new HashMap(<String, Integer>);

for(String : strings){
  map.put(strings[i],0);
}
return map;
}

Open in new window


above gives below error


Compile problems:


missing '}' or illegal start of expression

see Example Code to help with compile problems


how to improve and fix my code . please advise
0
while trying below challenge
http://codingbat.com/prob/p136950

i wrote my code as below

public Map<String, String> mapAB4(Map<String, String> map) {
   if( map.get("a")!=null && map.get("b")!=null && map.get("a").length()> map.get("b").length() ){
    map.put("c",map.get("a"));
    
  }
    if( map.get("a")!=null && map.get("b")!=null && map.get("b").length()> map.get("a").length() ){
    map.put("c",map.get("b"));
    
  }
   if( map.get("a")!=null && map.get("b")!=null && map.get("a").equals(map.get("b")) ){
    map.put("a","");
    map.put("b","");
  }
  
  if( map.get("a")!=null && map.get("b")!=null && map.get("a").equals(map.get("b")) ){
    map.put("a","");
    map.put("b","");
  }
  return map;
}

Open in new window


i am failing below tests
Expected      Run            
mapAB4({"a": "aaa", "b": "bb", "c": "cake"}) → {"a": "aaa", "b": "bb", "c": "aaa"}      {"a": "aaa", "b": "bb", "c": "aaa"}      OK      
mapAB4({"a": "aa", "b": "bbb", "c": "cake"}) → {"a": "aa", "b": "bbb", "c": "bbb"}      {"a": "aa", "b": "bbb", "c": "bbb"}      OK      
mapAB4({"a": "aa", "b": "bbb"}) → {"a": "aa", "b": "bbb", "c": "bbb"}      {"a": "aa", "b": "bbb", "c": "bbb"}      OK      
mapAB4({"a": "aaa"}) → {"a": "aaa"}      {"a": "aaa"}      OK      
mapAB4({"b": "bbb"}) → {"b": "bbb"}      {"b": "bbb"}      OK      
mapAB4({"a": "aaa", "b": "bbb", "c": "cake"}) → {"a": "", "b": "", "c": "cake"}      {"a": "aaa", "b": "bbb", "c": "cake"}      X      
mapAB4({"a": "a", "b": "b", "c": "cake"}) → {"a": "", "b": "", "c": "cake"}      {"a": "a", "b": "b", "c": "cake"}      X      
0
when i am trying below challenge
http://codingbat.com/prob/p115012

as below
public Map<String, String> mapAB3(Map<String, String> map) {
  if(map.get("a")!=null ){
    
    map.put("b",map.get("a"));
  }
  
   if(map.get("b")!=null){
     map.put("a",map.get("b"));
   }
   return map;
}

Open in new window


public Map<String, String> mapAB3(Map<String, String> map) {
  if(map.get("a")!=null ){
   
    map.put("b",map.get("a"));
  }
 
   if(map.get("b")!=null){
     map.put("a",map.get("b"));
   }
   return map;
}
I am failing one edge case. how to improve my code and fix it. please advise
0
Hi,

I like to see some .class files generated in EAR file. Is there any java free decompiler to do this within eclipse and outside eclipse as well. please advise
0
i wrote my XSD as below  and getting error.
what i the meaning of error and ow to resolve it. please advise
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.gp.com/Patient"
	xmlns:tns="http://www.gp.org/Patient" elementFormDefault="qualified">
	
	<element name="patient" type="tns:Patient"/>
	
	<complexType name="Patient">
	
	<sequence>
	<element name="id" type="int"/>
	<element name="name" type="string"/>
	<element name="age" type="int"/>
	<element name="dob" type="date"/>
	<element name="email" type="string"/>
	<element name="gender" type="string"/>
	<element name="phone" type="string"/>
	
	</sequence>
	
	</complexType>
	
</schema>

Open in new window


src-resolve.4.2: Error resolving component 'tns:Patient'. It was detected that 'tns:Patient' is in namespace 'http://
 www.gp.org/Patient', but components from this namespace are not referenceable from schema document 'file:///C:/
 Users/gp/neon_workspace/spring_module4/XMLProj/Patient.xsd'. If this is the incorrect namespace, perhaps the prefix
 of 'tns:Patient' needs to be changed. If this is the correct namespace, then an appropriate 'import' tag should be added
 to 'file:///C:/Users/gp/neon_workspace/spring_module4/XMLProj/Patient.xsd'.
1
A technology that has been really helpful as a Java developer is the ability to hot swap code using a technology like jRebel. Not having to restart the application server every time I make a change has really sped up development.
1
Hi there,
I am new to gradle.  I have a tar file uploaded to JFrog artifactory under ext-snapshot-local and it is saved as test.ambuli-1.0.0.tar
I want to download this file and extract it.  I am not sure, how to refer to the file in the dependencies.


apply plugin: 'java'
apply plugin: 'maven-publish'


configurations {
    AmbuliTar
}


dependencies {
  AmbuliTar('') ????????
}



repositories {

   println 'doing repo'

   maven {
      def repName = "ext-snapshot-local"
      println "building from $repName using"
      
      credentials {
          username artifactoryUserDev
          password artifactoryUserDevPassword
      }   
      url "http://${artifactoryHost}:${artifactoryPort}/artifactory/$repName"
   }
   
}  


task extractTar {
   File myTarFile = configurations.getByName('AmbuliTar').singleFile
     if(myTarFile.exists()) {
         ant.unar(src: myTarFile, dest: file('myDest'))

   }

}

Open in new window

0
Hi,


what is difference between below 3 lines




 map.put("ab", map.get("a").concat(map.get("b")));



map.put("ab", map.get("a")+ map.get("b"));

map.put("ab", "null" + map.get("b"));


I passed all tests
http://codingbat.com/prob/p107259
Looking for ways to improve my code and also avoid Null pointer exceptions


Expected	Run		
mapAB({"a": "Hi", "b": "There"}) → {"a": "Hi", "ab": "HiThere", "b": "There"}	{"a": "Hi", "ab": "HiThere", "b": "There"}	OK	
mapAB({"a": "Hi"}) → {"a": "Hi"}	{"a": "Hi"}	OK	
mapAB({"b": "There"}) → {"b": "There"}	{"b": "There"}	OK	
mapAB({"c": "meh"}) → {"c": "meh"}	{"c": "meh"}	OK	
mapAB({"a": "aaa", "ab": "nope", "b": "bbb", "c": "ccc"}) → {"a": "aaa", "ab": "aaabbb", "b": "bbb", "c": "ccc"}	{"a": "aaa", "ab": "aaabbb", "b": "bbb", "c": "ccc"}	OK	
mapAB({"ab": "nope", "b": "bbb", "c": "ccc"}) → {"ab": "nope", "b": "bbb", "c": "ccc"}	{"ab": "nope", "b": "bbb", "c": "ccc"}	OK

Open in new window


please advise
0
Hi,

public Map<String, String> topping2(Map<String, String> map) {
  if(map.get("ice cream")!=null){
    map.put("yogurt", map.get("ice cream"));
  }
  if(map.get("spinach")!=null){
    map.put("nuts", map.get("spinach"));
  }
  else{
    map=map;
  }
  return map;
}

Open in new window

how above code different from below code

public Map<String, String> topping2(Map<String, String> map) {
//public Map < String, String > topping1(Map < String, String > map) {
   // map.put("spinach", "nuts");
    if (map.containsKey("spinach")) {
        map.put("spinach", "nuts");
   }
      if (map.containsKey("ice cream")) {
        map.put("yogurt", map.get("ice cream"));
       // map.put("ice cream", map.get("ice cream"));

   }
    return map;
}

Open in new window


my above first code fails below test
http://codingbat.com/prob/p196458

Expected      Run            
topping2({"ice cream": "cherry"}) → {"yogurt": "cherry", "ice cream": "cherry"}      {"yogurt": "cherry", "ice cream": "cherry"}      OK      
topping2({"spinach": "dirt", "ice cream": "cherry"}) → {"yogurt": "cherry", "spinach": "nuts", "ice cream": "cherry"}      {"yogurt": "cherry", "spinach": "dirt", "ice cream": "cherry", "nuts": "dirt"}      X      
topping2({"yogurt": "salt"}) → {"yogurt": "salt"}      {"yogurt": "salt"}      OK      
topping2({"yogurt": "salt", "bread": "butter"}) → {"yogurt": "salt", "bread": "butter"}      {"yogurt": "salt", "bread": "butter"}      OK      
topping2({}) → {}      {}      OK      
topping2({"ice cream": "air", "salad": "oil"}) → {"yogurt": "air", "ice cream": "air", "salad": "oil"}      {"yogurt": "air", "ice cream": "air", "salad": "oil"}      OK      
0
Optimize your web performance
LVL 1
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Hi,

How below solution is different from

public Map<String, String> topping3(Map<String, String> map) {
 // Map<String, String> map=null;
  if(map.get("potato")!=null){
    map.put("fries",map.get("potato"));
  }
    if(map.get("salad")!=null){
    map.put("spinatch",map.get("salad"));
  }
  else
  map=map;
  return map;
  
}

Open in new window


below solution

public Map < String, String > topping3(Map < String, String > map) {
   // map.put("bread", "butter");
    if (map.containsKey("potato")) {
        map.put("fries", map.get("potato"));

    }
     if (map.containsKey("salad")) {
        map.put("spinach", map.get("salad"));

    }
    return map;
}

Open in new window



please advise.

First one does not pass all tests from
http://codingbat.com/prob/p128461
Expected      Run            
topping3({"potato": "ketchup"}) → {"potato": "ketchup", "fries": "ketchup"}      {"potato": "ketchup", "fries": "ketchup"}      OK      
topping3({"potato": "butter"}) → {"potato": "butter", "fries": "butter"}      {"potato": "butter", "fries": "butter"}      OK      
topping3({"salad": "oil", "potato": "ketchup"}) → {"spinach": "oil", "salad": "oil", "potato": "ketchup", "fries": "ketchup"}      {"salad": "oil", "spinatch": "oil", "potato": "ketchup", "fries": "ketchup"} missing: "spinach": "oil"      X      
topping3({"toast": "butter", "salad": "oil", "potato": "ketchup"}) → {"toast": "butter", "spinach": "oil", "salad": "oil", "potato": "ketchup", "fries": "ketchup"}      {"toast": "butter", "salad": "oil", "spinatch": "oil", "potato": "ketchup", "fries": "ketchup"} missing: "spinach": "oil"      X      
topping3({}) → {}      {}      OK      
topping3({"salad": "pepper", "fries": "salt"}) → {"spinach": "pepper", "salad": "pepper", "fries": "salt"}      {"salad": "pepper", "spinatch": "pepper", "fries": "salt"} missing: "spinach": "pepper"      X      
other tests
OK
0
We are still using Tomcat 6.0 and plan to move to latest version by next year. Problem with current version is to set the access deny to our web-application.

I tried adding valve with webapps/META-INF/context.xml file as below but nothing works. Can you please provide a fix.

<Context antiJARLocking="true" path="/">
<Valve className="org.apache.catalina.valves.RemoteIpValve" />
<Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="{IP_address}" />
</Context>

Or

<Context antiResourceLocking="false" privileged="true">
    <Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="127\.0\.0\.1,8\.8\.4\..*"/>
</Context>

Open in new window


Do you guys have any another solution as I want to restrict outside users from accessing Manager view and it will be accessible only from localhost?

Best Regards
0
Hi Experts,

I have a list of files all the file names will be stored in one text document.
now i want to know all the filenames are available in souce directory.
how to identify it.
Please refer the attachment.
0
Hi,
i am making an ajax call with text in post data. how do i capture this text in a parameter of a method in my controller or inside the method.
Thanks
0
i want to introduce JPA to my project which is developed with spring mvc.
so i want to use  both JPA and Spring datasouce.. because older DAO files have been developed with spring data source with templets.

is it possible to use both JPA and datasource in same project with out any sideeffects or future problems?
any examples?
0
i am using spring MVCframework for my project.

 <bean id="PurgeScheduler" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
           <property name="jobDetail" ref="PurgeJob"/>  
           <property name="cronExpression" value="${schedule.Purge.cron}"/>          
    </bean>

I have configured my job as above.. it is working fine..


My problem is , to update  'cronExpression' value.. i need to open properties file and update.
i want to move the properties to Database..

how  to read and set the cron expression value from database while starting up jboss server.
0

Java EE

17K

Solutions

9K

Contributors

Java Enterprise Edition (Java EE) is a specification defining a collection of Java-based server and client technologies and how they interoperate. Java EE specifies server and client architectures and uses profiles to define technology sets targeted at specific classes of applications. All Java EE profiles share a set of common features, such as naming and resource injection, packaging rules and security requirements.